[Lldb-commits] [PATCH] D42955: Make Module::GetSectionList output consistent

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 2 15:21:11 PST 2018


clayborg added a comment.

In https://reviews.llvm.org/D42955#1026116, @labath wrote:

> I can try to split the patch up a bit if you think it will make things easier.  I'm not sure how much I will be able to do that, as the patch is not that big, it just needs to touch a bunch of files for the changed interfaces.
>
> In https://reviews.llvm.org/D42955#1026061, @clayborg wrote:
>
> > Looks fine, a bit hard to tell exactly what is going on so I will accept as long as the following things are still true:
> >
> > - each lldb_private::ObjectFile has its own section list that perfectly mirrors exactly what is in that object file and that file alone
>
>
> This part is not completely true. It is true for ObjectFileELF/COFF/JIT, and is enforced by the fact that the ObjectFile::GetSections does not even have access to the unified section list. However, it is *not* true for ObjectFileMachO (but that is not because of this patch). This is the problem I've had when trying to refactor this (and it's the reason the ObjectFileMachO<->SymbolVendorMacOSX interface is a bit weird). It seems that the ObjectFileMachO sometimes takes a section from the unified list and adds it to it's own list (or at least it appears to be doing that). I don't know enough about MachO to understand why is it doing that, or how to fix it. I've highlighted the places in the code where I think this is happening. Any suggestions would be welcome here.


The dSYM file is a mach-o file that contains symbols only, It is because the dSYM file (stand alone debug info file) has all of the section definitions from the main executable, but no section content for everything except the DWARF debug info. The DWARF only exists in the dSYM file. The dSYM file also has all of the symbols as it gets made before the executable is stripped. Many symbols refer to a section by section index, so that is why we must have the section definitions in the dSYM file. So the dSYM wants the sections from the main executable so it can access __text and __data if needed since symbol refer to these and someone might ask a symbol from a dSYM file what its instructions are. So the dSYM uses the real sections from the main executable file instead of its own.

> 
> 
>> - The lldb_private::Module hands out a unified section list that is populated by the symbol vendor where it uses one or more object files to create the unified section list
> 
> This part is true.




https://reviews.llvm.org/D42955





More information about the lldb-commits mailing list