This patch improves the support of DWARF5 by lldb.
Imagine we have the following code,
(compiled with clang++ test.cpp -g -o test -gdwarf-5):
struct XXX { int A; }; int main() { XXX Obj; Obj.A = 1; return Obj.A; }
Without this patch when lldb stops on a breakpoint or dump variables
the output is:
(lldb) b main warning: (x86_64) /home/umb/tests_2018/95_lldb/repro/dwarf5_nosplit/test unsupported DW_FORM value: 0x25 Breakpoint 1: where = test`main, address = 0x0000000000400550 (lldb) run Process 5589 launched: '/home/umb/tests_2018/95_lldb/repro/dwarf5_nosplit/test' (x86_64) Process 5589 stopped * thread #1, name = 'test', stop reason = breakpoint 1.1 frame #0: 0x0000000000400550 test`main test`main: -> 0x400550 <+0>: pushq %rbp 0x400551 <+1>: movq %rsp, %rbp 0x400554 <+4>: movl $0x0, -0x4(%rbp) 0x40055b <+11>: movl $0x1, -0x8(%rbp) (lldb) script Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D. >>> print lldb.frame.GetVariables(True, True, True, True) <empty> lldb.SBValueList()
Note that it complains about unknown forms,
there is no code source lines and output from the print
call is empty.
With the patch applied output becomes:
umb@umb-virtual-machine:~/LLVM/build_lldb/bin$ ./lldb ~/tests_2018/95_lldb/repro/dwarf5_nosplit/test (lldb) target create "/home/umb/tests_2018/95_lldb/repro/dwarf5_nosplit/test" Current executable set to '/home/umb/tests_2018/95_lldb/repro/dwarf5_nosplit/test' (x86_64). (lldb) b main Breakpoint 1: where = test`main + 11 at test.cpp:7, address = 0x000000000040055b (lldb) run Process 63624 launched: '/home/umb/tests_2018/95_lldb/repro/dwarf5_nosplit/test' (x86_64) Process 63624 stopped * thread #1, name = 'test', stop reason = breakpoint 1.1 frame #0: 0x000000000040055b test`main at test.cpp:7 4 5 int main() { 6 XXX Obj; -> 7 Obj.A = 1; 8 9 return Obj.A; 10 } (lldb) script Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D. >>> print lldb.frame.GetVariables(True, True, True, True) (XXX) Obj = (A = 0)
Note there is no test case yet, I am going to add it to this revision soon.
This is my first patch for lldb and I did not yet learn how to write the
test for the code written.
I would be happy to see any comments/suggestions.