mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-03-26 18:42:57 +00:00
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>
This commit is contained in:
committed by
Ted Mielczarek
parent
7b98edabb6
commit
16e08520e6
@@ -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_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user