This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][Breakpad] Make lldb understand INLINE and INLINE_ORIGIN records in breakpad.
ClosedPublic

Authored by zequanwu on Nov 5 2021, 8:53 PM.

Details

Summary

Teach LLDB to understand INLINE and INLINE_ORIGIN records in breakpad.
They have the following formats:

INLINE inline_nest_level call_site_line call_site_file_num origin_num [address size]+
INLINE_ORIGIN origin_num name

INLNIE_ORIGIN is simply a string pool for INLINE so that we won't have
duplicated names for inlined functions and can show up anywhere in the symbol
file.
INLINE follows immediately after FUNC represents the ranges of momery
address that has functions inlined inside the function.

Diff Detail

Event Timeline

zequanwu requested review of this revision.Nov 5 2021, 8:53 PM
zequanwu created this revision.
Herald added a project: Restricted Project. · View Herald Transcript
shafik added a subscriber: shafik.Nov 5 2021, 10:37 PM
shafik added inline comments.
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
318

/*mangled=*/nullptr, /*decl_ptr=*/nullptr

see clang-tidy check bugprone-argument-comment

zequanwu updated this revision to Diff 385657.Nov 8 2021, 4:35 PM
zequanwu marked an inline comment as done.

add argument comments.

labath added a comment.Nov 9 2021, 5:18 AM

Looks pretty good. I might have split the record parsing functions into a separate patch, but this is not bad either.

Just one comment about error handling.

lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
315–316

In lldb, we treat (or at least try to) debug info as "user input", meaning invalid/inconsistent debug info should not crash the debugger. While the situation is not as critical for breakpad as it is for dwarf (due to it not having as many producers), I think the principle remains.

It doesn't really matter much how you handle invalid records (like, it'd be fine if you just throw away all inline info for the affected function), but it'd be nice if it does not crash lldb.

zequanwu updated this revision to Diff 385903.Nov 9 2021, 11:06 AM
zequanwu marked an inline comment as done.

Use empty callsite_file or name if index is out of range.

labath accepted this revision.Nov 10 2021, 1:48 AM

Use empty callsite_file or name if index is out of range.

It'd be nice if you could also extend the test case to cover this scenario.

This revision is now accepted and ready to land.Nov 10 2021, 1:48 AM
zequanwu updated this revision to Diff 386256.Nov 10 2021, 11:20 AM

Rebased and add test cases for out of range file/origin index.

This revision was landed with ongoing or failed builds.Nov 10 2021, 11:20 AM
This revision was automatically updated to reflect the committed changes.