diff options
-rw-r--r-- | src/common/dwarf_cu_to_module.cc | 5 | ||||
-rw-r--r-- | src/common/module.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc index 3a520857..c4eb3c50 100644 --- a/src/common/dwarf_cu_to_module.cc +++ b/src/common/dwarf_cu_to_module.cc @@ -1195,7 +1195,10 @@ void DwarfCUToModule::AssignLinesToFunctions() { // next_transition may end up being zero, in which case we've completed // our pass. Handle that here, instead of trying to deal with it in // each place we compute next_transition. - if (!next_transition) + + // Some dwarf producers handle linker-removed functions by using -1 as a + // tombstone in the line table. So the end marker can be -1. + if (!next_transition || next_transition == Module::kMaxAddress) break; // Advance iterators as needed. If lines overlap or functions overlap, diff --git a/src/common/module.h b/src/common/module.h index 60bf709b..408e620b 100644 --- a/src/common/module.h +++ b/src/common/module.h @@ -39,6 +39,7 @@ #define COMMON_LINUX_MODULE_H__ #include <iostream> +#include <limits> #include <map> #include <set> #include <string> @@ -62,6 +63,7 @@ class Module { public: // The type of addresses and sizes in a symbol table. typedef uint64_t Address; + static constexpr uint64_t kMaxAddress = std::numeric_limits<Address>::max(); struct File; struct Function; struct Line; |