[Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 25 17:06:30 PDT 2019


clayborg added a comment.

In D63540#1556989 <https://reviews.llvm.org/D63540#1556989>, @labath wrote:

> In D63540#1550858 <https://reviews.llvm.org/D63540#1550858>, @clayborg wrote:
>
> > So I am fine with symbols having zero size being in the symbol table. I would be fine not changing anything in the sorting and leaving some symbols with zero size, we just need to fix:
> >
> >   Symbol *Symtab::FindSymbolAtFileAddress(addr_t file_addr);
> >
> >
> > To ignore zero sized symbols when it finds them _if_ there is another symbol that has a size for that address. Wouldn't that fix the issue here?
>
>
> You are assuming here that the symbols have size zero at the time we are performing the lookup. If I understand correctly what is going on, the problem here is that the code munging the symbol table (InitAddressIndexes), will set these symbols to have non-zero size. This is what this patch is trying to avoid.


I am saying to leave symbols with zero size as is _if_ there is another symbol that does have a valid size with the same start address.

> The reason we are fiddling with the size of the symbols is because there are valid instances of symbols not having a size (usually coming from hand-written assembly, where one just doesn't bother to add the .size directive). However, it certainly seems like we shouldn't be doing that if there is another symbol at the same address, and this symbol has the size set correctly...

Exactly. The best solution in my mind is:

- leave all symbols with sizes as is
- only set a symbol size if there is no other symbol at that address that didn't originally have a size
- maybe leave zero sizes symbols out of the lookup map if they have no sizes after doing the two steps above




Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D63540





More information about the lldb-commits mailing list