8273967: gtest os.dll_address_to_function_and_library_name_vm fails on macOS12

Reviewed-by: stuefe, gziemski
This commit is contained in:
Daniel D. Daugherty 2021-11-05 17:04:39 +00:00
parent a74a839af0
commit 92d2176362
4 changed files with 38 additions and 12 deletions

View file

@ -52,6 +52,12 @@ bool MachODecoder::demangle(const char* symbol, char *buf, int buflen) {
bool MachODecoder::decode(address addr, char *buf,
int buflen, int *offset, const void *mach_base) {
if (addr == (address)(intptr_t)-1) {
// dladdr() in macOS12/Monterey returns success for -1, but that addr value
// won't work in this function. Should have been handled by the caller.
ShouldNotReachHere();
return false;
}
struct symtab_command * symt = (struct symtab_command *)
mach_find_command((struct mach_header_64 *)mach_base, LC_SYMTAB);
if (symt == NULL) {