How to debug with tiered compilation enabled?

3

I want to attach to java process with gdb with tiered compilation enabled. To attach at the specific instruction number by address I use print compilation as follows:

java -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:CompileCommand=print,Main.m Main

It prints something like this:

CompilerOracle: print Main.m
Java HotSpot(TM) 64-Bit Server VM warning: printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output
Compiled method (c2)      55    1             Main::m (1 bytes)
 total in heap  [0x00007f25d506fc10,0x00007f25d506fdc8] = 440
 relocation     [0x00007f25d506fd38,0x00007f25d506fd40] = 8
 main code      [0x00007f25d506fd40,0x00007f25d506fd60] = 32
 stub code      [0x00007f25d506fd60,0x00007f25d506fd78] = 24
 oops           [0x00007f25d506fd78,0x00007f25d506fd80] = 8
 metadata       [0x00007f25d506fd80,0x00007f25d506fd88] = 8
 scopes data    [0x00007f25d506fd88,0x00007f25d506fd90] = 8
 scopes pcs     [0x00007f25d506fd90,0x00007f25d506fdc0] = 48
 dependencies   [0x00007f25d506fdc0,0x00007f25d506fdc8] = 8
Loaded disassembler from /opt/jdk1.8.0_144/jre/lib/amd64/server/hsdis-amd64.so
Decoding compiled method 0x00007f25d506fc10:
Code:
Argument 0 is unknown.RIP: 0x7f25d506fd40 Code size: 0x00000038
[Disassembling for mach='amd64']
[Entry Point]
[Verified Entry Point]
[Constants]
  # {method} {0x00007f25d223c2f8} 'm' '()V' in 'Main'
  #           [sp+0x20]  (sp of caller)
  0x00007f25d506fd40: sub     $0x18,%rsp
  0x00007f25d506fd47: mov     %rbp,0x10(%rsp)   ;*synchronization entry
                                                ; - Main::m@-1 (line 10)

  0x00007f25d506fd4c: add     $0x10,%rsp
  0x00007f25d506fd50: pop     %rbp
  0x00007f25d506fd51: test    %eax,0xa7c82a9(%rip)  ;   {poll_return}
  0x00007f25d506fd57: retq
  0x00007f25d506fd58: hlt
  0x00007f25d506fd59: hlt
  0x00007f25d506fd5a: hlt
  0x00007f25d506fd5b: hlt
  0x00007f25d506fd5c: hlt
  0x00007f25d506fd5d: hlt
  0x00007f25d506fd5e: hlt
  0x00007f25d506fd5f: hlt
[Exception Handler]
[Stub Code]
  0x00007f25d506fd60: jmpq    0x7f25d506c760    ;   {no_reloc}
[Deopt Handler Code]
  0x00007f25d506fd65: callq   0x7f25d506fd6a
  0x00007f25d506fd6a: subq    $0x5,(%rsp)
  0x00007f25d506fd6f: jmpq    0x7f25d50473c0    ;   {runtime_call}
  0x00007f25d506fd74: hlt
  0x00007f25d506fd75: hlt
  0x00007f25d506fd76: hlt
  0x00007f25d506fd77: hlt
OopMapSet contains 0 OopMaps

and I can succesfully attach to the process using gdb and set a break on the instruction address specified in the output above.

But in case of tiered compilation however after setting breakpoint in gdb the app can never stop. I suppose this is because I set breakpoint and the code was recompiled at the next tier and placed at different address.

Is there a recipe to debug with tiered compilation enabled?

java
debugging
jvm
jit
asked on Stack Overflow May 17, 2018 by St.Antario

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0