moved from: https://github.com/llvm-mirror/lldb/pull/3
addresses issue https://issues.dlang.org/show_bug.cgi?id=817 OSX
symbols mangled on gdb,ggdb,cgdb,lldb but not on ubuntu; no line numbers on stacktraces
also, a follow-up to https://reviews.llvm.org/D24794 (Use Clang for D language support until there is a proper language plugin for it.)
related discussion prior to this: http://lists.llvm.org/pipermail/lldb-dev/2016-September/011351.html [lldb-dev] Adding D language demangling support
to try it out, you need lldbdplugin
the shared library that is dlopen'd is defined separately in https://github.com/timotheecour/dtools/blob/master/dtools/lldbdplugin.d (but could be any other implementation with same entry point API)
add this to .lldbinit:
settings set plugin.language.D.pluginfile "path_to/liblldbdplugin.dylib"
before:
(lldb) bt error: need to add support for DW_TAG_base_type 'immutable(char)' encoded with DW_ATE = 0x10, bit_size = 8 error: need to add support for DW_TAG_base_type 'char' encoded with DW_ATE = 0x10, bit_size = 8 * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 * frame #0: 0x0000000100000cd0 test TIMBREAK at foo/test2.d:3 frame #1: 0x0000000100000e60 test _D4test3funFiZv(a=11) + 128 at test.d:11 frame #2: 0x0000000100000ec7 test _D4test__T4fun1TiZQiFiZv(a=11) + 23 at test.d:16 frame #3: 0x0000000100000e8c test _Dmain(args=string[] @ 0x00007ffeefbfcec8) + 28 at test.d:20 frame #4: 0x000000010014d80f test _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 15 frame #5: 0x000000010014d74e test _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 14 frame #6: 0x000000010014d652 test _d_run_main + 466 frame #7: 0x00000001000019b5 test main(argc=1, argv=0x00007ffeefbfd028) + 37 at __entrypoint.d:8 frame #8: 0x00007fff7279f115 libdyld.dylib start + 1 frame #9: 0x00007fff7279f115 libdyld.dylib start + 1 (lldb)
after:
(lldb) bt error: need to add support for DW_TAG_base_type 'immutable(char)' encoded with DW_ATE = 0x10, bit_size = 8 error: need to add support for DW_TAG_base_type 'char' encoded with DW_ATE = 0x10, bit_size = 8 * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 * frame #0: 0x0000000100000cd0 test TIMBREAK at foo/test2.d:3 frame #1: 0x0000000100000e60 test void test.fun(a=11) + 128 at test.d:11 frame #2: 0x0000000100000ec7 test void test.fun1!(a=11).fun1(int) + 23 at test.d:16 frame #3: 0x0000000100000e8c test _Dmain(args=string[] @ 0x00007ffeefbfce68) + 28 at test.d:20 frame #4: 0x000000010014d80f test void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll().__lambda1() + 15 frame #5: 0x000000010014d74e test void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 14 frame #6: 0x000000010014d652 test _d_run_main + 466 frame #7: 0x00000001000019b5 test main(argc=1, argv=0x00007ffeefbfcfc8) + 37 at __entrypoint.d:8 frame #8: 0x00007fff7279f115 libdyld.dylib start + 1 frame #9: 0x00007fff7279f115 libdyld.dylib start + 1
- limitations:
- breakpoint on fully qualified names work, eg: b test.fun but not on templates, eg: b test.fun1
- note
- building lldb from source (even without this patch), bt FOO can be up to 5X slower than when using lldb (version <=5.0.1), which I reported in http://lists.llvm.org/pipermail/lldb-dev/2018-March/013416.html ; this is not related to this PR.
- why is LLDB tag marked as archived?
- I couldn't find lldb as an option in Repository
fix header line