忍者ブログ
趣味+メモ用のブログです。 GNU/Linux関連、OSS関連情報、調査事項になるでしょうが、何を書くか分かりません。
[76] [75] [74] [73] [72] [71] [70] [69] [68] [67] [66]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

gccでのディスアセンブル方法


<使用方法>
「objdump -d -C」を使用する。
お好みにより「-S -x」も併用。

「-d」ディスアセンブルオプション (-Dもある)
「-C」デマングルオプション    (C++関数名をわかりやすく)
「-S」ソースコメントも同時に表示 (コンパイル時に -g必要)
「-x」オブジェクトのヘッダー情報出力

<出力例>
typevalue:     file format elf32-i386
・・・
0804859c <main>:
 804859c: 55                   push   %ebp
 804859d: 89 e5                 mov    %esp,%ebp
 804859f: 83 e4 f0             and    $0xfffffff0,%esp
 80485a2: 83 ec 20             sub    $0x20,%esp
 80485a5: c7 44 24 04 78 56 34 movl   $0x12345678,0x4(%esp)
 80485ac: 12 
 80485ad: 8d 44 24 1c           lea    0x1c(%esp),%eax
 80485b1: 89 04 24             mov    %eax,(%esp)
 80485b4: e8 63 00 00 00       call   804861c <TypeValue<int>::TypeValue(int)>
 80485b9: c7 44 24 04 34 12 00 movl   $0x1234,0x4(%esp)
 80485c0: 00 
 80485c1: 8d 44 24 1a           lea    0x1a(%esp),%eax
 80485c5: 89 04 24             mov    %eax,(%esp)
 80485c8: e8 6b 00 00 00       call   8048638 <TypeValue<short>::TypeValue(short)>
 80485cd: c7 44 24 04 12 00 00 movl   $0x12,0x4(%esp)
 80485d4: 00 
 80485d5: 8d 44 24 19           lea    0x19(%esp),%eax
 80485d9: 89 04 24             mov    %eax,(%esp)
 80485dc: e8 7b 00 00 00       call   804865c <TypeValue<char>::TypeValue(char)>
 80485e1: 8d 44 24 1c           lea    0x1c(%esp),%eax
 80485e5: 89 04 24             mov    %eax,(%esp)
 80485e8: e8 91 00 00 00       call   804867e <void printTypeValue<int>(TypeValueBase*)>
 80485ed: 8d 44 24 1a           lea    0x1a(%esp),%eax
 80485f1: 89 04 24             mov    %eax,(%esp)
 80485f4: e8 c3 00 00 00       call   80486bc <void printTypeValue<short>(TypeValueBase*)>
 80485f9: 8d 44 24 19           lea    0x19(%esp),%eax
 80485fd: 89 04 24             mov    %eax,(%esp)
 8048600: e8 f7 00 00 00       call   80486fc <void printTypeValue<char>(TypeValueBase*)>
 8048605: b8 00 00 00 00       mov    $0x0,%eax
 804860a: eb 08                 jmp    8048614 <main+0x78>
 804860c: 89 04 24             mov    %eax,(%esp)
 804860f: e8 8c fe ff ff       call   80484a0 <_Unwind_Resume@plt>
 8048614: c9                   leave  
 8048615: c3                   ret    
08048616 <TypeValueBase::TypeValueBase()>:
 8048616: 55                   push   %ebp
 8048617: 89 e5                 mov    %esp,%ebp
 8048619: 5d                   pop    %ebp
 804861a: c3                   ret    
 804861b: 90                   nop
0804861c <TypeValue<int>::TypeValue(int)>:
 804861c: 55                   push   %ebp
 804861d: 89 e5                 mov    %esp,%ebp
 804861f: 83 ec 18             sub    $0x18,%esp
 8048622: 8b 45 08             mov    0x8(%ebp),%eax
 8048625: 89 04 24             mov    %eax,(%esp)
 8048628: e8 e9 ff ff ff       call   8048616 <TypeValueBase::TypeValueBase()>
 804862d: 8b 45 08             mov    0x8(%ebp),%eax
 8048630: 8b 55 0c             mov    0xc(%ebp),%edx
 8048633: 89 10                 mov    %edx,(%eax)
 8048635: c9                   leave  
 8048636: c3                   ret    
 8048637: 90                   nop
