diff options
author | Gabriele Svelto <gsvelto@mozilla.com> | 2018-08-04 00:59:34 +0200 |
---|---|---|
committer | Ted Mielczarek <ted.mielczarek@gmail.com> | 2018-08-13 19:12:00 +0000 |
commit | 16e08520e6027df4bf1934abbfd5e1a088ffb69c (patch) | |
tree | e80f0e6a8b46b31a9dd56c12dddebb51e1895795 /src/common/module.cc | |
parent | Set new ARM64 context flags (diff) | |
download | breakpad-16e08520e6027df4bf1934abbfd5e1a088ffb69c.tar.xz |
Add support for parsing the DW_AT_ranges attributes
This enables the DWARF reader to properly parse DW_AT_ranges attributes
in compilation units and functions. Code covered by a function is now
represented by a vector of ranges instead of a single contiguous range
and DW_AT_ranges entries are used to populate it. All the code and tests
that assumed functions to be contiguous entities has been updated to
reflect the change. DW_AT_ranges attributes found in compilation units
are parsed but no data is generated for them as it is not currently needed.
BUG=754
Change-Id: I310391b525aaba0dd329f1e3187486f2e0c6d442
Reviewed-on: https://chromium-review.googlesource.com/1124721
Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
Diffstat (limited to 'src/common/module.cc')
-rw-r--r-- | src/common/module.cc | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/common/module.cc b/src/common/module.cc index 13c46475..11bfc444 100644 --- a/src/common/module.cc +++ b/src/common/module.cc @@ -258,24 +258,33 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) { for (FunctionSet::const_iterator func_it = functions_.begin(); func_it != functions_.end(); ++func_it) { Function *func = *func_it; - stream << "FUNC " << hex - << (func->address - load_address_) << " " - << func->size << " " - << func->parameter_size << " " - << func->name << dec << "\n"; - if (!stream.good()) - return ReportError(); + vector<Line>::iterator line_it = func->lines.begin(); + for (auto range_it = func->ranges.cbegin(); + range_it != func->ranges.cend(); ++range_it) { + stream << "FUNC " << hex + << (range_it->address - load_address_) << " " + << range_it->size << " " + << func->parameter_size << " " + << func->name << dec << "\n"; - for (vector<Line>::iterator line_it = func->lines.begin(); - line_it != func->lines.end(); ++line_it) { - stream << hex - << (line_it->address - load_address_) << " " - << line_it->size << " " - << dec - << line_it->number << " " - << line_it->file->source_id << "\n"; if (!stream.good()) return ReportError(); + + while ((line_it != func->lines.end()) && + (line_it->address >= range_it->address) && + (line_it->address < (range_it->address + range_it->size))) { + stream << hex + << (line_it->address - load_address_) << " " + << line_it->size << " " + << dec + << line_it->number << " " + << line_it->file->source_id << "\n"; + + if (!stream.good()) + return ReportError(); + + ++line_it; + } } } |