aboutsummaryrefslogtreecommitdiff
path: root/src/common/stabs_to_module.cc
diff options
context:
space:
mode:
authorGabriele Svelto <gsvelto@mozilla.com>2018-08-04 00:59:34 +0200
committerTed Mielczarek <ted.mielczarek@gmail.com>2018-08-13 19:12:00 +0000
commit16e08520e6027df4bf1934abbfd5e1a088ffb69c (patch)
treee80f0e6a8b46b31a9dd56c12dddebb51e1895795 /src/common/stabs_to_module.cc
parentSet new ARM64 context flags (diff)
downloadbreakpad-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/stabs_to_module.cc')
-rw-r--r--src/common/stabs_to_module.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/common/stabs_to_module.cc b/src/common/stabs_to_module.cc
index 0a83cf21..049a6cc6 100644
--- a/src/common/stabs_to_module.cc
+++ b/src/common/stabs_to_module.cc
@@ -91,7 +91,8 @@ bool StabsToModule::StartFunction(const string &name,
uint64_t address) {
assert(!current_function_);
Module::Function *f = new Module::Function(Demangle(name), address);
- f->size = 0; // We compute this in StabsToModule::Finalize().
+ Module::Range r(address, 0); // We compute this in StabsToModule::Finalize().
+ f->ranges.push_back(r);
f->parameter_size = 0; // We don't provide this information.
current_function_ = f;
boundaries_.push_back(static_cast<Module::Address>(address));
@@ -167,14 +168,14 @@ void StabsToModule::Finalize() {
vector<Module::Address>::const_iterator boundary
= std::upper_bound(boundaries_.begin(), boundaries_.end(), f->address);
if (boundary != boundaries_.end())
- f->size = *boundary - f->address;
+ f->ranges[0].size = *boundary - f->address;
else
// If this is the last function in the module, and the STABS
// reader was unable to give us its ending address, then assign
// it a bogus, very large value. This will happen at most once
// per module: since we've added all functions' addresses to the
// boundary table, only one can be the last.
- f->size = kFallbackSize;
+ f->ranges[0].size = kFallbackSize;
// Compute sizes for each of the function f's lines --- if it has any.
if (!f->lines.empty()) {
@@ -185,7 +186,8 @@ void StabsToModule::Finalize() {
line_it != last_line; line_it++)
line_it[0].size = line_it[1].address - line_it[0].address;
// Compute the size of the last line from f's end address.
- last_line->size = (f->address + f->size) - last_line->address;
+ last_line->size =
+ (f->ranges[0].address + f->ranges[0].size) - last_line->address;
}
}
// Now that everything has a size, add our functions to the module, and