RFR: 8368787: Error reporting: hs_err files should show instructions when referencing code in nmethods [v4]
    Martin Doerr 
    mdoerr at openjdk.org
       
    Thu Oct 23 10:18:08 UTC 2025
    
    
  
On Thu, 23 Oct 2025 08:58:22 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use frame_complete_offset for better start address computation. Improve comments.
>
> src/hotspot/share/code/nmethod.cpp line 4026:
> 
>> 4024:       if (iter.has_current()) end = iter.addr();
>> 4025:     }
>> 4026: 
> 
> IIUC, the size of the printout is somewhat random. In the extreme cases, this may be either (close to) start-of-method to end-of-method, so almost the whole method. Or, it may be from an address very close to the address, so a very small snippet.
> 
> Tying the end address to a relocation is not strictly necessary, no? We could just print to `MIN2(code end, addr + 64)? Disassembler should be fine if the printout stops in the middle of an instruction, as long as instruction addresses are correct? 
> 
> And could we start printing at the relocation preceding-or-at `addr - 64` instead, to ensure we have at least 64 bytes of printout before the crash address?
Right, the size is somewhat random. Relocations seem to be the most fine-grained information we currently have. In addition, they typically point to some meaningful points in the code. This PR disassembles the smallest possible snippet around the given address using relocations as start and end.
Right, having a relocation as end address is technically not strictly required. However, I've seen that the disassembler on x86 produced garbage as well when the end is not an instruction boundary.
I agree with you that we usually want at least 64 Bytes ahead. On the other hand, some people don't want too much, either. See [JDK-8274986](https://bugs.openjdk.org/browse/JDK-8274986).
So, I changed only the hex dump for which we can afford printing more without bloating the hs_err file too much. Please take a look at my new commit.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27530#discussion_r2454621885
    
    
More information about the hotspot-compiler-dev
mailing list