sanitizer_common: fix __sanitizer_get_module_and_offset_for_pc signature mismatch
This fixes the following error:
sanitizer_interface_internal.h:77:7: error: conflicting types for
'__sanitizer_get_module_and_offset_for_pc'
int __sanitizer_get_module_and_offset_for_pc(
common_interface_defs.h:349:5: note: previous declaration is here
int __sanitizer_get_module_and_offset_for_pc(void *pc, char *module_path,
I am getting it on a code that uses sanitizer_common (includes internal headers),
but also transitively gets includes of the public headers in tests
via an internal version of gtest.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D118910
This commit is contained in:
@@ -739,6 +739,9 @@ bool ReadFileToBuffer(const char *file_name, char **buff, uptr *buff_size,
|
|||||||
uptr *read_len, uptr max_len = kDefaultFileMaxSize,
|
uptr *read_len, uptr max_len = kDefaultFileMaxSize,
|
||||||
error_t *errno_p = nullptr);
|
error_t *errno_p = nullptr);
|
||||||
|
|
||||||
|
int GetModuleAndOffsetForPc(uptr pc, char *module_name, uptr module_name_len,
|
||||||
|
uptr *pc_offset);
|
||||||
|
|
||||||
// When adding a new architecture, don't forget to also update
|
// When adding a new architecture, don't forget to also update
|
||||||
// script/asan_symbolize.py and sanitizer_symbolizer_libcdep.cpp.
|
// script/asan_symbolize.py and sanitizer_symbolizer_libcdep.cpp.
|
||||||
inline const char *ModuleArchToString(ModuleArch arch) {
|
inline const char *ModuleArchToString(ModuleArch arch) {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ static void SanitizerDumpCoverage(const uptr* unsorted_pcs, uptr len) {
|
|||||||
const uptr pc = pcs[i];
|
const uptr pc = pcs[i];
|
||||||
if (!pc) continue;
|
if (!pc) continue;
|
||||||
|
|
||||||
if (!__sanitizer_get_module_and_offset_for_pc(pc, nullptr, 0, &pcs[i])) {
|
if (!GetModuleAndOffsetForPc(pc, nullptr, 0, &pcs[i])) {
|
||||||
Printf("ERROR: unknown pc 0x%zx (may happen if dlclose is used)\n", pc);
|
Printf("ERROR: unknown pc 0x%zx (may happen if dlclose is used)\n", pc);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -87,8 +87,7 @@ static void SanitizerDumpCoverage(const uptr* unsorted_pcs, uptr len) {
|
|||||||
last_base = module_base;
|
last_base = module_base;
|
||||||
module_start_idx = i;
|
module_start_idx = i;
|
||||||
module_found = true;
|
module_found = true;
|
||||||
__sanitizer_get_module_and_offset_for_pc(pc, module_name, kMaxPathLength,
|
GetModuleAndOffsetForPc(pc, module_name, kMaxPathLength, &pcs[i]);
|
||||||
&pcs[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ extern "C" {
|
|||||||
|
|
||||||
SANITIZER_INTERFACE_ATTRIBUTE
|
SANITIZER_INTERFACE_ATTRIBUTE
|
||||||
int __sanitizer_get_module_and_offset_for_pc(
|
int __sanitizer_get_module_and_offset_for_pc(
|
||||||
__sanitizer::uptr pc, char *module_path,
|
void *pc, char *module_path, __sanitizer::uptr module_path_len,
|
||||||
__sanitizer::uptr module_path_len, __sanitizer::uptr *pc_offset);
|
void **pc_offset);
|
||||||
|
|
||||||
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
|
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
|
||||||
void __sanitizer_cov_trace_cmp();
|
void __sanitizer_cov_trace_cmp();
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ void BufferedStackTrace::Unwind(u32 max_depth, uptr pc, uptr bp, void *context,
|
|||||||
UnwindFast(pc, bp, stack_top, stack_bottom, max_depth);
|
UnwindFast(pc, bp, stack_top, stack_bottom, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetModuleAndOffsetForPc(uptr pc, char *module_name,
|
int GetModuleAndOffsetForPc(uptr pc, char *module_name, uptr module_name_len,
|
||||||
uptr module_name_len, uptr *pc_offset) {
|
uptr *pc_offset) {
|
||||||
const char *found_module_name = nullptr;
|
const char *found_module_name = nullptr;
|
||||||
bool ok = Symbolizer::GetOrInit()->GetModuleNameAndOffsetForPC(
|
bool ok = Symbolizer::GetOrInit()->GetModuleNameAndOffsetForPC(
|
||||||
pc, &found_module_name, pc_offset);
|
pc, &found_module_name, pc_offset);
|
||||||
@@ -216,10 +216,11 @@ void __sanitizer_symbolize_global(uptr data_addr, const char *fmt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SANITIZER_INTERFACE_ATTRIBUTE
|
SANITIZER_INTERFACE_ATTRIBUTE
|
||||||
int __sanitizer_get_module_and_offset_for_pc(uptr pc, char *module_name,
|
int __sanitizer_get_module_and_offset_for_pc(void *pc, char *module_name,
|
||||||
uptr module_name_len,
|
uptr module_name_len,
|
||||||
uptr *pc_offset) {
|
void **pc_offset) {
|
||||||
return __sanitizer::GetModuleAndOffsetForPc(pc, module_name, module_name_len,
|
return __sanitizer::GetModuleAndOffsetForPc(
|
||||||
pc_offset);
|
reinterpret_cast<uptr>(pc), module_name, module_name_len,
|
||||||
|
reinterpret_cast<uptr *>(pc_offset));
|
||||||
}
|
}
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|||||||
Reference in New Issue
Block a user