[Lldb-commits] [PATCH] D51935: [LLDB] - Improve reporting source lines and variables (improved DWARF5 support).

George Rimar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 11 09:02:59 PDT 2018


grimar created this revision.
grimar added a reviewer: LLDB.
Herald added subscribers: JDevlieghere, arichardson, aprantl, emaste.
Herald added a reviewer: espindola.
grimar edited the summary of this revision.

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 at 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.


https://reviews.llvm.org/D51935

Files:
  include/lldb/lldb-enumerations.h
  source/Core/Section.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/ObjectFile.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51935.164900.patch
Type: text/x-patch
Size: 29970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180911/7aa5eea4/attachment-0001.bin>


More information about the lldb-commits mailing list