JDK-8247515 fixed the OSX pc_to_symbol() lookup when using core files. I verified that it allows native symbols to show up in jstack output. However, I just noticed that it is failing with an address that is known to be a vtable, and for which there is a vtable symbol. After I looked into it, I discovered that the vtable symbol was properly in the symbol table used for the lookup, but lookup code was skipping the library that the address is in because it thought the address was outside of the address range of the library. The following code in pc_to_symbol() was skipping the library because the address range check failed.
if (lib->symtab && addr >= lib->base && addr < lib->base + lib->memsz) {
res = nearest_symbol(lib->symtab, addr - lib->base, poffset);
if (res) return res;
}
lib->memsz comes from the size of the LC_SEGMENT_64 that the library was discovered in. However, the library can actually span multiple segments. In this case of the vtable address, the address was in the segment that follows the initial LC_SEGMENT_64. Because of this lib->memsz is too small, resulting in symbol lookups being restricted to addresses that are in the initial segment.
The simplest approach to fixing this seems to be locating the largest offset found in the symbol table, round that up to a page boundary, and use it as lib->memsz. I've implemented this and it seems to be working.
Note the test for this will come when I finally have all issues like these resolved and can push my changes for JDK-8247514, which will include a ClhsdbFindPC test case that does "findpc" of an address known to be a vtable.