[Lldb-commits] [PATCH] D53436: [LLDB] - Implement the support for the .debug_loclists section.

George Rimar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 19 07:32:00 PDT 2018

grimar added a comment.

Since .debug_loclists contains locations descriptions for objects
that can change location during lifetime, I do not see a way to
write the test without relying on a compiler that has support for
DWARF5. We should compile and run executable to test that location
was calculated properly I believe. Other our tests for DWARF5 sections
recently implemented used YAML and never run any executables.
So, the test case is not included.

At the same time I was able to test it with the following code and invocation:
(trunk clang + https://reviews.llvm.org/D53365 applied):

  ~/LLVM/build/bin/clang -gdwarf-5 test.cc  -o test_v5-fuse-ld=lld -fno-rtti

  struct A { 
    int x = 0; 
    virtual void foo(); 
  void baz(struct A a) { 
  void A::foo() { int x = 0; ++x; }
  int main() {
    A objA;
    objA.x = 3;
    return 0;

After executing the following commands, the location of `a` is properly evaluated:

  (lldb) target create "test_v5"
  Current executable set to 'test_v5' (x86_64).
  (lldb) b baz
  Breakpoint 1: where = test_v5`baz(A) + 4 at test.cc:9:6, address = 0x00000000002010e4
  (lldb) run
  Process 115974 launched: '/home/umb/tests_2018/110_lldbloclists/test_v5' (x86_64)
  Process 115974 stopped
  * thread #1, name = 'test_v5', stop reason = breakpoint 1.1
      frame #0: 0x00000000002010e4 test_v5`baz(a=(x = 3)) at test.cc:9:6
     6    };
     8    void baz(struct A a) {
  -> 9       a.foo();
     10   }

Without this patch output will be:

  frame #0: 0x00000000002010e4 test_v5`baz(a=<unavailable>) at test.cc:9:6


More information about the lldb-commits mailing list