Page MenuHomePhabricator

Add/fix support for i386 elf core files
ClosedPublic

Authored by dvlahovski on Jul 28 2016, 8:17 AM.

Details

Summary

There were places in the code, assuming(hardcoding) offsets
and types that were only valid for the x86_64 elf core file format.

The NT_PRSTATUS and NT_PRPSINFO structures are with the 64 bit layout.
I have reused them and parse i386 files manually, and fill them in the
same struct.

Also added some error handling during parsing that checks if the
available bytes in the buffer are enough to fill the structures.

The i386 core file test case now passes.

For reference on the structures layout, I generally used the
source of binutils (bfd, readelf)

Bug: https://llvm.org/bugs/show_bug.cgi?id=26947

Diff Detail

Repository
rL LLVM

Event Timeline

dvlahovski updated this revision to Diff 65937.Jul 28 2016, 8:17 AM
dvlahovski retitled this revision from to Add/fix support for i386 elf core files.
dvlahovski updated this object.
dvlahovski added a reviewer: labath.
dvlahovski added a subscriber: lldb-commits.
labath edited edge metadata.Jul 28 2016, 8:58 AM

Looks great, thanks.

Please just fix the null pointer issue and we are good to go.

source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
1506 ↗(On Diff #65937)

Originally, this was crashing the debugger because GetCStr returned a null pointer. That can still happen in case of a corrupt core file. While we're touching this code, we should fix that as well.

dvlahovski edited edge metadata.

Checking for null pointer, in case of a corrupt core file

labath accepted this revision.Jul 29 2016, 4:11 AM
labath edited edge metadata.

thanks

This revision is now accepted and ready to land.Jul 29 2016, 4:11 AM
This revision was automatically updated to reflect the committed changes.