diff options
author | David Srbecky <dsrbecky@google.com> | 2018-03-14 21:30:25 +0000 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2018-03-29 14:47:13 +0000 |
commit | 66ed93eb73b04e7e6a91671912d0845c36b781f0 (patch) | |
tree | 17ce0fa66b4a9a3fe77182033c432c626478ca09 /libunwindstack/include/unwindstack/DwarfLocation.h | |
parent | b0e6f150e7eeebcd18f75ac73f13ca6708ba77e3 (diff) | |
download | unwinding-66ed93eb73b04e7e6a91671912d0845c36b781f0.tar.gz |
Cache DWARF location rules for a given pc.
Decoding the DWARF opcodes is expensive so make sure we cache it.
This speeds unwinding in simpleperf by over a factor of 3x.
Add unit tests for this new behavior.
Bug: 77258731
Test: libbacktrace/libunwindstack unit tests on host and target.
Test: Ran debuggerd -b on various processes on target.
Change-Id: Ia516c0fa5d3e5f76746190bb4b6fdf49fd1c9388
Diffstat (limited to 'libunwindstack/include/unwindstack/DwarfLocation.h')
-rw-r--r-- | libunwindstack/include/unwindstack/DwarfLocation.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libunwindstack/include/unwindstack/DwarfLocation.h b/libunwindstack/include/unwindstack/DwarfLocation.h index 0881182..3d50ccf 100644 --- a/libunwindstack/include/unwindstack/DwarfLocation.h +++ b/libunwindstack/include/unwindstack/DwarfLocation.h @@ -23,6 +23,8 @@ namespace unwindstack { +struct DwarfCie; + enum DwarfLocationEnum : uint8_t { DWARF_LOCATION_INVALID = 0, DWARF_LOCATION_UNDEFINED, @@ -38,7 +40,13 @@ struct DwarfLocation { uint64_t values[2]; }; -typedef std::unordered_map<uint32_t, DwarfLocation> dwarf_loc_regs_t; +struct DwarfLocations : public std::unordered_map<uint32_t, DwarfLocation> { + const DwarfCie* cie; + // The range of PCs where the locations are valid (end is exclusive). + uint64_t pc_start = 0; + uint64_t pc_end = 0; +}; +typedef DwarfLocations dwarf_loc_regs_t; } // namespace unwindstack |