This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] Keep the memory buffer from the dSYM alive when using -g -dsym
ClosedPublic

Authored by thegameg on Aug 28 2018, 10:02 AM.

Details

Summary

When using -g and -dsym, llvm-objdump opens the dSYM file and keeps the MachOObjectFile alive, while the memory buffer that the MachOObjectFile was based on gets destroyed.

This segfaults with a pretty large file. I am open to suggestions on how to test this even if it doesn't really segfault, since it seems that there are no -g nor -dsym tests for llvm-objdump.

Diff Detail

Repository
rL LLVM

Event Timeline

thegameg created this revision.Aug 28 2018, 10:02 AM
JDevlieghere accepted this revision.EditedAug 29 2018, 1:55 AM

LGTM. Thanks for fixing this!

Would we catch this with a small file (we already have binaries checked-in for dsymutil) and the sanitizers enabled?

This revision is now accepted and ready to land.Aug 29 2018, 1:55 AM
thegameg updated this revision to Diff 163381.Aug 30 2018, 11:22 AM

Added a test. Let me know if that's what you had in mind.

Looks good!

test/tools/llvm-objdump/X86/macho-disassembly-g-dsym.test
1 ↗(On Diff #163381)

nit: I'd probably name this %t.dSYM, makes it a little easier to figure out the path if the test ever fails.

This revision was automatically updated to reflect the committed changes.