[Lldb-commits] [PATCH] D131705: Don't create sections for SHN_ABS symbols in ELF files.

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 11 11:16:46 PDT 2022


clayborg created this revision.
clayborg added reviewers: labath, JDevlieghere, jingham, yinghuitan.
Herald added a subscriber: emaste.
Herald added a project: All.
clayborg requested review of this revision.
Herald added subscribers: lldb-commits, MaskRay.
Herald added a project: LLDB.

Symbols that have the section index of SHN_ABS were previously creating extra top level sections that contained the value of the symbol as if the symbol's value was an address. As far as I can tell, these symbol's values are not addresses, even if they do have a size. To make matters worse, adding these extra sections can stop address lookups from succeeding if the symbol's value + size overlaps with an existing section as these sections get mapped into memory when the image is loaded by the dynamic loader. This can cause stack frames to appear empty as the address lookup fails completely.

This patch:

- doesn't create a section for any SHN_ABS symbols
- makes symbols that are absolute have values that are not addresses
- add accessors to SBSymbol to get the value and size of a symbol as raw integers. Prevoiusly there was no way to access a symbol's value from a SBSymbol because the only accessors were:

  SBAddress SBSymbol::GetStartAddress(); SBAddress SBSymbol::GetEndAddress();

  and these accessors would return an invalid SBAddress if the symbol's value wasn't an address
- Adds a test to ensure no ".absolute.<symbol-name>" sections are created
- Adds a test to test the new SBSymbol APIs


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131705

Files:
  lldb/bindings/interface/SBSymbol.i
  lldb/include/lldb/API/SBSymbol.h
  lldb/include/lldb/Symbol/Symbol.h
  lldb/source/API/SBSymbol.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/test/API/python_api/absolute_symbol/TestAbsoluteSymbol.py
  lldb/test/API/python_api/absolute_symbol/absolute.yaml
  lldb/test/Shell/SymbolFile/absolute-symbol.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131705.451925.patch
Type: text/x-patch
Size: 13176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220811/513c8df8/attachment-0001.bin>


More information about the lldb-commits mailing list