clayborg added a comment.

In D67390#1671463 <https://reviews.llvm.org/D67390#1671463>, @kwk wrote:

> @clayborg what address is it exactly to store here `std::map<lldb::addr_t, 
> ContString> SymbolMapType;`? As an example 
> `dc_symbol.GetAddress().GetFileAddress()` is something that would work but as 
> soon as we have minidebuginfo, then we might end having the same symbol 
> coming from two different object files and so their address would still be 
> different. Also do you want me to keep this map in `ObjectFileELF`?


The file address should be sufficient for normal ELF files. When we have a 
minidebuginfo, we should almost to loading this as part of the ObjectFileELF 
that points to the minidebuginfo and parsing it as if it were part of that 
file. SymbolVendor used to exist to allow one view of an executable using 
multiple individual ObjectFile objects, but that got removed. So now it might 
be best to load the minidebuginfo file as an ObjectFileELF _just_ to access the 
data in the ".gnu_debugdata" and decompress it, and use that data to add to the 
symbol table of the current file? So the code would be:

  ObjectFileELF::GetSymtab() {
    std::map<lldb::addr_t, ConstString SymbolMapType;
    SymbolMapType symbol_map;
    ParseSymbolTablePrivate(..., symbol_map); // .symtab from current file
    ParseSymbolTablePrivate(..., symbol_map); // .dynsym from current file
    // Detect ".gnu_debugdata" file and load it
    FileSpec gnu_debugdata_file(...);
    if (gnu_debugdata_file.Exists()) {
      ObjectfileELF gnu_debugdata(gnu_debugdata_file);
      gnu_debugdata_symtab_data = gnu_debugdata.GetSectionData();
      // Decompress above data and parse the symbol table as if it is part of 
this file?
     ParseSymbolTablePrivate(...); // .gnu_debugdata symtab
    }

This assumes that the .gnu_debugdata file has the same section definitions for 
things like .text and .data etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67390



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to