aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf_cu_to_module.h
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/dwarf_cu_to_module.h
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/dwarf_cu_to_module.h')
-rw-r--r--src/common/dwarf_cu_to_module.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/common/dwarf_cu_to_module.h b/src/common/dwarf_cu_to_module.h
index a36b82b0..c1135dd0 100644
--- a/src/common/dwarf_cu_to_module.h
+++ b/src/common/dwarf_cu_to_module.h
@@ -123,6 +123,22 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
scoped_ptr<FilePrivate> file_private_;
};
+ // An abstract base class for handlers that handle DWARF range lists for
+ // DwarfCUToModule.
+ class RangesHandler {
+ public:
+ RangesHandler() { }
+ virtual ~RangesHandler() { }
+
+ // Called when finishing a function to populate the function's ranges.
+ // The ranges' entries are read starting from offset in the .debug_ranges
+ // section, base_address holds the base PC the range list values are
+ // offsets off. Return false if the rangelist falls out of the
+ // .debug_ranges section.
+ virtual bool ReadRanges(uint64 offset, Module::Address base_address,
+ vector<Module::Range>* ranges) = 0;
+ };
+
// An abstract base class for handlers that handle DWARF line data
// for DwarfCUToModule. DwarfCUToModule could certainly just use
// dwarf2reader::LineInfo itself directly, but decoupling things
@@ -208,6 +224,14 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// FilePrivate did not retain the inter-CU specification data.
virtual void UnhandledInterCUReference(uint64 offset, uint64 target);
+ // The DW_AT_ranges at offset is malformed (truncated or outside of the
+ // .debug_ranges section's bound).
+ virtual void MalformedRangeList(uint64 offset);
+
+ // A DW_AT_ranges attribute was encountered but the no .debug_ranges
+ // section was found.
+ virtual void MissingRanges();
+
uint64 cu_offset() const {
return cu_offset_;
}
@@ -235,6 +259,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// data we find.
DwarfCUToModule(FileContext *file_context,
LineToModuleHandler *line_reader,
+ RangesHandler *ranges_handler,
WarningReporter *reporter);
~DwarfCUToModule();
@@ -296,6 +321,9 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// The handler to use to handle line number data.
LineToModuleHandler *line_reader_;
+ // The handler to use to handle range lists.
+ RangesHandler *ranges_handler_;
+
// This compilation unit's context.
scoped_ptr<CUContext> cu_context_;