Revert "Fix incorrect source file name for inlined frames"

This reverts commit 54d878abcb.

54d878abcb changed the dump_syms format incompatibly. This must be
redone in a multi-step process: the processor must be made to understand
the old and new formats simultaneously and the processor service must be
rebuilt and run with that update before dump_syms output can change to
use the new format.

Bug: chromium:1263390
Change-Id: I5b6f8aff8ea2916b2c07ac6a74b569fa27db51b9
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3244775
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Mark Mentovai
2021-10-26 09:31:09 -04:00
parent 076073c96b
commit dfcb7b6799
18 changed files with 214 additions and 223 deletions

View File

@@ -254,6 +254,9 @@ struct DwarfCUToModule::CUContext {
// A map of function pointers to the its forward specification DIE's offset.
map<Module::Function*, uint64_t> spec_function_offsets;
// From file index to vector of subprogram's offset in this CU.
map<uint64_t, vector<uint64_t>> inline_origins;
};
// Information about the context of a particular DIE. This is for
@@ -558,8 +561,7 @@ class DwarfCUToModule::InlineHandler : public GenericDIEHandler {
DwarfForm high_pc_form_; // DW_AT_high_pc can be length or address.
DwarfForm ranges_form_; // DW_FORM_sec_offset or DW_FORM_rnglistx
uint64_t ranges_data_; // DW_AT_ranges
int call_site_line_; // DW_AT_call_line
int call_site_file_id_; // DW_AT_call_file
int call_site_line_;
int inline_nest_level_;
// A vector of inlines in the same nest level. It's owned by its parent
// function/inline. At Finish(), add this inline into the vector.
@@ -587,9 +589,6 @@ void DwarfCUToModule::InlineHandler::ProcessAttributeUnsigned(
case DW_AT_call_line:
call_site_line_ = data;
break;
case DW_AT_call_file:
call_site_file_id_ = data;
break;
default:
GenericDIEHandler::ProcessAttributeUnsigned(attr, form, data);
break;
@@ -662,8 +661,8 @@ void DwarfCUToModule::InlineHandler::Finish() {
cu_context_->file_context->module_->inline_origin_map
.GetOrCreateInlineOrigin(specification_offset_, name_);
unique_ptr<Module::Inline> in(
new Module::Inline(origin, ranges, call_site_line_, call_site_file_id_,
inline_nest_level_, std::move(child_inlines_)));
new Module::Inline(origin, ranges, call_site_line_, inline_nest_level_,
std::move(child_inlines_)));
inlines_.push_back(std::move(in));
}
@@ -680,6 +679,7 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
high_pc_form_(DW_FORM_addr),
ranges_form_(DW_FORM_sec_offset),
ranges_data_(0),
decl_file_data_(UINT64_MAX),
inline_(false),
handle_inline_(handle_inline) {}
@@ -700,7 +700,9 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
uint64_t low_pc_, high_pc_; // DW_AT_low_pc, DW_AT_high_pc
DwarfForm high_pc_form_; // DW_AT_high_pc can be length or address.
DwarfForm ranges_form_; // DW_FORM_sec_offset or DW_FORM_rnglistx
uint64_t ranges_data_; // DW_AT_ranges
uint64_t ranges_data_; // DW_AT_ranges
// DW_AT_decl_file, value of UINT64_MAX means undefined.
uint64_t decl_file_data_;
bool inline_;
vector<unique_ptr<Module::Inline>> child_inlines_;
bool handle_inline_;
@@ -725,6 +727,9 @@ void DwarfCUToModule::FuncHandler::ProcessAttributeUnsigned(
ranges_data_ = data;
ranges_form_ = form;
break;
case DW_AT_decl_file:
decl_file_data_ = data;
break;
default:
GenericDIEHandler::ProcessAttributeUnsigned(attr, form, data);
break;
@@ -852,7 +857,8 @@ void DwarfCUToModule::FuncHandler::Finish() {
// Only keep track of DW_TAG_subprogram which have the attributes we are
// interested.
if (handle_inline_ && (!empty_range || inline_)) {
if (handle_inline_ &&
(!empty_range || inline_ || decl_file_data_ != UINT64_MAX)) {
StringView name = name_.empty() ? name_omitted : name_;
uint64_t offset =
specification_offset_ != 0 ? specification_offset_ : offset_;
@@ -860,6 +866,8 @@ void DwarfCUToModule::FuncHandler::Finish() {
offset);
cu_context_->file_context->module_->inline_origin_map
.GetOrCreateInlineOrigin(offset_, name);
if (decl_file_data_ != UINT64_MAX)
cu_context_->inline_origins[decl_file_data_].push_back(offset_);
}
}
@@ -1442,12 +1450,10 @@ void DwarfCUToModule::AssignLinesToFunctions() {
}
void DwarfCUToModule::AssignFilesToInlines() {
// Assign File* to Inlines inside this CU.
auto assignFile = [this](unique_ptr<Module::Inline>& in) {
in->call_site_file = files_[in->call_site_file_id];
};
for (auto func : cu_context_->functions) {
Module::Inline::InlineDFS(func->inlines, assignFile);
for (auto iter : files_) {
cu_context_->file_context->module_->inline_origin_map
.AssignFilesToInlineOrigins(cu_context_->inline_origins[iter.first],
iter.second);
}
}