diff --git a/base/third_party/symbolize/symbolize.cc b/base/third_party/symbolize/symbolize.cc index a3b8399f411bf..39c2317be5e6d 100644 --- a/base/third_party/symbolize/symbolize.cc +++ b/base/third_party/symbolize/symbolize.cc @@ -505,6 +505,7 @@ static char *GetHex(const char *start, const char *end, uint64_t *hex) { static int OpenObjectFileContainingPcAndGetStartAddressNoHook( uint64_t pc, uint64_t& start_address, + uint64_t& end_address, uint64_t& base_address, char* out_file_name, size_t out_file_name_size) { @@ -552,7 +553,6 @@ static int OpenObjectFileContainingPcAndGetStartAddressNoHook( ++cursor; // Skip '-'. // Read end address. - uint64_t end_address; cursor = GetHex(cursor, eol, &end_address); if (cursor == eol || *cursor != ' ') { return -1; // Malformed line. @@ -659,15 +659,18 @@ static int OpenObjectFileContainingPcAndGetStartAddressNoHook( int OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc, uint64_t& start_address, + uint64_t& end_address, uint64_t& base_address, char* out_file_name, size_t out_file_name_size) { if (g_symbolize_open_object_file_callback) { - return g_symbolize_open_object_file_callback( - pc, start_address, base_address, out_file_name, out_file_name_size); + return g_symbolize_open_object_file_callback(pc, start_address, end_address, + base_address, out_file_name, + out_file_name_size); } return OpenObjectFileContainingPcAndGetStartAddressNoHook( - pc, start_address, base_address, out_file_name, out_file_name_size); + pc, start_address, end_address, base_address, out_file_name, + out_file_name_size); } // POSIX doesn't define any async-signal safe function for converting @@ -763,6 +766,7 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, size_t out_size) { uint64_t pc0 = reinterpret_cast(pc); uint64_t start_address = 0; + uint64_t ignored_end_address; uint64_t base_address = 0; if (out_size < 1) { @@ -772,7 +776,8 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, SafeAppendString("(", out, out_size); int object_fd = OpenObjectFileContainingPcAndGetStartAddress( - pc0, start_address, base_address, out + 1, out_size - 1); + pc0, start_address, ignored_end_address, base_address, out + 1, + out_size - 1); FileDescriptor wrapped_object_fd(object_fd); diff --git a/base/third_party/symbolize/symbolize.h b/base/third_party/symbolize/symbolize.h index 987569fdde67f..34019937968c5 100644 --- a/base/third_party/symbolize/symbolize.h +++ b/base/third_party/symbolize/symbolize.h @@ -110,17 +110,18 @@ ssize_t ReadFromOffset(const int fd, bool GetSectionHeaderByName(int fd, const char *name, size_t name_len, ElfW(Shdr) *out); -// Searches for the object file (from /proc/self/maps) that contains -// the specified pc. If found, sets |start_address| to the start address -// of where this object file is mapped in memory, sets the module base -// address into |base_address|, copies the object file name into -// |out_file_name|, and attempts to open the object file. If the object +// Searches for the object file (from /proc/self/maps) that contains the +// specified pc. If found, sets `start_address` and `end_address` to the start +// address and end address of where this object file is mapped in memory, sets +// the module base address into `base_address`, copies the object file name +// into `out_file_name`, and attempts to open the object file. If the object // file is opened successfully, returns the file descriptor. Otherwise, -// returns -1. |out_file_name_size| is the size of the file name buffer -// (including the null-terminator). +// returns -1. `out_file_name_size` is the size of the file name buffer +// (including the NUL-terminator). ATTRIBUTE_NOINLINE int OpenObjectFileContainingPcAndGetStartAddress( uint64_t pc, uint64_t& start_address, + uint64_t& end_address, uint64_t& base_address, char* out_file_name, size_t out_file_name_size); @@ -164,17 +165,18 @@ GLOG_EXPORT void InstallSymbolizeCallback(SymbolizeCallback callback); // Installs a callback function, which will be called instead of -// OpenObjectFileContainingPcAndGetStartAddress. The callback is expected +// OpenObjectFileContainingPcAndGetStartAddress. The callback is expected // to searches for the object file (from /proc/self/maps) that contains -// the specified pc. If found, sets |start_address| to the start address -// of where this object file is mapped in memory, sets the module base -// address into |base_address|, copies the object file name into -// |out_file_name|, and attempts to open the object file. If the object -// file is opened successfully, returns the file descriptor. Otherwise, -// returns -1. |out_file_name_size| is the size of the file name buffer -// (including the null-terminator). +// the specified pc. If found, sets `start_address` and `end_address` to the +// start address and end address of where this object file is mapped in memory, +// sets the module base address into `base_address`, copies the object file +// name into `out_file_name`, and attempts to open the object file. If the +// object file is opened successfully, returns the file descriptor. Otherwise, +// returns -1. `out_file_name_size` is the size of the file name buffer +// (including the NUL-terminator). typedef int (*SymbolizeOpenObjectFileCallback)(uint64_t pc, uint64_t& start_address, + uint64_t& end_address, uint64_t& base_address, char* out_file_name, size_t out_file_name_size);