Page MenuHomePhabricator

Improve the handling of missing elf symtab and missing symbol sizes
ClosedPublic

Authored by tberghammer on Feb 8 2016, 10:18 AM.

Details

Summary

Improve the handling of missing elf symtab and missing symbol sizes

  • Generate artificial symbol names from eh_fame during symbol parsing so these symbols are already present when we calculate the size of the symbols where 0 is specified.
  • Fix symbol size calculation for the last symbol in the file where it have to last until the end of the parent section

Diff Detail

Event Timeline

tberghammer retitled this revision from to Improve the handling of missing elf symtab and missing symbol sizes.
tberghammer updated this object.
tberghammer added a reviewer: clayborg.
tberghammer added a subscriber: lldb-commits.
clayborg requested changes to this revision.Feb 8 2016, 11:42 AM
clayborg edited edge metadata.

Make sure we use a consistent naming scheme for symbols that don't have names between all ObjectFile subclasses.

source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
2939

Use the same naming convention as ObjectFileMachO for these unnamed symbols:

Before starting to parse these symbols:

uint32_t synthetic_function_symbol_idx = 0;

Then when you find en EH frame FDE that doesn't have a symbol, the name is calculated with:

snprintf (synthetic_function_symbol,
          sizeof(synthetic_function_symbol),
          "___lldb_unnamed_function%u$$%s",
          ++synthetic_function_symbol_idx,
          module_sp->GetFileSpec().GetFilename().GetCString());

We could move this into ObjectFile.cpp somehow and then have both ObjectFileELF and ObjectFileMachO use the same function to create the function name. If we do this, we should use a lldb_private::StreamString when making the name.

This revision now requires changes to proceed.Feb 8 2016, 11:42 AM
tberghammer updated this revision to Diff 47314.Feb 9 2016, 6:39 AM
tberghammer edited edge metadata.
tberghammer added inline comments.
source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
2939

I moved the symbol name generation logic into ObjectFile and also changed ObjectFileMachO to use that one

clayborg accepted this revision.Feb 9 2016, 12:56 PM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Feb 9 2016, 12:56 PM
This revision was automatically updated to reflect the committed changes.