Make INLINE_ORIGIN positions not important in symbol file

This allows INLINE_ORIGIN records appears in after FUNC records.

Change-Id: I69b8b5948ed91453e15c7f4c3888dfbe38e7bc5c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3132381
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Zequan Wu 2021-08-31 10:50:11 -07:00 committed by Joshua Peraza
parent 5645ad8275
commit e87bb1b3b4
2 changed files with 14 additions and 19 deletions

View file

@ -246,12 +246,15 @@ int BasicSourceLineResolver::Module::ConstructInlineFrames(
MemAddr inline_base; MemAddr inline_base;
if (!inlines.RetrieveRange(address, &in, &inline_base, nullptr, nullptr)) if (!inlines.RetrieveRange(address, &in, &inline_base, nullptr, nullptr))
return -1; return -1;
auto origin = inline_origins_.find(in->origin_id);
if (origin == inline_origins_.end())
return -1;
StackFrame new_frame = StackFrame(*frame); StackFrame new_frame = StackFrame(*frame);
new_frame.function_name = in->name; new_frame.function_name = origin->second->name;
// Use the starting adress of the inlined range as inlined function base. // Use the starting adress of the inlined range as inlined function base.
new_frame.function_base = new_frame.module->base_address() + inline_base; new_frame.function_base = new_frame.module->base_address() + inline_base;
auto it = files_.find(in->source_file_id); auto it = files_.find(origin->second->source_file_id);
if (it != files_.end()) if (it != files_.end())
new_frame.source_file_name = it->second; new_frame.source_file_name = it->second;
@ -417,8 +420,8 @@ bool BasicSourceLineResolver::Module::ParseInlineOrigin(
char* origin_name; char* origin_name;
if (SymbolParseHelper::ParseInlineOrigin(inline_origin_line, &origin_id, if (SymbolParseHelper::ParseInlineOrigin(inline_origin_line, &origin_id,
&source_file_id, &origin_name)) { &source_file_id, &origin_name)) {
inline_origins_.insert(make_pair( inline_origins_.insert(
origin_id, new InlineOrigin(origin_id, source_file_id, origin_name))); make_pair(origin_id, new InlineOrigin(source_file_id, origin_name)));
return true; return true;
} }
return false; return false;
@ -432,12 +435,8 @@ BasicSourceLineResolver::Module::ParseInline(char* inline_line) {
vector<std::pair<MemAddr, MemAddr>> ranges; vector<std::pair<MemAddr, MemAddr>> ranges;
if (SymbolParseHelper::ParseInline(inline_line, &inline_nest_level, if (SymbolParseHelper::ParseInline(inline_line, &inline_nest_level,
&call_site_line, &origin_id, &ranges)) { &call_site_line, &origin_id, &ranges)) {
auto origin = inline_origins_.find(origin_id);
if (origin != inline_origins_.end()) {
return linked_ptr<Inline>( return linked_ptr<Inline>(
new Inline(inline_nest_level, call_site_line, origin->second->name, new Inline(inline_nest_level, call_site_line, origin_id, ranges));
origin->second->source_file_id, ranges));
}
} }
return linked_ptr<Inline>(); return linked_ptr<Inline>();
} }

View file

@ -70,10 +70,9 @@ class SourceLineResolverBase::AutoFileCloser {
}; };
struct SourceLineResolverBase::InlineOrigin { struct SourceLineResolverBase::InlineOrigin {
InlineOrigin(int32_t origin_id, int32_t source_file_id, const string& name) InlineOrigin(int32_t source_file_id, const string& name)
: origin_id(origin_id), source_file_id(source_file_id), name(name) {} : source_file_id(source_file_id), name(name) {}
int32_t origin_id;
int32_t source_file_id; int32_t source_file_id;
string name; string name;
}; };
@ -83,19 +82,16 @@ struct SourceLineResolverBase::Inline {
using InlineRanges = std::vector<std::pair<MemAddr, MemAddr>>; using InlineRanges = std::vector<std::pair<MemAddr, MemAddr>>;
Inline(int32_t inline_nest_level, Inline(int32_t inline_nest_level,
int32_t call_site_line, int32_t call_site_line,
const string& name, int32_t origin_id,
int32_t source_file_id,
InlineRanges inline_ranges) InlineRanges inline_ranges)
: inline_nest_level(inline_nest_level), : inline_nest_level(inline_nest_level),
call_site_line(call_site_line), call_site_line(call_site_line),
name(name), origin_id(origin_id),
source_file_id(source_file_id),
inline_ranges(inline_ranges) {} inline_ranges(inline_ranges) {}
int32_t inline_nest_level; int32_t inline_nest_level;
int32_t call_site_line; int32_t call_site_line;
string name; int32_t origin_id;
int32_t source_file_id;
InlineRanges inline_ranges; InlineRanges inline_ranges;
RangeMap<MemAddr, linked_ptr<Inline>> child_inlines; RangeMap<MemAddr, linked_ptr<Inline>> child_inlines;
}; };