This is an archive of the discontinued LLVM Phabricator instance.

Fix core files for 32 bit architectures that are supported in ProcessELFCore.cpp
ClosedPublic

Authored by clayborg on Mar 5 2019, 10:49 AM.

Details

Summary

Core files need to know the size of the PRSTATUS header so that we can grab the register values that follow it. The code that figure out this size was using a hard coded list of architecture cores instead of relying on 32 or 64 bit for most cores.

The fix here fixes core files for 32 bit ARM. Prior to this the PRSTATUS header size was being returned as zero and the register values were being taken from the first bytes of the PRSTATUS struct (signo, etc).

Diff Detail

Repository
rLLDB LLDB

Event Timeline

clayborg created this revision.Mar 5 2019, 10:49 AM
zturner added inline comments.
source/Plugins/Process/elf-core/ThreadElfCore.cpp
277

subtracting 40 from the header size seems a bit magical to those not in the know (such as myself). Could you do something like:

if (arch.GetAddressByteSize() == 8)
    return sizeof(ELFLinuxPrStatus);

lldbassert(arch.GetAddressByteSize() == 4);
constexpr int kWhatever = 10;
return sizeof(ELFLinuxPrStatus) - kWhatever * arch.GetAddressByteSize();
clayborg updated this revision to Diff 189374.Mar 5 2019, 11:25 AM

Fix zturner's suggestion.

clayborg marked an inline comment as done.Mar 5 2019, 11:25 AM
labath accepted this revision.Mar 6 2019, 3:21 AM
This revision is now accepted and ready to land.Mar 6 2019, 3:21 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2019, 10:04 AM