| diff --git a/base/third_party/symbolize/symbolize.cc b/base/third_party/symbolize/symbolize.cc |
| index 3c72fd1183f48..20d4d4106d65b 100644 |
| --- a/base/third_party/symbolize/symbolize.cc |
| +++ b/base/third_party/symbolize/symbolize.cc |
| @@ -491,11 +491,12 @@ static char *GetHex(const char *start, const char *end, uint64_t *hex) { |
| return const_cast<char *>(p); |
| } |
| |
| -int OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc, |
| - uint64_t& start_address, |
| - uint64_t& base_address, |
| - char* out_file_name, |
| - size_t out_file_name_size) { |
| +static int OpenObjectFileContainingPcAndGetStartAddressNoHook( |
| + uint64_t pc, |
| + uint64_t& start_address, |
| + uint64_t& base_address, |
| + char* out_file_name, |
| + size_t out_file_name_size) { |
| int object_fd; |
| |
| int maps_fd; |
| @@ -645,6 +646,20 @@ int OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc, |
| } |
| } |
| |
| +int OpenObjectFileContainingPcAndGetStartAddress( |
| + uint64_t pc, |
| + uint64_t& start_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 OpenObjectFileContainingPcAndGetStartAddressNoHook( |
| + pc, start_address, base_address, out_file_name, out_file_name_size); |
| +} |
| + |
| // POSIX doesn't define any async-signal safe function for converting |
| // an integer to ASCII. We'll have to define our own version. |
| // itoa_r() converts an (unsigned) integer to ASCII. It returns "buf", if the |
| @@ -734,7 +749,6 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, |
| uint64_t pc0 = reinterpret_cast<uintptr_t>(pc); |
| uint64_t start_address = 0; |
| uint64_t base_address = 0; |
| - int object_fd = -1; |
| |
| if (out_size < 1) { |
| return false; |
| @@ -742,16 +756,8 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, |
| out[0] = '\0'; |
| SafeAppendString("(", out, out_size); |
| |
| - if (g_symbolize_open_object_file_callback) { |
| - object_fd = g_symbolize_open_object_file_callback(pc0, start_address, |
| - base_address, out + 1, |
| - out_size - 1); |
| - } else { |
| - object_fd = OpenObjectFileContainingPcAndGetStartAddress(pc0, start_address, |
| - base_address, |
| - out + 1, |
| - out_size - 1); |
| - } |
| + int object_fd = OpenObjectFileContainingPcAndGetStartAddress( |
| + pc0, start_address, base_address, out + 1, out_size - 1); |
| |
| FileDescriptor wrapped_object_fd(object_fd); |
| |