JDK-8261095 : Add test for clhsdb "symbol" command
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-02-03
  • Updated: 2021-03-22
  • Resolved: 2021-03-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b14Fixed
Related Reports
Relates :  
Description
The clhsdb "symbol" command is used to print the hotspot Symbol at a certain address. We should add a test for it. The following approach should work:

Use "class java.lang.Thread" to get the address of the InstanceKlass for java.lang.Thread:

hsdb> class java.lang.Thread
java/lang/Thread @0x0000000800024398

Use "inspect" of that address to dump all the fields of the java.lang.Thread InstanceKlass:

hsdb> inspect 0x0000000800024398
Type is InstanceKlass (size of 480)
juint Klass::_super_check_offset: 64
...
Symbol* Klass::_name: Symbol @ 0x0000000800471120
AccessFlags Klass::_access_flags: 52428833
markWord Klass::_prototype_header: 1
...

One of the fields is a Symbol instance, and the address is given. Use "symbol" on that address:

hsdb> symbol 0x0000000800471120
#java/lang/Thread

Confirm that that symbol is for the name of the class we used the "class" command on.

An additional benefit of this test is that is also tests the "class" and "inspect" commands, which we currently don't have any testing for.
Comments
Changeset: 086a66a0 Author: Vipin Sharma <vsharma@openjdk.org> Committer: Yasumasa Suenaga <ysuenaga@openjdk.org> Date: 2021-03-17 08:30:53 +0000 URL: https://git.openjdk.java.net/jdk/commit/086a66a0
17-03-2021