RFR: 8337662: Improve os::print_hex_dump for printing Instructions sections
Thomas Stuefe
stuefe at openjdk.org
Fri Aug 2 11:16:31 UTC 2024
On Fri, 2 Aug 2024 08:04:54 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
> > Hi Matthias,
> > this is useful.
> > We need some gtests for this:
> >
> > * test with logical_address = nullptr, and highlighted address at the start/middle/end of a hex line
> > * test with logical_address != nullptr, and highlighted address should then correspond to the logical address
>
> Hi Thomas, do you have some good existing place where to place the test ?
We have tests for hex dumping, I think in gtest/os/test_os.cpp (or somewhere there). Adding your case should be not that hard.
> Btw currently only start of line is 'highlighted' , but for printing the instruction sections this is sufficient because the pc is located at a line start,
>
> Should I change this to support also highlighting if it is somewhere in the middle of the line ? If so, there would be several options, e.g. for 'highlighting' AA located in the middle of line just print `=> <hexaddress>: 44 55 66 77 88 AA BB CC `
>
> or maybe use 2 lines ? ` <hexaddress>: 44 55 66 77 88` `=> AA BB CC`
>
> or something like this ? `=> <hexaddress>: 44 55 66 77 88 |AA| BB CC `
I think start of the line is fine.
One small problem with this change is that it makes it more difficult to just copy-paste the hex output to eg. an online disassembler (I do this quite often) because most online disassemblers would fail to parse "=>" and any other decorations you add. I think its acceptable for start of line - one needs to remove the leading address anyway - but having to search and remove special characters from the middle of the line could maybe get annoying.
Ultimately, up to you. But I think leading arrow at the line is okay.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20419#issuecomment-2265137786
More information about the hotspot-runtime-dev
mailing list