Mon, 10 Jun 2013 11:30:51 +0200
8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
minqi@4267 | 1 | <html> |
minqi@4267 | 2 | <head> |
minqi@4267 | 3 | <title> |
iignatyev@5029 | 4 | Replay |
minqi@4267 | 5 | </title> |
minqi@4267 | 6 | </head> |
minqi@4267 | 7 | <body> |
minqi@4267 | 8 | |
iignatyev@5029 | 9 | <h1>Compiler replay</h1> |
minqi@4267 | 10 | <p> |
iignatyev@5029 | 11 | The compiler replay is a function to repeat the compiling process from a crashed java process in compiled method<br> |
minqi@4267 | 12 | This function only exists in debug version of VM |
minqi@4267 | 13 | </p> |
minqi@4267 | 14 | <h2>Usage</h2> |
iignatyev@5029 | 15 | <pre> |
iignatyev@5029 | 16 | First, use SA to attach to the core file, if succeeded, do |
iignatyev@5029 | 17 | hsdb> dumpreplaydata <address> | -a | <thread_id> [> replay.txt] |
minqi@4267 | 18 | create file replay.txt, address is address of Method, or nmethod(CodeBlob) |
iignatyev@5029 | 19 | hsdb> buildreplayjars [all | boot | app] |
minqi@4267 | 20 | create files: |
minqi@4267 | 21 | all: |
minqi@4267 | 22 | app.jar, boot.jar |
minqi@4267 | 23 | boot: |
minqi@4267 | 24 | boot.jar |
minqi@4267 | 25 | app: |
minqi@4267 | 26 | app.jar |
minqi@4267 | 27 | exit SA now. |
minqi@4267 | 28 | Second, use the obtained replay text file, replay.txt and jar files, app.jar and boot.jar, using debug version of java |
iignatyev@5029 | 29 | java -Xbootclasspath/p:boot.jar -cp app.jar -XX:ReplayDataFile=<datafile> -XX:+ReplayCompiles .... |
minqi@4267 | 30 | This will replay the compiling process. |
minqi@4267 | 31 | |
minqi@4267 | 32 | With ReplayCompiles, the replay will recompile all the methods in app.jar, and in boot.jar to emulate the process in java app. |
minqi@4267 | 33 | |
minqi@4267 | 34 | notes: |
minqi@4267 | 35 | 1) Most time, we don't need the boot.jar which is the classes loaded from JDK. It will be only modified when an agent(JVMDI) is running and modifies the classes. |
iignatyev@5029 | 36 | 2) If encounter error as "<flag>" not found, that means the SA is using a VMStructs which is different from the one with corefile. In this case, SA has a utility tool vmstructsdump which is located at agent/src/os/<os>/proc/<os_platform> |
minqi@4267 | 37 | |
minqi@4267 | 38 | Use this tool to dump VM type library: |
iignatyev@5029 | 39 | vmstructsdump libjvm.so > <type_name>.db |
minqi@4267 | 40 | |
iignatyev@5029 | 41 | set env SA_TYPEDB=<type_name>.db (refer different shell for set envs) |