[Lldb-commits] [PATCH] D63540: Fix lookup of symbols with the same address range but different binding

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 26 13:47:46 PST 2019


jankratochvil added a comment.

The difference (with the previous size-non-setting patch) is:

  -lldb             <  14> send packet: $Z0,102f0,2#
  +lldb             <  14> send packet: $Z0,102f0,4#

That is because `GetAddressClass` fails to recognized `0x102f0` as a code address:

  PASS:
  (lldb) p (void)sync()
  GetAddressClass:0x102f1
  GetAddressClass:0x102f1=(null) ValueIsAddress=1 section_type=1
  GetAddressClass:0x96040
  GetAddressClass:0x96040=__mmap ValueIsAddress=1 section_type=1
  GetAddressClass:0x102f1
  GetAddressClass:0x102f1=(null) ValueIsAddress=1 section_type=1
  GetAddressClass:0x102f0
  GetAddressClass:0x102f0=(null) ValueIsAddress=1 section_type=1
  ...
  
  FAIL:
  (lldb) p (void)sync()
  GetAddressClass:0x102f1
  GetAddressClass:0x102f1=_start ValueIsAddress=1 section_type=1
  GetAddressClass:0x96040
  GetAddressClass:0x96040=__mmap ValueIsAddress=1 section_type=1
  GetAddressClass:0x102f1
  GetAddressClass:0x102f1=_start ValueIsAddress=1 section_type=1
  GetAddressClass:0x102f0
  ...

That is due to:

  symtab.fail:[   11]     12     Invalid         0x00000000000102f0                    0x0000000000000000 0x00000003 
  symtab.fail:[   66]     99   X Code            0x00000000000102f0                    0x0000000000000030 0x00000012 _start
  symtab.pass:[   11]     12     Invalid         0x00000000000102f0                    0x0000000000000030 0x00000003 
  symtab.pass:[   66]     99   X Code            0x00000000000102f0                    0x0000000000000030 0x00000012 _start

The difference is in the 'Invalid' symbol which is:

  Num:    Value  Size Type    Bind   Vis      Ndx Name
   12: 000102f0     0 SECTION LOCAL  DEFAULT   12 

Apparently ARM32 relies on that section symbol to have proper size. I do not see how `Symtab::InitAddressIndexes` could handle `STT_SECTION` in a special way as that is ELF-type specific `Symbol` characteristics:

  uint32_t m_flags; // A copy of the flags from the original symbol table, the
                    // ObjectFile plug-in can interpret these

I did not debug it more as I think LLDB should have the symbol binding type preference anyway and then this problem disappears and we can keep status quo of this symbols size issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63540/new/

https://reviews.llvm.org/D63540





More information about the lldb-commits mailing list