RFR: 8337662: Improve os::print_hex_dump for printing Instructions sections

Thomas Stuefe stuefe at openjdk.org
Thu Aug 1 14:30:39 UTC 2024


On Thu, 1 Aug 2024 14:05:56 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Currently we use os::print_hex_dump for printing Instruction sections in the hserr file. The function could be slightly improved, .e.g. by showing directly the pc .
>> The instructions section would for example look like this, with a small helper '=>' pointing to the pc. Makes the output more readable.
>
> src/hotspot/share/runtime/os.cpp line 1048:
> 
>> 1046:     if (cols == 0) {
>> 1047:       // highlight start of line if address of interest is located there
>> 1048:       if (highlight_address != nullptr && highlight_address == p) {
> 
> This only works if the highlighted address happens to fall to the start of a printed hex dump line, or? If it falls into the middle of the line, it will fail. E.g. :  `os::print_hex_dump(st, 0x10000000, 0x10000200, 8, false, 32, 0x10000008);`.
> 
> So, what you should do is to test if the highlight address falls into the range the printed line covers.

Another question is how to handle this with logical addresses. Does the highlight address correspond to the logical address or the physical one? Right now, it compares the physical address, but we print the logical address.

I think if someone uses the "logical address" feature (logical_start != null), it is to hexdump something that is indepent from its physical location. E.g. the content of the CDS archive, or a network packet. In that case the caller should specify a logical address as highlight address, I think that makes the most sense.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20419#discussion_r1700274868


More information about the hotspot-runtime-dev mailing list