08048638 <TypeValue<short>::TypeValue(short)>:
 8048638: 55                   push   %ebp
 8048639: 89 e5                 mov    %esp,%ebp
 804863b: 83 ec 28             sub    $0x28,%esp
 804863e: 8b 45 0c             mov    0xc(%ebp),%eax
 8048641: 66 89 45 f4           mov    %ax,-0xc(%ebp)
 8048645: 8b 45 08             mov    0x8(%ebp),%eax
 8048648: 89 04 24             mov    %eax,(%esp)
 804864b: e8 c6 ff ff ff       call   8048616 <TypeValueBase::TypeValueBase()>
 8048650: 8b 45 08             mov    0x8(%ebp),%eax
 8048653: 0f b7 55 f4           movzwl -0xc(%ebp),%edx
 8048657: 66 89 10             mov    %dx,(%eax)
 804865a: c9                   leave  
 804865b: c3                   ret    
・・・
080487a0 <__libc_csu_fini>:
 80487a0: 55                   push   %ebp
 80487a1: 89 e5                 mov    %esp,%ebp
 80487a3: 5d                   pop    %ebp
 80487a4: c3                   ret    
 80487a5: 8d 74 26 00           lea    0x0(%esi,%eiz,1),%esi
 80487a9: 8d bc 27 00 00 00 00 lea    0x0(%edi,%eiz,1),%edi
080487b0 <__libc_csu_init>:
 80487b0: 55                   push   %ebp
 80487b1: 89 e5                 mov    %esp,%ebp
 80487b3: 57                   push   %edi
 80487b4: 56                   push   %esi
 80487b5: 53                   push   %ebx
 80487b6: e8 4f 00 00 00       call   804880a <__i686.get_pc_thunk.bx>
 80487bb: 81 c3 5d 14 00 00     add    $0x145d,%ebx
 80487c1: 83 ec 1c             sub    $0x1c,%esp
 80487c4: e8 5b fc ff ff       call   8048424 <_init>
 80487c9: 8d bb ec fe ff ff     lea    -0x114(%ebx),%edi
 80487cf: 8d 83 e8 fe ff ff     lea    -0x118(%ebx),%eax
 80487d5: 29 c7                 sub    %eax,%edi
 80487d7: c1 ff 02             sar    $0x2,%edi
 80487da: 85 ff                 test   %edi,%edi
 80487dc: 74 24                 je     8048802 <__libc_csu_init+0x52>
 80487de: 31 f6                 xor    %esi,%esi
 80487e0: 8b 45 10             mov    0x10(%ebp),%eax
 80487e3: 89 44 24 08           mov    %eax,0x8(%esp)
 80487e7: 8b 45 0c             mov    0xc(%ebp),%eax
 80487ea: 89 44 24 04           mov    %eax,0x4(%esp)
 80487ee: 8b 45 08             mov    0x8(%ebp),%eax
 80487f1: 89 04 24             mov    %eax,(%esp)
 80487f4: ff 94 b3 e8 fe ff ff call   *-0x118(%ebx,%esi,4)
 80487fb: 83 c6 01             add    $0x1,%esi
 80487fe: 39 fe                 cmp    %edi,%esi
 8048800: 72 de                 jb     80487e0 <__libc_csu_init+0x30>
 8048802: 83 c4 1c             add    $0x1c,%esp
 8048805: 5b                   pop    %ebx
 8048806: 5e                   pop    %esi
 8048807: 5f                   pop    %edi
 8048808: 5d                   pop    %ebp
 8048809: c3                   ret    
0804880a <__i686.get_pc_thunk.bx>:
 804880a: 8b 1c 24             mov    (%esp),%ebx
 804880d: c3                   ret    
 804880e: 90                   nop
 804880f: 90                   nop
Disassembly of section .fini:
08048810 <_fini>:
 8048810: 55                   push   %ebp
 8048811: 89 e5                 mov    %esp,%ebp
 8048813: 53                   push   %ebx
 8048814: 83 ec 04             sub    $0x4,%esp
 8048817: e8 00 00 00 00       call   804881c <_fini+0xc>
 804881c: 5b                   pop    %ebx
 804881d: 81 c3 fc 13 00 00     add    $0x13fc,%ebx
 8048823: 59                   pop    %ecx
 8048824: 5b                   pop    %ebx
 8048825: c9                   leave  
 8048826: c3                   ret    



PR


忍者ブログ [PR]
カレンダー
04 2024/05 06
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
フリーエリア
最新コメント
最新トラックバック
プロフィール
HN:
一乗寺 又兵衛
性別:
男性
職業:
コンパイル
趣味:
コンパイル
バーコード
ブログ内検索