This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable demangling of C++ symbols in the stacktrace
This allows you to view demangled and pretty printed C++ symbols in the stacktrace. Is especially useful considering that D is getting more and more support for C++. Now the C++ symbols in the stacktrace will be printed like this: test.d:7 [C++] Test<int>::SomeName(int, long, int) [0x55711efee36f] test.d:18 [C++] testcpp() [0x557228e17978] Signed-off-by: Ernesto Castellotti <[email protected]>
- Loading branch information
Ernesto Castellotti
committed
Mar 26, 2020
1 parent
36d80f7
commit 5022f16
Showing
5 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module core.internal.cppstack; | ||
|
||
__gshared Config config; | ||
|
||
struct Config | ||
{ | ||
bool enable; | ||
bool noprefix; | ||
string prefix = "[C++]"; | ||
} | ||
|
||
version (Shared) | ||
{ | ||
extern (C) pragma(crt_constructor) private void initCppStackConfig() | ||
{ | ||
import core.internal.parseoptions : initConfigOptions; | ||
initConfigOptions(config, "cppstack"); | ||
} | ||
} | ||
|
||
char[] demangleCppStack(const(char)[] buf, char[] dst) | ||
{ | ||
import core.internal.cppdemangle : cppdemangle, copyResult; | ||
|
||
version (Shared) | ||
{ | ||
if (!config.enable) copyResult(buf, dst); | ||
return cppdemangle(buf, dst, !config.noprefix, prefix); | ||
} | ||
else | ||
{ | ||
return copyResult(buf, dst); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters