RFR: 8279194: Add Annotated Memory Viewer feature to SA's HSDB [v2]

Chris Plummer cjplummer at openjdk.java.net
Sun Jan 2 01:31:36 UTC 2022


> HSDB has a Memory Viewer feature that brings up a window that shows the memory contents in a specific address range. It basically looks just like the clhsdb "mem" output. The recently revived "mem" command (see [JDK-824466](https://bugs.openjdk.java.net/browse/JDK-8244669) and PR #6902) adds a -v options which causes PointerFinder (aka findpc) to be called on each value in memory to provide details about what the value points to (if it is an address). This PR adds this same feature to HSDB by adding a new Annotated Memory Viewer window. See the [this image](https://bugs.openjdk.java.net/secure/attachment/97439/memory_viewer.png) which shows the current Memory Viewer window, and just below it the new Annotated Memory Viewer window showing the same address range. 
> 
> A couple of implementation notes. Both types of memory viewers share the MemoryPanel class. The traditional viewer uses two columns, one for the  address and one for its contents. The annotated viewer uses just one column which contains the entire line. For example:
> 
>   0x00007f7eb010c330: 0x00007f7eb6c9dfb0 vtable for os::PlatformMonitor + 0x10
> 
> This approach was chosen rather than using 3 columns because it was a difficult to get the first two columns to be just wide enough for the 64-bit values while having the 3rd column be a long line of text. You end up with a lot of wasted space in the first two columns as you make the window wider while trying to get all the text of the 3rd column into view.
> 
> Regarding the changes in MemoryPanel.handleImport(), Memory Viewer supports clicking on a value that's an address and dragging it back onto the window to start displaying memory at that address. This dropped text ends up being processed by MemoryPanel.handleImport(). When you try this with Annotated Memory Viewer, you end up with the entire line being passed to MemoryPanel.handleImport(), not just an address (one downside of going with just 1 column instead of 3). So the changes in MemoryPanel.handleImport() detect this and pull the desired address out of the string.

Chris Plummer has updated the pull request incrementally with two additional commits since the last revision:

 - minor code cleanup
 - Update copyrights

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/6923/files
  - new: https://git.openjdk.java.net/jdk/pull/6923/files/bc91a67e..0143116d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6923&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6923&range=00-01

  Stats: 9 lines in 3 files changed: 2 ins; 3 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6923.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6923/head:pull/6923

PR: https://git.openjdk.java.net/jdk/pull/6923


More information about the serviceability-dev mailing list