RFR: 8263572: Output from jstack mixed mode is misaligned

Koichi Sakata ksakata at openjdk.java.net
Mon Mar 15 07:34:18 UTC 2021


When running jstack with mixed option, the output of the lines that doesn't have an address are misaligned as followings. 

$ sudo jhsdb jstack --mixed --pid 5905
----------------- 5955 -----------------
"event-handler" #20 daemon prio=5 tid=0x00007f133079a970 nid=0x1743 in Object.wait() [0x00007f1308bfe000]
   java.lang.Thread.State: WAITING (on object monitor)
   JavaThread state: _thread_blocked
0x00007f133a85b9f3 __pthread_cond_wait + 0x243
0x00007f133940b75b os::PlatformEvent::park() + 0x8b
0x00007f13393b7b2d ObjectMonitor::wait(long, bool, Thread*) + 0xf4d
0x00007f13397f0b95 ObjectSynchronizer::wait(Handle, long, Thread*) + 0x85
0x00007f1338e85961 JVM_MonitorWait + 0x241
0x00007f1328b264b7 java.lang.Object.wait(long) + 0xd7 (Native method)
0x00007f132177b3c4 * java.lang.Object.wait() bci:2 line:338 (Compiled frame)
* com.sun.tools.jdi.EventQueueImpl.removeUnfiltered(long) bci:64 line:190 (Compiled frame)
* com.sun.tools.jdi.EventQueueImpl.remove(long) bci:18 line:97 (Interpreted frame)
0x00007f1321009543 * com.sun.tools.jdi.EventQueueImpl.remove() bci:2 line:83 (Interpreted frame)

This pull request aligns the indentation. So It will be able to improve readability.

In this pull request the address part is filled with white spaces. The amount of space is calculated from VM's logarithmic address size and lastly 2, which is the length of "0x", is added.

I checked the output on 64-bit and 32-bit OS.

0x00007f596cb2a6b7      java.lang.Object.wait(long) + 0xd7 (Native method)
0x00007f5965791ec4      * java.lang.Object.wait() bci:2 line:338 (Compiled frame)
                        * com.sun.tools.jdi.EventQueueImpl.removeUnfiltered(long) bci:64 line:190 (Compiled frame)
                        * com.sun.tools.jdi.EventQueueImpl.remove(long) bci:18 line:97 (Interpreted frame)
0x00007f5965009543      * com.sun.tools.jdi.EventQueueImpl.remove() bci:2 line:83 (Interpreted frame)
0x00007f59650099b3      * jdk.jshell.execution.JdiEventHandler.run() bci:18 line:79 (Interpreted frame)
0x00007f596500985a      * java.lang.Thread.run() bci:11 line:831 (Interpreted frame)

0x035002d4      java.lang.Object.wait(long) + 0x94 (Native method)
0x034fcd3c      * java.lang.Object.wait() bci:2 line:338 (Compiled frame)
                * com.sun.tools.jdi.EventQueueImpl.removeUnfiltered(long) bci:64 line:190 (Compiled frame)
                * com.sun.tools.jdi.EventQueueImpl.remove(long) bci:18 line:97 (Interpreted frame)
0x03296839      * com.sun.tools.jdi.EventQueueImpl.remove() bci:2 line:83 (Interpreted frame)

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

Commit messages:
 - Format the output from JStack mixed mode

Changes: https://git.openjdk.java.net/jdk/pull/3004/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3004&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263572
  Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3004.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3004/head:pull/3004

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


More information about the serviceability-dev mailing list