1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@localhost bin]
# jstack -help
Usage:
jstack [-l] <pid>
(to connect to running process)
jstack -F [-m] [-l] <pid>
(to connect to a hung process)
jstack [-m] [-l] <executable> <core>
(to connect to a core
file
)
jstack [-m] [-l] [server_id@]<remote server IP or
hostname
>
(to connect to a remote debug server)
Options:
-F to force a thread dump. Use when jstack <pid> does not respond (process is hung)
-m to print both java and native frames (mixed mode)
-l long listing. Prints additional information about locks
-h or -help to print this help message
|
參數java
-F:當正常輸出請求不被響應時,強制輸出線程棧堆。c++
-l:除線程棧堆外,顯示關於鎖的附加信息。apache
-m:若是調用本地方法的話,能夠顯示c/c++的棧堆bash
示例socket
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
[root@localhost bin]
# jstack -m 24971 | more
Attaching to process ID 24971, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.79-b02
Deadlock Detection:
No deadlocks found.
----------------- 24972 -----------------
0x00007fe07d2cd69d __GI___poll + 0x2d
0x00007fe070dc80a7 Java_java_net_PlainSocketImpl_socketAccept + 0x1e7
0x00007fe0745a3d98 * java.net.PlainSocketImpl.socketAccept(java.net.SocketImpl) bci:0 (Interpreted frame)
0x00007fe074597058 * java.net.AbstractPlainSocketImpl.accept(java.net.SocketImpl) bci:7 line:398 (Interpreted frame)
0x00007fe074597058 * java.net.ServerSocket.implAccept(java.net.Socket) bci:60 line:530 (Interpreted frame)
0x00007fe074597058 * java.net.ServerSocket.accept() bci:48 line:498 (Interpreted frame)
0x00007fe074597233 * org.apache.catalina.core.StandardServer.await() bci:180 line:470 (Interpreted frame)
0x00007fe074597706 * org.apache.catalina.startup.Catalina.await() bci:4 line:782 (Interpreted frame)
0x00007fe074597058 * org.apache.catalina.startup.Catalina.start() bci:209 line:728 (Interpreted frame)
0x00007fe0745914e7 <StubRoutines>
0x00007fe07c967e95 _ZN9JavaCalls11call_helperEP9JavaValueP12methodHandleP17JavaCallArgumentsP6Thread + 0x365
0x00007fe07c9668f8 _ZN9JavaCalls4callEP9JavaValue12methodHandleP17JavaCallArgumentsP6Thread + 0x28
0x00007fe07cbfdeef _ZN10Reflection6invokeE19instanceKlassHandle12methodHandle6Handleb14objArrayHandle9BasicTypeS3_bP6Thread + 0x
47f
0x00007fe07cbfeca0 _ZN10Reflection13invoke_methodEP7oopDesc6Handle14objArrayHandleP6Thread + 0x160
|