4. jstack - man
Copyright 2016 FUJITSU LIMITED
jstack(1) Troubleshooting Tools jstack(1)
NAME
jstack - Prints Java thread stack traces for a Java process, core file, or remote debug
server. This command is experimental and unsupported.
SYNOPSIS
jstack [ options ] pid
jstack [ options ] executable core
jstack [ options ] [ server-id@ ] remote-hostname-or-IP
options
The command-line options. See Options.
pid The process ID for which the stack trace is printed. The process must be a Java
process. To get a list of Java processes running on a machine, use the jps(1) command.
executable
The Java executable from which the core dump was produced.
core The core file for which the stack trace is to be printed.
3
5. jstack - man
Copyright 2016 FUJITSU LIMITED
DESCRIPTION
The jstack command prints Java stack traces of Java threads for a specified Java process, core
file, or remote debug server. For each Java frame, the full class name, method name, byte code
index (BCI), and line number, when available, are printed. With the -m option,
the jstack command prints both Java and native frames
of all threads with the program counter (PC).
OPTIONS
-F
Force a stack dump when jstack [-l] pid does not respond.
-l
Long listing. Prints additional information about locks such as a list of owned
java.util.concurrent ownable synchronizers. See the AbstractOwnableSynchronizer class
description at
http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/AbstractOwnableSynchronizer.html
-m
Prints a mixed mode stack trace that has both Java and
native C/C++ frames.
4
11. Javaコーリングコンベンション
Copyright 2016 FUJITSU LIMITED
A frame represents a physical stack frame (an activation).
Frames can be C or Java frames,
and the Java frames can be interpreted or compiled.
In contrast, vframes represent source-level activations,
so that one physical frame can correspond to
multiple source level frames because of inlining.
A frame is comprised of {pc, fp, sp}
frame_x86.hpp
frame
interpreted
compiled vframe
vframe
vframe
10
17. Inferiorオブジェクト
Copyright 2016 FUJITSU LIMITED
メモリアクセス
— Function: Inferior.read_memory (address, length)
Read length addressable memory units from the
inferior, starting at address. Returns a buffer object,
which behaves much like an array or a string. It can be
modified and given to the Inferior.write_memory
function. In Python 3, the return value is a
memoryview object
16
18. メモリアクセス関数
Copyright 2016 FUJITSU LIMITED
def readNbyteAsLittle(addr, size):
try:
buf = gdb.selected_inferior().read_memory(addr, size)
except:
return None
i = size - 1
n = 0
while i >= 0:
n = n << 8
m = ord(buf[i])
n += m
i -= 1
return n
17
22. class VMStruct (vmStruct.hpp)
Copyright 2016 FUJITSU LIMITED
class VMStructs {
public:
// The last entry is identified over in the serviceability agent by
// the fact that it has a NULL fieldName
static VMStructEntry localHotSpotVMStructs[];
// The last entry is identified over in the serviceability agent by
// the fact that it has a NULL typeName
static VMTypeEntry localHotSpotVMTypes[];
// Table of integer constants required by the serviceability agent.
// The last entry is identified over in the serviceability agent by
// the fact that it has a NULL typeName
static VMIntConstantEntry localHotSpotVMIntConstants[];
…….
21
23. VMStructEntry
Copyright 2016 FUJITSU LIMITED
typedef struct {
const char* typeName;
// The type name containing the given field (example: "Klass")
const char* fieldName;
// The field name within the type (example: "_name")
const char* typeString;
// Quoted name of the type of this field (example: "Symbol*";
int32_t isStatic;
// Indicates whether following field is an offset or an address
uint64_t offset;
// Offset of field within structure; only used for nonstatic fields
void* address;
// Address of field; only used for static fields
} VMStructEntry;
Hotspot VMを構成する(C++の)クラス・フィールドを表現
22
38. AbstractInterpreter
Copyright 2016 FUJITSU LIMITED
class AbstractInterpreter: AllStatic {
friend class VMStructs;
protected:
static StubQueue* _code; // the interpreter code (codelets)
abstractInterpreter.hpp
stubs.hpp
class StubQueue: public CHeapObj<mtCode> {
friend class VMStructs;
private:
StubInterface* _stub_interface; // the interface prototype
address _stub_buffer; // where all stubs are stored
int _buffer_size; // the buffer size in bytes
37
41. backtrace
Copyright 2016 FUJITSU LIMITED
(gdb) bt
#0 0x00007f3492d03149 in pthread_cond_timedwait@@GLIBC_2.3.2 ()
at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1 0x00007f3491e5361f in os::PlatformEvent::park(long) ()
at /v3/java/jdk1.8.0_66/jre/lib/amd64/server/libjvm.so
#2 0x00007f3491e54ff3 in os::sleep(Thread*, long, bool) ()
at /v3/java/jdk1.8.0_66/jre/lib/amd64/server/libjvm.so
#3 0x00007f3491c56f02 in JVM_Sleep () at /v3/java/jdk1.8.0_66/jre/lib/amd64/server/libjvm.so
#4 0x00007f348bc15994 in j java/lang/Thread#sleep(J)V ()
#5 0x00007f348bc07c4d in j a#xxx3()V ()
#6 0x00007f348bc07c4d in j a#xxx2()V ()
#7 0x00007f348bc07c4d in j a#xxx1()V ()
#8 0x00007f348bc07c4d in j a#main([Ljava/lang/String;)V ()
#9 0x00007f348bc007a7 in <<entryframe>> ()
#10 0x00007f3491bc3c46 in JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, T
at /v3/java/jdk1.8.0_66/jre/lib/amd64/server/libjvm.so
#11 0x00007f3491c05262 in jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID
#12 0x00007f3491c21c6a in jni_CallStaticVoidMethod () at /v3/java/jdk1.8.0_66/jre/lib/amd64/server/
#13 0x00007f3492ae7bcc in JavaMain () at /v3/java/jdk1.8.0_66/bin/../lib/amd64/jli/libjli.so
#14 0x00007f3492cfd6aa in start_thread (arg=0x7f349311b700) at pthread_create.c:333
#15 0x00007f3492618eed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
40