This is an archive of the discontinued LLVM Phabricator instance.

[lldb/crashlog] Remove tempfile prefix from inlined symbol object file
ClosedPublic

Authored by mib on May 21 2023, 12:59 AM.

Details

Summary

This patch changes the way we generate the ObjectFileJSON files
containing the inlined symbols from the crash report to remove the
tempfile prefix from the object file name.

To do so, instead of creating a new tempfile for each module, we create a
temporary directory that contains each module object file with the same
name as the module.

This makes the backtraces only contain the module name without the
temfile prefix which makes it look like a regular stackframe.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>

Diff Detail

Event Timeline

mib created this revision.May 21 2023, 12:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2023, 12:59 AM
mib requested review of this revision.May 21 2023, 12:59 AM
JDevlieghere added inline comments.May 22 2023, 8:28 AM
lldb/examples/python/crashlog.py
1162–1165

Can you call obj_dir.cleanup(), or better, can you wrap this in a with tempfile.TemporaryDirectory() as obj_dir:?

lldb/examples/python/scripted_process/crashlog_scripted_process.py
41

Same comment/question here.

lldb/examples/python/symbolication.py
371

If the obj_dir is created this way, it will never be removed. Is anyone relying on the default argument? If not I would make it None and change the check on line 387 to if obj_dir:.

bulbazord added inline comments.
lldb/examples/python/crashlog.py
1162–1165

+1

lldb/examples/python/symbolication.py
371

+1 on this, we need to cleanup resources.

mib marked 5 inline comments as done.May 22 2023, 2:47 PM
mib updated this revision to Diff 524502.May 22 2023, 3:02 PM
mib added a reviewer: bulbazord.

Address @JDevlieghere & @bulbazord comments.

mib updated this revision to Diff 524521.May 22 2023, 3:54 PM

More refactoring

This revision is now accepted and ready to land.May 22 2023, 3:56 PM