This is an archive of the discontinued LLVM Phabricator instance.

Allow bytes-only mach-o corefile to load into lldb
ClosedPublic

Authored by jasonmolenda on Jan 26 2023, 1:11 PM.

Details

Summary

ProcessMachCore::DoLoadCore has an error check that if it found no thread contexts (LC_THREADs), it is an improperly formed corefile and will be rejected. We have a group that is creating memory-only corefiles, and will provide threads from an operating system or scripted process python plugin that they write. This removes the error handling from DoLoadCore -- I can't remember this catching problems with corrupt corefiles in real world use.

I haven't cooked up a test for it at this point; it would be possible to run a user process, process save-core it, write a utility program that rewrites the corefiles to remove the LC_THREAD load commands, loads it into lldb, and confirms that memory can still be examined. But given the simplicity of the change, I don't feel super motivated to write all that. I'm open to it though, if other people feel it would be a good addition to our test coverage.

Diff Detail

Event Timeline

jasonmolenda created this revision.Jan 26 2023, 1:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 1:11 PM
jasonmolenda requested review of this revision.Jan 26 2023, 1:11 PM
mib accepted this revision.Jan 26 2023, 1:21 PM

LGTM!

This revision is now accepted and ready to land.Jan 26 2023, 1:21 PM
JDevlieghere accepted this revision.Jan 26 2023, 8:57 PM
This revision was automatically updated to reflect the committed changes.