我想通过启用分层编译的gdb附加到java进程。要按地址附加特定指令编号,我使用打印编译如下:
role_arn = "arn:aws:iam::111111111111:role/my_cloudsearch_query_role"
sts = boto3.client('sts', region_name="us-east-1")
token = sts.assume_role(RoleArn=role_arn, RoleSessionName="Session1")
credentials = token['Credentials']
access_key = credentials['AccessKeyId']
secret_key = credentials['SecretAccessKey']
token = credentials['SessionToken']
session = boto3.session.Session(
aws_access_key_id=access_key,
aws_secret_access_key=secret_key,
aws_session_token=token
)
client = session.client('cloudsearchdomain', endpoint_url=endpoint)
response = client.search(...)
它打印的内容如下:
java -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:CompileCommand=print,Main.m Main
我可以使用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
成功附加到进程,并在上面的输出中指定的指令地址上设置一个中断。
但是在分层编译的情况下,但在gdb
中设置断点后,应用程序永远不能停止。我想这是因为我设置了断点,代码在下一层重新编译并放在不同的地址。
是否有启用分层编译的调试配方?