Hi (apologies if this is not the right place to ask)<div><br></div><div>Is there any plan to support the D programming language in lldb?</div><div><br></div><div>gdb already supports it (but only on linux, not OSX), but it would be nice to have support in lldb.</div>
<div>The D patch for gdb is actually pretty small, just a few minor edits scattered throughout.</div><div><br></div><div>Currently, if I compile a main.d file with dmd (dmd -g main.d), lldb will not see any variables with fr v.</div>
<div>It works better with ldc2 though: ldc2 -g main.d followed by lldb main does show variable with frv, however it (obviously) doesn't understand D name mangling. </div><div><br></div><div><div>(lldb) fr select 5</div>
<div>frame #5: 0x0000000100000d3f main`_Dmain + 79 at main.d:39</div><div> 36 <span class="Apple-tab-span" style="white-space:pre"> </span></div><div> 37 <span class="Apple-tab-span" style="white-space:pre"> </span>int main(string[]args){</div>
<div> 38 <span class="Apple-tab-span" style="white-space:pre"> </span>int x=<a href="http://std.conv.to">std.conv.to</a>!int(args[1]);</div><div>-> 39 <span class="Apple-tab-span" style="white-space:pre"> </span>return fun1(x);</div>
<div> 40 <span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><br></div><div><br></div><div><div>(lldb) fr v</div><div>(<anonymous struct>) args = {</div><div> length = 2</div><div> ptr = 0x0000000100200990</div>
<div>}</div><div>(int) x = 11</div></div></div><div><br></div><div><br></div><div><div>(lldb) bt</div><div>* thread #1: tid = 0x1f03, 0x0000000100000c11 main`cfun1 + 33 at main.d:15, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)</div>
<div> frame #0: 0x0000000100000c11 main`cfun1 + 33 at main.d:15</div><div> frame #1: 0x0000000100000c99 main`_D4main4fun4FiZi + 25 at main.d:27</div><div> frame #2: 0x0000000100000c70 main`_D4main4fun3FiZi + 16 at main.d:24</div>
<div> frame #3: 0x0000000100000c50 main`_D4main4fun2FiZi + 16 at main.d:21</div><div> frame #4: 0x0000000100000c30 main`_D4main4fun1FiZi + 16 at main.d:18</div><div> frame #5: 0x0000000100000d3f main`_Dmain + 79 at main.d:39</div>
<div> frame #6: 0x000000010004cf0f main`_D2rt6dmain24mainUiPPaZi7runMainMFZv + 31 at dmain2.d:530</div><div> frame #7: 0x000000010004ce9a main`_D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 42 at dmain2.d:505</div><div>
frame #8: 0x000000010004cf64 main`_D2rt6dmain24mainUiPPaZi6runAllMFZv + 68 at dmain2.d:540</div><div> frame #9: 0x000000010004ce9a main`_D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 42 at dmain2.d:505</div><div> frame #10: 0x000000010004ce06 main`main + 406 at .:550</div>
<div> frame #11: 0x0000000100000b94 main`start + 52</div></div><div><br></div><div><br></div><div><br></div><div>What needs to be changed to allow for the following (in order of priority):</div><div>1) detect language (command-line option? from mangled name signature?)</div>
<div>2) display correctly demangled D symbols (we can use dmd's std.core.demangle as a library function)</div><div>3) write expressions in unmangled form, eg: </div><div> expr (void)_D4main4dispFiZi(100) //currently works</div>
<div><div> expr (int) main.disp(100) // desired (or even expr disp(100))</div></div><div><div><br></div></div><div>3) D-aware command completion</div><div>4) support for printing basic D types: arrays, associative arrays, structs etc.</div>
<div><br></div><div>The mangling seems to be in lldb/llvm/tools/clang/include/clang/AST/Mangle.h but that's not very helpful...</div><div><br></div>