diff options
author | Craig Silverstein <csilvers@google.com> | 2008-05-01 00:25:33 +0000 |
---|---|---|
committer | Craig Silverstein <csilvers@google.com> | 2008-05-01 00:25:33 +0000 |
commit | e4e5049b7bb41c36b6696a59f59eaafee95aedb1 (patch) | |
tree | 461b3fb5fa13581bb234dbd13c08d19160b35c9c /gold/dwarf_reader.h | |
parent | f089c43345c097a7f604adcb0dcbef301d57ef93 (diff) | |
download | gdb-e4e5049b7bb41c36b6696a59f59eaafee95aedb1.zip gdb-e4e5049b7bb41c36b6696a59f59eaafee95aedb1.tar.gz gdb-e4e5049b7bb41c36b6696a59f59eaafee95aedb1.tar.bz2 |
* dwarf_reader.cc (next_generation_count): New static var.
(Addr2line_cache_entry): New struct.
(addr2line_cache): New static var.
(Dwarf_line_info::one_addr2line): Added caching.
(Dwarf_line_info::clear_addr2line_cache): New function.
* dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
cache-size parameter.
(Dwarf_line_info::one_addr2line_cache): New function.
* symtab.cc (Symbol_table::detect_odr_violations): Pass
new cache-size argument to one_addr2line(), and clear cache.
Diffstat (limited to 'gold/dwarf_reader.h')
-rw-r--r-- | gold/dwarf_reader.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h index 9c6b175..173e8c2 100644 --- a/gold/dwarf_reader.h +++ b/gold/dwarf_reader.h @@ -72,12 +72,20 @@ class Dwarf_line_info addr2line(unsigned int shndx, off_t offset) { return do_addr2line(shndx, offset); } - // A helper function for a single addr2line lookup. It uses - // parameters() to figure out the size and endianness. This is less - // efficient than using the templatized size and endianness, so only - // call this from an un-templatized context. + // A helper function for a single addr2line lookup. It also keeps a + // cache of the last CACHE_SIZE Dwarf_line_info objects it created; + // set to 0 not to cache at all. The larger CACHE_SIZE is, the more + // chance this routine won't have to re-create a Dwarf_line_info + // object for its addr2line computation; such creations are slow. + // NOTE: Not thread-safe, so only call from one thread at a time. static std::string - one_addr2line(Object* object, unsigned int shndx, off_t offset); + one_addr2line(Object* object, unsigned int shndx, off_t offset, + size_t cache_size); + + // This reclaims all the memory that one_addr2line may have cached. + // Use this when you know you will not be calling one_addr2line again. + static void + clear_addr2line_cache(); private: virtual std::string |