如何使用objdump反汇编OpenJDK(bin/java)?
How to use objdump to disassemble OpenJDK(bin/java)?
我想跟踪 Java 的用户级行为,所以我使用了 uprobe。
以Tracing userspace using uprobe为例
# gcc -o test test.c
# objdump -d test
OpenJDK 也是一个 C++ 程序。但是当我使用 objdump 到 java 时,它显示
wxf@wxf:/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/jdk/bin$ objdump -d java
java: file format elf64-x86-64
Disassembly of section .init:
00000000000009b0 <_init>:
9b0: 48 83 ec 08 sub [=12=]x8,%rsp
9b4: 48 8b 05 2d 16 20 00 mov 0x20162d(%rip),%rax # 201fe8 <__gmon_start__>
9bb: 48 85 c0 test %rax,%rax
9be: 74 02 je 9c2 <_init+0x12>
9c0: ff d0 callq *%rax
9c2: 48 83 c4 08 add [=12=]x8,%rsp
9c6: c3 retq
Disassembly of section .plt:
00000000000009d0 <.plt>:
9d0: ff 35 9a 15 20 00 pushq 0x20159a(%rip) # 201f70 <_GLOBAL_OFFSET_TABLE_+0x8>
9d6: ff 25 9c 15 20 00 jmpq *0x20159c(%rip) # 201f78 <_GLOBAL_OFFSET_TABLE_+0x10>
9dc: 0f 1f 40 00 nopl 0x0(%rax)
00000000000009e0 <JLI_InitArgProcessing@plt>:
9e0: ff 25 9a 15 20 00 jmpq *0x20159a(%rip) # 201f80 <JLI_InitArgProcessing@SUNWprivate_1.1>
9e6: 68 00 00 00 00 pushq [=12=]x0
9eb: e9 e0 ff ff ff jmpq 9d0 <.plt>
00000000000009f0 <getenv@plt>:
9f0: ff 25 92 15 20 00 jmpq *0x201592(%rip) # 201f88 <getenv@GLIBC_2.2.5>
9f6: 68 01 00 00 00 pushq [=12=]x1
9fb: e9 d0 ff ff ff jmpq 9d0 <.plt>
0000000000000a00 <JLI_PreprocessArg@plt>:
a00: ff 25 8a 15 20 00 jmpq *0x20158a(%rip) # 201f90 <JLI_PreprocessArg@SUNWprivate_1.1>
a06: 68 02 00 00 00 pushq [=12=]x2
a0b: e9 c0 ff ff ff jmpq 9d0 <.plt>
0000000000000a10 <JLI_List_new@plt>:
a10: ff 25 82 15 20 00 jmpq *0x201582(%rip) # 201f98 <JLI_List_new@SUNWprivate_1.1>
a16: 68 03 00 00 00 pushq [=12=]x3
a1b: e9 b0 ff ff ff jmpq 9d0 <.plt>
0000000000000a20 <__stack_chk_fail@plt>:
a20: ff 25 7a 15 20 00 jmpq *0x20157a(%rip) # 201fa0 <__stack_chk_fail@GLIBC_2.4>
a26: 68 04 00 00 00 pushq [=12=]x4
a2b: e9 a0 ff ff ff jmpq 9d0 <.plt>
0000000000000a30 <JLI_AddArgsFromEnvVar@plt>:
a30: ff 25 72 15 20 00 jmpq *0x201572(%rip) # 201fa8 <JLI_AddArgsFromEnvVar@SUNWprivate_1.1>
a36: 68 05 00 00 00 pushq [=12=]x5
a3b: e9 90 ff ff ff jmpq 9d0 <.plt>
0000000000000a40 <JLI_StringDup@plt>:
a40: ff 25 6a 15 20 00 jmpq *0x20156a(%rip) # 201fb0 <JLI_StringDup@SUNWprivate_1.1>
a46: 68 06 00 00 00 pushq [=12=]x6
a4b: e9 80 ff ff ff jmpq 9d0 <.plt>
0000000000000a50 <JLI_Launch@plt>:
a50: ff 25 62 15 20 00 jmpq *0x201562(%rip) # 201fb8 <JLI_Launch@SUNWprivate_1.1>
a56: 68 07 00 00 00 pushq [=12=]x7
a5b: e9 70 ff ff ff jmpq 9d0 <.plt>
0000000000000a60 <JLI_List_add@plt>:
a60: ff 25 5a 15 20 00 jmpq *0x20155a(%rip) # 201fc0 <JLI_List_add@SUNWprivate_1.1>
a66: 68 08 00 00 00 pushq [=12=]x8
a6b: e9 60 ff ff ff jmpq 9d0 <.plt>
0000000000000a70 <JLI_MemFree@plt>:
a70: ff 25 52 15 20 00 jmpq *0x201552(%rip) # 201fc8 <JLI_MemFree@SUNWprivate_1.1>
a76: 68 09 00 00 00 pushq [=12=]x9
a7b: e9 50 ff ff ff jmpq 9d0 <.plt>
0000000000000a80 <JLI_ReportMessage@plt>:
a80: ff 25 4a 15 20 00 jmpq *0x20154a(%rip) # 201fd0 <JLI_ReportMessage@SUNWprivate_1.1>
a86: 68 0a 00 00 00 pushq [=12=]xa
a8b: e9 40 ff ff ff jmpq 9d0 <.plt>
Disassembly of section .plt.got:
0000000000000a90 <__cxa_finalize@plt>:
a90: ff 25 62 15 20 00 jmpq *0x201562(%rip) # 201ff8 <__cxa_finalize@GLIBC_2.2.5>
a96: 66 90 xchg %ax,%ax
Disassembly of section .text:
0000000000000aa0 <_start>:
aa0: 31 ed xor %ebp,%ebp
aa2: 49 89 d1 mov %rdx,%r9
aa5: 5e pop %rsi
aa6: 48 89 e2 mov %rsp,%rdx
aa9: 48 83 e4 f0 and [=12=]xfffffffffffffff0,%rsp
aad: 50 push %rax
aae: 54 push %rsp
aaf: 4c 8d 05 da 03 00 00 lea 0x3da(%rip),%r8 # e90 <__libc_csu_fini>
ab6: 48 8d 0d 63 03 00 00 lea 0x363(%rip),%rcx # e20 <__libc_csu_init>
abd: 48 8d 3d e6 00 00 00 lea 0xe6(%rip),%rdi # baa <main>
ac4: ff 15 16 15 20 00 callq *0x201516(%rip) # 201fe0 <__libc_start_main@GLIBC_2.2.5>
aca: f4 hlt
acb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
0000000000000ad0 <deregister_tm_clones>:
ad0: 48 8d 3d 99 15 20 00 lea 0x201599(%rip),%rdi # 202070 <__TMC_END__>
ad7: 55 push %rbp
ad8: 48 8d 05 91 15 20 00 lea 0x201591(%rip),%rax # 202070 <__TMC_END__>
adf: 48 39 f8 cmp %rdi,%rax
ae2: 48 89 e5 mov %rsp,%rbp
ae5: 74 19 je b00 <deregister_tm_clones+0x30>
ae7: 48 8b 05 ea 14 20 00 mov 0x2014ea(%rip),%rax # 201fd8 <_ITM_deregisterTMCloneTable>
aee: 48 85 c0 test %rax,%rax
af1: 74 0d je b00 <deregister_tm_clones+0x30>
af3: 5d pop %rbp
af4: ff e0 jmpq *%rax
af6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
afd: 00 00 00
b00: 5d pop %rbp
b01: c3 retq
b02: 0f 1f 40 00 nopl 0x0(%rax)
b06: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
b0d: 00 00 00
0000000000000b10 <register_tm_clones>:
b10: 48 8d 3d 59 15 20 00 lea 0x201559(%rip),%rdi # 202070 <__TMC_END__>
b17: 48 8d 35 52 15 20 00 lea 0x201552(%rip),%rsi # 202070 <__TMC_END__>
b1e: 55 push %rbp
b1f: 48 29 fe sub %rdi,%rsi
b22: 48 89 e5 mov %rsp,%rbp
b25: 48 c1 fe 03 sar [=12=]x3,%rsi
b29: 48 89 f0 mov %rsi,%rax
b2c: 48 c1 e8 3f shr [=12=]x3f,%rax
b30: 48 01 c6 add %rax,%rsi
b33: 48 d1 fe sar %rsi
b36: 74 18 je b50 <register_tm_clones+0x40>
b38: 48 8b 05 b1 14 20 00 mov 0x2014b1(%rip),%rax # 201ff0 <_ITM_registerTMCloneTable>
b3f: 48 85 c0 test %rax,%rax
b42: 74 0c je b50 <register_tm_clones+0x40>
b44: 5d pop %rbp
b45: ff e0 jmpq *%rax
b47: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
b4e: 00 00
b50: 5d pop %rbp
b51: c3 retq
b52: 0f 1f 40 00 nopl 0x0(%rax)
b56: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
b5d: 00 00 00
0000000000000b60 <__do_global_dtors_aux>:
b60: 80 3d 09 15 20 00 00 cmpb [=12=]x0,0x201509(%rip) # 202070 <__TMC_END__>
b67: 75 2f jne b98 <__do_global_dtors_aux+0x38>
b69: 48 83 3d 87 14 20 00 cmpq [=12=]x0,0x201487(%rip) # 201ff8 <__cxa_finalize@GLIBC_2.2.5>
b70: 00
b71: 55 push %rbp
b72: 48 89 e5 mov %rsp,%rbp
b75: 74 0c je b83 <__do_global_dtors_aux+0x23>
b77: 48 8b 3d 8a 14 20 00 mov 0x20148a(%rip),%rdi # 202008 <__dso_handle>
b7e: e8 0d ff ff ff callq a90 <__cxa_finalize@plt>
b83: e8 48 ff ff ff callq ad0 <deregister_tm_clones>
b88: c6 05 e1 14 20 00 01 movb [=12=]x1,0x2014e1(%rip) # 202070 <__TMC_END__>
b8f: 5d pop %rbp
b90: c3 retq
b91: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
b98: f3 c3 repz retq
b9a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
0000000000000ba0 <frame_dummy>:
ba0: 55 push %rbp
ba1: 48 89 e5 mov %rsp,%rbp
ba4: 5d pop %rbp
ba5: e9 66 ff ff ff jmpq b10 <register_tm_clones>
0000000000000baa <main>:
baa: 55 push %rbp
bab: 48 89 e5 mov %rsp,%rbp
bae: 48 83 ec 50 sub [=12=]x50,%rsp
bb2: 89 7d bc mov %edi,-0x44(%rbp)
bb5: 48 89 75 b0 mov %rsi,-0x50(%rbp)
bb9: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
bc0: 00 00
bc2: 48 89 45 f8 mov %rax,-0x8(%rbp)
bc6: 31 c0 xor %eax,%eax
bc8: c6 45 c7 00 movb [=12=]x0,-0x39(%rbp)
bcc: b8 00 00 00 00 mov [=12=]x0,%eax
bd1: 0f b6 c0 movzbl %al,%eax
bd4: 89 c6 mov %eax,%esi
bd6: bf 01 00 00 00 mov [=12=]x1,%edi
bdb: e8 00 fe ff ff callq 9e0 <JLI_InitArgProcessing@plt>
be0: 8b 45 bc mov -0x44(%rbp),%eax
be3: 83 c0 01 add [=12=]x1,%eax
be6: 48 98 cltq
be8: 48 89 c7 mov %rax,%rdi
beb: e8 20 fe ff ff callq a10 <JLI_List_new@plt>
bf0: 48 89 45 d8 mov %rax,-0x28(%rbp)
bf4: c7 45 c8 00 00 00 00 movl [=12=]x0,-0x38(%rbp)
bfb: 48 8b 45 b0 mov -0x50(%rbp),%rax
bff: 48 8b 00 mov (%rax),%rax
c02: 48 89 c7 mov %rax,%rdi
c05: e8 36 fe ff ff callq a40 <JLI_StringDup@plt>
c0a: 48 89 c2 mov %rax,%rdx
c0d: 48 8b 45 d8 mov -0x28(%rbp),%rax
c11: 48 89 d6 mov %rdx,%rsi
c14: 48 89 c7 mov %rax,%rdi
c17: e8 44 fe ff ff callq a60 <JLI_List_add@plt>
c1c: 48 8b 45 d8 mov -0x28(%rbp),%rax
c20: 48 8d 35 bf 02 00 00 lea 0x2bf(%rip),%rsi # ee6 <const_disable_argfile+0x1>
c27: 48 89 c7 mov %rax,%rdi
c2a: e8 01 fe ff ff callq a30 <JLI_AddArgsFromEnvVar@plt>
c2f: 84 c0 test %al,%al
c31: 74 47 je c7a <main+0xd0>
c33: 48 8d 3d bd 02 00 00 lea 0x2bd(%rip),%rdi # ef7 <const_disable_argfile+0x12>
c3a: e8 b1 fd ff ff callq 9f0 <getenv@plt>
c3f: 48 85 c0 test %rax,%rax
c42: 74 36 je c7a <main+0xd0>
c44: 48 8d 3d c1 02 00 00 lea 0x2c1(%rip),%rdi # f0c <const_disable_argfile+0x27>
c4b: e8 a0 fd ff ff callq 9f0 <getenv@plt>
c50: 48 89 45 e0 mov %rax,-0x20(%rbp)
c54: 48 83 7d e0 00 cmpq [=12=]x0,-0x20(%rbp)
c59: 74 1f je c7a <main+0xd0>
c5b: 48 8b 45 e0 mov -0x20(%rbp),%rax
c5f: 48 89 c2 mov %rax,%rdx
c62: 48 8d 35 a3 02 00 00 lea 0x2a3(%rip),%rsi # f0c <const_disable_argfile+0x27>
c69: 48 8d 3d aa 02 00 00 lea 0x2aa(%rip),%rdi # f1a <const_disable_argfile+0x35>
c70: b8 00 00 00 00 mov [=12=]x0,%eax
c75: e8 06 fe ff ff callq a80 <JLI_ReportMessage@plt>
c7a: c7 45 c8 01 00 00 00 movl [=12=]x1,-0x38(%rbp)
c81: e9 c2 00 00 00 jmpq d48 <main+0x19e>
c86: 8b 45 c8 mov -0x38(%rbp),%eax
c89: 48 98 cltq
c8b: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx
c92: 00
c93: 48 8b 45 b0 mov -0x50(%rbp),%rax
c97: 48 01 d0 add %rdx,%rax
c9a: 48 8b 00 mov (%rax),%rax
c9d: 48 89 c7 mov %rax,%rdi
ca0: e8 5b fd ff ff callq a00 <JLI_PreprocessArg@plt>
ca5: 48 89 45 f0 mov %rax,-0x10(%rbp)
ca9: 48 83 7d f0 00 cmpq [=12=]x0,-0x10(%rbp)
cae: 75 33 jne ce3 <main+0x139>
cb0: 8b 45 c8 mov -0x38(%rbp),%eax
cb3: 48 98 cltq
cb5: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx
cbc: 00
cbd: 48 8b 45 b0 mov -0x50(%rbp),%rax
cc1: 48 01 d0 add %rdx,%rax
cc4: 48 8b 00 mov (%rax),%rax
cc7: 48 89 c7 mov %rax,%rdi
cca: e8 71 fd ff ff callq a40 <JLI_StringDup@plt>
ccf: 48 89 c2 mov %rax,%rdx
cd2: 48 8b 45 d8 mov -0x28(%rbp),%rax
cd6: 48 89 d6 mov %rdx,%rsi
cd9: 48 89 c7 mov %rax,%rdi
cdc: e8 7f fd ff ff callq a60 <JLI_List_add@plt>
ce1: eb 61 jmp d44 <main+0x19a>
ce3: 48 8b 45 f0 mov -0x10(%rbp),%rax
ce7: 48 8b 40 08 mov 0x8(%rax),%rax
ceb: 89 45 d4 mov %eax,-0x2c(%rbp)
cee: c7 45 cc 00 00 00 00 movl [=12=]x0,-0x34(%rbp)
cf5: eb 2a jmp d21 <main+0x177>
cf7: 48 8b 45 f0 mov -0x10(%rbp),%rax
cfb: 48 8b 00 mov (%rax),%rax
cfe: 8b 55 cc mov -0x34(%rbp),%edx
d01: 48 63 d2 movslq %edx,%rdx
d04: 48 c1 e2 03 shl [=12=]x3,%rdx
d08: 48 01 d0 add %rdx,%rax
d0b: 48 8b 10 mov (%rax),%rdx
d0e: 48 8b 45 d8 mov -0x28(%rbp),%rax
d12: 48 89 d6 mov %rdx,%rsi
d15: 48 89 c7 mov %rax,%rdi
d18: e8 43 fd ff ff callq a60 <JLI_List_add@plt>
d1d: 83 45 cc 01 addl [=12=]x1,-0x34(%rbp)
d21: 8b 45 cc mov -0x34(%rbp),%eax
d24: 3b 45 d4 cmp -0x2c(%rbp),%eax
d27: 7c ce jl cf7 <main+0x14d>
d29: 48 8b 45 f0 mov -0x10(%rbp),%rax
d2d: 48 8b 00 mov (%rax),%rax
d30: 48 89 c7 mov %rax,%rdi
d33: e8 38 fd ff ff callq a70 <JLI_MemFree@plt>
d38: 48 8b 45 f0 mov -0x10(%rbp),%rax
d3c: 48 89 c7 mov %rax,%rdi
d3f: e8 2c fd ff ff callq a70 <JLI_MemFree@plt>
d44: 83 45 c8 01 addl [=12=]x1,-0x38(%rbp)
d48: 8b 45 c8 mov -0x38(%rbp),%eax
d4b: 3b 45 bc cmp -0x44(%rbp),%eax
d4e: 0f 8c 32 ff ff ff jl c86 <main+0xdc>
d54: 48 8b 45 d8 mov -0x28(%rbp),%rax
d58: 48 8b 40 08 mov 0x8(%rax),%rax
d5c: 89 45 d0 mov %eax,-0x30(%rbp)
d5f: 48 8b 45 d8 mov -0x28(%rbp),%rax
d63: be 00 00 00 00 mov [=12=]x0,%esi
d68: 48 89 c7 mov %rax,%rdi
d6b: e8 f0 fc ff ff callq a60 <JLI_List_add@plt>
d70: 48 8b 45 d8 mov -0x28(%rbp),%rax
d74: 48 8b 00 mov (%rax),%rax
d77: 48 89 45 e8 mov %rax,-0x18(%rbp)
d7b: 44 0f b6 4d c7 movzbl -0x39(%rbp),%r9d
d80: b8 01 00 00 00 mov [=12=]x1,%eax
d85: 44 0f b6 c0 movzbl %al,%r8d
d89: 48 8b 05 d8 12 20 00 mov 0x2012d8(%rip),%rax # 202068 <const_launcher>
d90: 48 85 c0 test %rax,%rax
d93: 75 09 jne d9e <main+0x1f4>
d95: 48 8b 45 e8 mov -0x18(%rbp),%rax
d99: 48 8b 10 mov (%rax),%rdx
d9c: eb 07 jmp da5 <main+0x1fb>
d9e: 48 8b 15 c3 12 20 00 mov 0x2012c3(%rip),%rdx # 202068 <const_launcher>
da5: 48 8b 05 b4 12 20 00 mov 0x2012b4(%rip),%rax # 202060 <const_progname>
dac: 48 85 c0 test %rax,%rax
daf: 75 09 jne dba <main+0x210>
db1: 48 8b 45 e8 mov -0x18(%rbp),%rax
db5: 48 8b 00 mov (%rax),%rax
db8: eb 07 jmp dc1 <main+0x217>
dba: 48 8b 05 9f 12 20 00 mov 0x20129f(%rip),%rax # 202060 <const_progname>
dc1: 48 8b 0d b0 12 20 00 mov 0x2012b0(%rip),%rcx # 202078 <const_jargs>
dc8: 48 8b 75 e8 mov -0x18(%rbp),%rsi
dcc: 8b 7d d0 mov -0x30(%rbp),%edi
dcf: 6a 00 pushq [=12=]x0
dd1: 41 51 push %r9
dd3: 41 50 push %r8
dd5: 6a 00 pushq [=12=]x0
dd7: 52 push %rdx
dd8: 50 push %rax
dd9: 48 8d 05 51 01 00 00 lea 0x151(%rip),%rax # f31 <const_disable_argfile+0x4c>
de0: 50 push %rax
de1: 48 8d 05 4d 01 00 00 lea 0x14d(%rip),%rax # f35 <const_disable_argfile+0x50>
de8: 50 push %rax
de9: 41 b9 00 00 00 00 mov [=12=]x0,%r9d
def: 41 b8 00 00 00 00 mov [=12=]x0,%r8d
df5: ba 01 00 00 00 mov [=12=]x1,%edx
dfa: e8 51 fc ff ff callq a50 <JLI_Launch@plt>
dff: 48 83 c4 40 add [=12=]x40,%rsp
e03: 48 8b 4d f8 mov -0x8(%rbp),%rcx
e07: 64 48 33 0c 25 28 00 xor %fs:0x28,%rcx
e0e: 00 00
e10: 74 05 je e17 <main+0x26d>
e12: e8 09 fc ff ff callq a20 <__stack_chk_fail@plt>
e17: c9 leaveq
e18: c3 retq
e19: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
0000000000000e20 <__libc_csu_init>:
e20: 41 57 push %r15
e22: 41 56 push %r14
e24: 41 89 ff mov %edi,%r15d
e27: 41 55 push %r13
e29: 41 54 push %r12
e2b: 4c 8d 25 e6 0e 20 00 lea 0x200ee6(%rip),%r12 # 201d18 <__frame_dummy_init_array_entry>
e32: 55 push %rbp
e33: 48 8d 2d e6 0e 20 00 lea 0x200ee6(%rip),%rbp # 201d20 <__init_array_end>
e3a: 53 push %rbx
e3b: 49 89 f6 mov %rsi,%r14
e3e: 49 89 d5 mov %rdx,%r13
e41: 4c 29 e5 sub %r12,%rbp
e44: 48 83 ec 08 sub [=12=]x8,%rsp
e48: 48 c1 fd 03 sar [=12=]x3,%rbp
e4c: e8 5f fb ff ff callq 9b0 <_init>
e51: 48 85 ed test %rbp,%rbp
e54: 74 20 je e76 <__libc_csu_init+0x56>
e56: 31 db xor %ebx,%ebx
e58: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
e5f: 00
e60: 4c 89 ea mov %r13,%rdx
e63: 4c 89 f6 mov %r14,%rsi
e66: 44 89 ff mov %r15d,%edi
e69: 41 ff 14 dc callq *(%r12,%rbx,8)
e6d: 48 83 c3 01 add [=12=]x1,%rbx
e71: 48 39 dd cmp %rbx,%rbp
e74: 75 ea jne e60 <__libc_csu_init+0x40>
e76: 48 83 c4 08 add [=12=]x8,%rsp
e7a: 5b pop %rbx
e7b: 5d pop %rbp
e7c: 41 5c pop %r12
e7e: 41 5d pop %r13
e80: 41 5e pop %r14
e82: 41 5f pop %r15
e84: c3 retq
e85: 90 nop
e86: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
e8d: 00 00 00
0000000000000e90 <__libc_csu_fini>:
e90: f3 c3 repz retq
Disassembly of section .fini:
0000000000000e94 <_fini>:
e94: 48 83 ec 08 sub [=12=]x8,%rsp
e98: 48 83 c4 08 add [=12=]x8,%rsp
e9c: c3 retq
wxf@wxf:/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/jdk/bin$
显然,它并不完整。 Source code 包含比上面更多的代码,例如垃圾收集。
那么,如何使用objdump反汇编OpenJDK(bin/java)呢?我需要破解 JVM 中的 GC 部分。
Java程序链接到其他程序文件,可以用ldd查看Java需要的共享库。
dexter@dextercd ~ % ldd /usr/bin/java
linux-vdso.so.1 (0x00007ffea42ec000)
libjli.so => not found
libc.so.6 => /usr/bin/../lib/libc.so.6 (0x00007f3002e60000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f300341a000)
在这种情况下 libjli.so
可能包含更多 Java 的运行时代码。
java
binary 是一个简单的启动器。那里没有 JVM 代码。你需要的是libjvm.so
.
详情见this answer。
我想跟踪 Java 的用户级行为,所以我使用了 uprobe。
以Tracing userspace using uprobe为例
# gcc -o test test.c
# objdump -d test
OpenJDK 也是一个 C++ 程序。但是当我使用 objdump 到 java 时,它显示
wxf@wxf:/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/jdk/bin$ objdump -d java
java: file format elf64-x86-64
Disassembly of section .init:
00000000000009b0 <_init>:
9b0: 48 83 ec 08 sub [=12=]x8,%rsp
9b4: 48 8b 05 2d 16 20 00 mov 0x20162d(%rip),%rax # 201fe8 <__gmon_start__>
9bb: 48 85 c0 test %rax,%rax
9be: 74 02 je 9c2 <_init+0x12>
9c0: ff d0 callq *%rax
9c2: 48 83 c4 08 add [=12=]x8,%rsp
9c6: c3 retq
Disassembly of section .plt:
00000000000009d0 <.plt>:
9d0: ff 35 9a 15 20 00 pushq 0x20159a(%rip) # 201f70 <_GLOBAL_OFFSET_TABLE_+0x8>
9d6: ff 25 9c 15 20 00 jmpq *0x20159c(%rip) # 201f78 <_GLOBAL_OFFSET_TABLE_+0x10>
9dc: 0f 1f 40 00 nopl 0x0(%rax)
00000000000009e0 <JLI_InitArgProcessing@plt>:
9e0: ff 25 9a 15 20 00 jmpq *0x20159a(%rip) # 201f80 <JLI_InitArgProcessing@SUNWprivate_1.1>
9e6: 68 00 00 00 00 pushq [=12=]x0
9eb: e9 e0 ff ff ff jmpq 9d0 <.plt>
00000000000009f0 <getenv@plt>:
9f0: ff 25 92 15 20 00 jmpq *0x201592(%rip) # 201f88 <getenv@GLIBC_2.2.5>
9f6: 68 01 00 00 00 pushq [=12=]x1
9fb: e9 d0 ff ff ff jmpq 9d0 <.plt>
0000000000000a00 <JLI_PreprocessArg@plt>:
a00: ff 25 8a 15 20 00 jmpq *0x20158a(%rip) # 201f90 <JLI_PreprocessArg@SUNWprivate_1.1>
a06: 68 02 00 00 00 pushq [=12=]x2
a0b: e9 c0 ff ff ff jmpq 9d0 <.plt>
0000000000000a10 <JLI_List_new@plt>:
a10: ff 25 82 15 20 00 jmpq *0x201582(%rip) # 201f98 <JLI_List_new@SUNWprivate_1.1>
a16: 68 03 00 00 00 pushq [=12=]x3
a1b: e9 b0 ff ff ff jmpq 9d0 <.plt>
0000000000000a20 <__stack_chk_fail@plt>:
a20: ff 25 7a 15 20 00 jmpq *0x20157a(%rip) # 201fa0 <__stack_chk_fail@GLIBC_2.4>
a26: 68 04 00 00 00 pushq [=12=]x4
a2b: e9 a0 ff ff ff jmpq 9d0 <.plt>
0000000000000a30 <JLI_AddArgsFromEnvVar@plt>:
a30: ff 25 72 15 20 00 jmpq *0x201572(%rip) # 201fa8 <JLI_AddArgsFromEnvVar@SUNWprivate_1.1>
a36: 68 05 00 00 00 pushq [=12=]x5
a3b: e9 90 ff ff ff jmpq 9d0 <.plt>
0000000000000a40 <JLI_StringDup@plt>:
a40: ff 25 6a 15 20 00 jmpq *0x20156a(%rip) # 201fb0 <JLI_StringDup@SUNWprivate_1.1>
a46: 68 06 00 00 00 pushq [=12=]x6
a4b: e9 80 ff ff ff jmpq 9d0 <.plt>
0000000000000a50 <JLI_Launch@plt>:
a50: ff 25 62 15 20 00 jmpq *0x201562(%rip) # 201fb8 <JLI_Launch@SUNWprivate_1.1>
a56: 68 07 00 00 00 pushq [=12=]x7
a5b: e9 70 ff ff ff jmpq 9d0 <.plt>
0000000000000a60 <JLI_List_add@plt>:
a60: ff 25 5a 15 20 00 jmpq *0x20155a(%rip) # 201fc0 <JLI_List_add@SUNWprivate_1.1>
a66: 68 08 00 00 00 pushq [=12=]x8
a6b: e9 60 ff ff ff jmpq 9d0 <.plt>
0000000000000a70 <JLI_MemFree@plt>:
a70: ff 25 52 15 20 00 jmpq *0x201552(%rip) # 201fc8 <JLI_MemFree@SUNWprivate_1.1>
a76: 68 09 00 00 00 pushq [=12=]x9
a7b: e9 50 ff ff ff jmpq 9d0 <.plt>
0000000000000a80 <JLI_ReportMessage@plt>:
a80: ff 25 4a 15 20 00 jmpq *0x20154a(%rip) # 201fd0 <JLI_ReportMessage@SUNWprivate_1.1>
a86: 68 0a 00 00 00 pushq [=12=]xa
a8b: e9 40 ff ff ff jmpq 9d0 <.plt>
Disassembly of section .plt.got:
0000000000000a90 <__cxa_finalize@plt>:
a90: ff 25 62 15 20 00 jmpq *0x201562(%rip) # 201ff8 <__cxa_finalize@GLIBC_2.2.5>
a96: 66 90 xchg %ax,%ax
Disassembly of section .text:
0000000000000aa0 <_start>:
aa0: 31 ed xor %ebp,%ebp
aa2: 49 89 d1 mov %rdx,%r9
aa5: 5e pop %rsi
aa6: 48 89 e2 mov %rsp,%rdx
aa9: 48 83 e4 f0 and [=12=]xfffffffffffffff0,%rsp
aad: 50 push %rax
aae: 54 push %rsp
aaf: 4c 8d 05 da 03 00 00 lea 0x3da(%rip),%r8 # e90 <__libc_csu_fini>
ab6: 48 8d 0d 63 03 00 00 lea 0x363(%rip),%rcx # e20 <__libc_csu_init>
abd: 48 8d 3d e6 00 00 00 lea 0xe6(%rip),%rdi # baa <main>
ac4: ff 15 16 15 20 00 callq *0x201516(%rip) # 201fe0 <__libc_start_main@GLIBC_2.2.5>
aca: f4 hlt
acb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
0000000000000ad0 <deregister_tm_clones>:
ad0: 48 8d 3d 99 15 20 00 lea 0x201599(%rip),%rdi # 202070 <__TMC_END__>
ad7: 55 push %rbp
ad8: 48 8d 05 91 15 20 00 lea 0x201591(%rip),%rax # 202070 <__TMC_END__>
adf: 48 39 f8 cmp %rdi,%rax
ae2: 48 89 e5 mov %rsp,%rbp
ae5: 74 19 je b00 <deregister_tm_clones+0x30>
ae7: 48 8b 05 ea 14 20 00 mov 0x2014ea(%rip),%rax # 201fd8 <_ITM_deregisterTMCloneTable>
aee: 48 85 c0 test %rax,%rax
af1: 74 0d je b00 <deregister_tm_clones+0x30>
af3: 5d pop %rbp
af4: ff e0 jmpq *%rax
af6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
afd: 00 00 00
b00: 5d pop %rbp
b01: c3 retq
b02: 0f 1f 40 00 nopl 0x0(%rax)
b06: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
b0d: 00 00 00
0000000000000b10 <register_tm_clones>:
b10: 48 8d 3d 59 15 20 00 lea 0x201559(%rip),%rdi # 202070 <__TMC_END__>
b17: 48 8d 35 52 15 20 00 lea 0x201552(%rip),%rsi # 202070 <__TMC_END__>
b1e: 55 push %rbp
b1f: 48 29 fe sub %rdi,%rsi
b22: 48 89 e5 mov %rsp,%rbp
b25: 48 c1 fe 03 sar [=12=]x3,%rsi
b29: 48 89 f0 mov %rsi,%rax
b2c: 48 c1 e8 3f shr [=12=]x3f,%rax
b30: 48 01 c6 add %rax,%rsi
b33: 48 d1 fe sar %rsi
b36: 74 18 je b50 <register_tm_clones+0x40>
b38: 48 8b 05 b1 14 20 00 mov 0x2014b1(%rip),%rax # 201ff0 <_ITM_registerTMCloneTable>
b3f: 48 85 c0 test %rax,%rax
b42: 74 0c je b50 <register_tm_clones+0x40>
b44: 5d pop %rbp
b45: ff e0 jmpq *%rax
b47: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
b4e: 00 00
b50: 5d pop %rbp
b51: c3 retq
b52: 0f 1f 40 00 nopl 0x0(%rax)
b56: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
b5d: 00 00 00
0000000000000b60 <__do_global_dtors_aux>:
b60: 80 3d 09 15 20 00 00 cmpb [=12=]x0,0x201509(%rip) # 202070 <__TMC_END__>
b67: 75 2f jne b98 <__do_global_dtors_aux+0x38>
b69: 48 83 3d 87 14 20 00 cmpq [=12=]x0,0x201487(%rip) # 201ff8 <__cxa_finalize@GLIBC_2.2.5>
b70: 00
b71: 55 push %rbp
b72: 48 89 e5 mov %rsp,%rbp
b75: 74 0c je b83 <__do_global_dtors_aux+0x23>
b77: 48 8b 3d 8a 14 20 00 mov 0x20148a(%rip),%rdi # 202008 <__dso_handle>
b7e: e8 0d ff ff ff callq a90 <__cxa_finalize@plt>
b83: e8 48 ff ff ff callq ad0 <deregister_tm_clones>
b88: c6 05 e1 14 20 00 01 movb [=12=]x1,0x2014e1(%rip) # 202070 <__TMC_END__>
b8f: 5d pop %rbp
b90: c3 retq
b91: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
b98: f3 c3 repz retq
b9a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
0000000000000ba0 <frame_dummy>:
ba0: 55 push %rbp
ba1: 48 89 e5 mov %rsp,%rbp
ba4: 5d pop %rbp
ba5: e9 66 ff ff ff jmpq b10 <register_tm_clones>
0000000000000baa <main>:
baa: 55 push %rbp
bab: 48 89 e5 mov %rsp,%rbp
bae: 48 83 ec 50 sub [=12=]x50,%rsp
bb2: 89 7d bc mov %edi,-0x44(%rbp)
bb5: 48 89 75 b0 mov %rsi,-0x50(%rbp)
bb9: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
bc0: 00 00
bc2: 48 89 45 f8 mov %rax,-0x8(%rbp)
bc6: 31 c0 xor %eax,%eax
bc8: c6 45 c7 00 movb [=12=]x0,-0x39(%rbp)
bcc: b8 00 00 00 00 mov [=12=]x0,%eax
bd1: 0f b6 c0 movzbl %al,%eax
bd4: 89 c6 mov %eax,%esi
bd6: bf 01 00 00 00 mov [=12=]x1,%edi
bdb: e8 00 fe ff ff callq 9e0 <JLI_InitArgProcessing@plt>
be0: 8b 45 bc mov -0x44(%rbp),%eax
be3: 83 c0 01 add [=12=]x1,%eax
be6: 48 98 cltq
be8: 48 89 c7 mov %rax,%rdi
beb: e8 20 fe ff ff callq a10 <JLI_List_new@plt>
bf0: 48 89 45 d8 mov %rax,-0x28(%rbp)
bf4: c7 45 c8 00 00 00 00 movl [=12=]x0,-0x38(%rbp)
bfb: 48 8b 45 b0 mov -0x50(%rbp),%rax
bff: 48 8b 00 mov (%rax),%rax
c02: 48 89 c7 mov %rax,%rdi
c05: e8 36 fe ff ff callq a40 <JLI_StringDup@plt>
c0a: 48 89 c2 mov %rax,%rdx
c0d: 48 8b 45 d8 mov -0x28(%rbp),%rax
c11: 48 89 d6 mov %rdx,%rsi
c14: 48 89 c7 mov %rax,%rdi
c17: e8 44 fe ff ff callq a60 <JLI_List_add@plt>
c1c: 48 8b 45 d8 mov -0x28(%rbp),%rax
c20: 48 8d 35 bf 02 00 00 lea 0x2bf(%rip),%rsi # ee6 <const_disable_argfile+0x1>
c27: 48 89 c7 mov %rax,%rdi
c2a: e8 01 fe ff ff callq a30 <JLI_AddArgsFromEnvVar@plt>
c2f: 84 c0 test %al,%al
c31: 74 47 je c7a <main+0xd0>
c33: 48 8d 3d bd 02 00 00 lea 0x2bd(%rip),%rdi # ef7 <const_disable_argfile+0x12>
c3a: e8 b1 fd ff ff callq 9f0 <getenv@plt>
c3f: 48 85 c0 test %rax,%rax
c42: 74 36 je c7a <main+0xd0>
c44: 48 8d 3d c1 02 00 00 lea 0x2c1(%rip),%rdi # f0c <const_disable_argfile+0x27>
c4b: e8 a0 fd ff ff callq 9f0 <getenv@plt>
c50: 48 89 45 e0 mov %rax,-0x20(%rbp)
c54: 48 83 7d e0 00 cmpq [=12=]x0,-0x20(%rbp)
c59: 74 1f je c7a <main+0xd0>
c5b: 48 8b 45 e0 mov -0x20(%rbp),%rax
c5f: 48 89 c2 mov %rax,%rdx
c62: 48 8d 35 a3 02 00 00 lea 0x2a3(%rip),%rsi # f0c <const_disable_argfile+0x27>
c69: 48 8d 3d aa 02 00 00 lea 0x2aa(%rip),%rdi # f1a <const_disable_argfile+0x35>
c70: b8 00 00 00 00 mov [=12=]x0,%eax
c75: e8 06 fe ff ff callq a80 <JLI_ReportMessage@plt>
c7a: c7 45 c8 01 00 00 00 movl [=12=]x1,-0x38(%rbp)
c81: e9 c2 00 00 00 jmpq d48 <main+0x19e>
c86: 8b 45 c8 mov -0x38(%rbp),%eax
c89: 48 98 cltq
c8b: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx
c92: 00
c93: 48 8b 45 b0 mov -0x50(%rbp),%rax
c97: 48 01 d0 add %rdx,%rax
c9a: 48 8b 00 mov (%rax),%rax
c9d: 48 89 c7 mov %rax,%rdi
ca0: e8 5b fd ff ff callq a00 <JLI_PreprocessArg@plt>
ca5: 48 89 45 f0 mov %rax,-0x10(%rbp)
ca9: 48 83 7d f0 00 cmpq [=12=]x0,-0x10(%rbp)
cae: 75 33 jne ce3 <main+0x139>
cb0: 8b 45 c8 mov -0x38(%rbp),%eax
cb3: 48 98 cltq
cb5: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx
cbc: 00
cbd: 48 8b 45 b0 mov -0x50(%rbp),%rax
cc1: 48 01 d0 add %rdx,%rax
cc4: 48 8b 00 mov (%rax),%rax
cc7: 48 89 c7 mov %rax,%rdi
cca: e8 71 fd ff ff callq a40 <JLI_StringDup@plt>
ccf: 48 89 c2 mov %rax,%rdx
cd2: 48 8b 45 d8 mov -0x28(%rbp),%rax
cd6: 48 89 d6 mov %rdx,%rsi
cd9: 48 89 c7 mov %rax,%rdi
cdc: e8 7f fd ff ff callq a60 <JLI_List_add@plt>
ce1: eb 61 jmp d44 <main+0x19a>
ce3: 48 8b 45 f0 mov -0x10(%rbp),%rax
ce7: 48 8b 40 08 mov 0x8(%rax),%rax
ceb: 89 45 d4 mov %eax,-0x2c(%rbp)
cee: c7 45 cc 00 00 00 00 movl [=12=]x0,-0x34(%rbp)
cf5: eb 2a jmp d21 <main+0x177>
cf7: 48 8b 45 f0 mov -0x10(%rbp),%rax
cfb: 48 8b 00 mov (%rax),%rax
cfe: 8b 55 cc mov -0x34(%rbp),%edx
d01: 48 63 d2 movslq %edx,%rdx
d04: 48 c1 e2 03 shl [=12=]x3,%rdx
d08: 48 01 d0 add %rdx,%rax
d0b: 48 8b 10 mov (%rax),%rdx
d0e: 48 8b 45 d8 mov -0x28(%rbp),%rax
d12: 48 89 d6 mov %rdx,%rsi
d15: 48 89 c7 mov %rax,%rdi
d18: e8 43 fd ff ff callq a60 <JLI_List_add@plt>
d1d: 83 45 cc 01 addl [=12=]x1,-0x34(%rbp)
d21: 8b 45 cc mov -0x34(%rbp),%eax
d24: 3b 45 d4 cmp -0x2c(%rbp),%eax
d27: 7c ce jl cf7 <main+0x14d>
d29: 48 8b 45 f0 mov -0x10(%rbp),%rax
d2d: 48 8b 00 mov (%rax),%rax
d30: 48 89 c7 mov %rax,%rdi
d33: e8 38 fd ff ff callq a70 <JLI_MemFree@plt>
d38: 48 8b 45 f0 mov -0x10(%rbp),%rax
d3c: 48 89 c7 mov %rax,%rdi
d3f: e8 2c fd ff ff callq a70 <JLI_MemFree@plt>
d44: 83 45 c8 01 addl [=12=]x1,-0x38(%rbp)
d48: 8b 45 c8 mov -0x38(%rbp),%eax
d4b: 3b 45 bc cmp -0x44(%rbp),%eax
d4e: 0f 8c 32 ff ff ff jl c86 <main+0xdc>
d54: 48 8b 45 d8 mov -0x28(%rbp),%rax
d58: 48 8b 40 08 mov 0x8(%rax),%rax
d5c: 89 45 d0 mov %eax,-0x30(%rbp)
d5f: 48 8b 45 d8 mov -0x28(%rbp),%rax
d63: be 00 00 00 00 mov [=12=]x0,%esi
d68: 48 89 c7 mov %rax,%rdi
d6b: e8 f0 fc ff ff callq a60 <JLI_List_add@plt>
d70: 48 8b 45 d8 mov -0x28(%rbp),%rax
d74: 48 8b 00 mov (%rax),%rax
d77: 48 89 45 e8 mov %rax,-0x18(%rbp)
d7b: 44 0f b6 4d c7 movzbl -0x39(%rbp),%r9d
d80: b8 01 00 00 00 mov [=12=]x1,%eax
d85: 44 0f b6 c0 movzbl %al,%r8d
d89: 48 8b 05 d8 12 20 00 mov 0x2012d8(%rip),%rax # 202068 <const_launcher>
d90: 48 85 c0 test %rax,%rax
d93: 75 09 jne d9e <main+0x1f4>
d95: 48 8b 45 e8 mov -0x18(%rbp),%rax
d99: 48 8b 10 mov (%rax),%rdx
d9c: eb 07 jmp da5 <main+0x1fb>
d9e: 48 8b 15 c3 12 20 00 mov 0x2012c3(%rip),%rdx # 202068 <const_launcher>
da5: 48 8b 05 b4 12 20 00 mov 0x2012b4(%rip),%rax # 202060 <const_progname>
dac: 48 85 c0 test %rax,%rax
daf: 75 09 jne dba <main+0x210>
db1: 48 8b 45 e8 mov -0x18(%rbp),%rax
db5: 48 8b 00 mov (%rax),%rax
db8: eb 07 jmp dc1 <main+0x217>
dba: 48 8b 05 9f 12 20 00 mov 0x20129f(%rip),%rax # 202060 <const_progname>
dc1: 48 8b 0d b0 12 20 00 mov 0x2012b0(%rip),%rcx # 202078 <const_jargs>
dc8: 48 8b 75 e8 mov -0x18(%rbp),%rsi
dcc: 8b 7d d0 mov -0x30(%rbp),%edi
dcf: 6a 00 pushq [=12=]x0
dd1: 41 51 push %r9
dd3: 41 50 push %r8
dd5: 6a 00 pushq [=12=]x0
dd7: 52 push %rdx
dd8: 50 push %rax
dd9: 48 8d 05 51 01 00 00 lea 0x151(%rip),%rax # f31 <const_disable_argfile+0x4c>
de0: 50 push %rax
de1: 48 8d 05 4d 01 00 00 lea 0x14d(%rip),%rax # f35 <const_disable_argfile+0x50>
de8: 50 push %rax
de9: 41 b9 00 00 00 00 mov [=12=]x0,%r9d
def: 41 b8 00 00 00 00 mov [=12=]x0,%r8d
df5: ba 01 00 00 00 mov [=12=]x1,%edx
dfa: e8 51 fc ff ff callq a50 <JLI_Launch@plt>
dff: 48 83 c4 40 add [=12=]x40,%rsp
e03: 48 8b 4d f8 mov -0x8(%rbp),%rcx
e07: 64 48 33 0c 25 28 00 xor %fs:0x28,%rcx
e0e: 00 00
e10: 74 05 je e17 <main+0x26d>
e12: e8 09 fc ff ff callq a20 <__stack_chk_fail@plt>
e17: c9 leaveq
e18: c3 retq
e19: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
0000000000000e20 <__libc_csu_init>:
e20: 41 57 push %r15
e22: 41 56 push %r14
e24: 41 89 ff mov %edi,%r15d
e27: 41 55 push %r13
e29: 41 54 push %r12
e2b: 4c 8d 25 e6 0e 20 00 lea 0x200ee6(%rip),%r12 # 201d18 <__frame_dummy_init_array_entry>
e32: 55 push %rbp
e33: 48 8d 2d e6 0e 20 00 lea 0x200ee6(%rip),%rbp # 201d20 <__init_array_end>
e3a: 53 push %rbx
e3b: 49 89 f6 mov %rsi,%r14
e3e: 49 89 d5 mov %rdx,%r13
e41: 4c 29 e5 sub %r12,%rbp
e44: 48 83 ec 08 sub [=12=]x8,%rsp
e48: 48 c1 fd 03 sar [=12=]x3,%rbp
e4c: e8 5f fb ff ff callq 9b0 <_init>
e51: 48 85 ed test %rbp,%rbp
e54: 74 20 je e76 <__libc_csu_init+0x56>
e56: 31 db xor %ebx,%ebx
e58: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
e5f: 00
e60: 4c 89 ea mov %r13,%rdx
e63: 4c 89 f6 mov %r14,%rsi
e66: 44 89 ff mov %r15d,%edi
e69: 41 ff 14 dc callq *(%r12,%rbx,8)
e6d: 48 83 c3 01 add [=12=]x1,%rbx
e71: 48 39 dd cmp %rbx,%rbp
e74: 75 ea jne e60 <__libc_csu_init+0x40>
e76: 48 83 c4 08 add [=12=]x8,%rsp
e7a: 5b pop %rbx
e7b: 5d pop %rbp
e7c: 41 5c pop %r12
e7e: 41 5d pop %r13
e80: 41 5e pop %r14
e82: 41 5f pop %r15
e84: c3 retq
e85: 90 nop
e86: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
e8d: 00 00 00
0000000000000e90 <__libc_csu_fini>:
e90: f3 c3 repz retq
Disassembly of section .fini:
0000000000000e94 <_fini>:
e94: 48 83 ec 08 sub [=12=]x8,%rsp
e98: 48 83 c4 08 add [=12=]x8,%rsp
e9c: c3 retq
wxf@wxf:/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/jdk/bin$
显然,它并不完整。 Source code 包含比上面更多的代码,例如垃圾收集。
那么,如何使用objdump反汇编OpenJDK(bin/java)呢?我需要破解 JVM 中的 GC 部分。
Java程序链接到其他程序文件,可以用ldd查看Java需要的共享库。
dexter@dextercd ~ % ldd /usr/bin/java
linux-vdso.so.1 (0x00007ffea42ec000)
libjli.so => not found
libc.so.6 => /usr/bin/../lib/libc.so.6 (0x00007f3002e60000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f300341a000)
在这种情况下 libjli.so
可能包含更多 Java 的运行时代码。
java
binary 是一个简单的启动器。那里没有 JVM 代码。你需要的是libjvm.so
.
详情见this answer。