Windows DatabaseebooksStatistical Information

LLE10208 : Howto disassemble C/C++ code with gdb to have a look at it?


You would like to disasemble a program or function with gdb




To disassemble you first need to run gdb with the program as a parameter. Now you can use the command disas to start showing assembler code for certain functions.


disas main

(gdb) disas main
Dump of assembler code for function main:
0x00401d98 <main+0>:    push   %ebp
0x00401d99 <main+1>:    mov    $0x10,%eax
0x00401d9e <main+6>:    mov    %esp,%ebp
0x00401da0 <main+8>:    push   %ebx
0x00401da1 <main+9>:    sub    $0x64,%esp
0x00401da4 <main+12>:   and    $0xfffffff0,%esp
0x00401da7 <main+15>:   call   0x407cb4 <_alloca>
0x00401dac <main+20>:   call   0x401f48 <__main>
0x00401db1 <main+25>:   call   0x40800c <GetCommandLineA@0>
0x00401db6 <main+30>:   mov    %eax,%ebx
0x00401db8 <main+32>:   lea    -0x58(%ebp),%eax
0x00401dbb <main+35>:   mov    %eax,(%esp)
0x00401dbe <main+38>:   call   0x408004 <GetStartupInfoA@4>
0x00401dc3 <main+43>:   sub    $0x4,%esp
0x00401dc6 <main+46>:   test   %ebx,%ebx
0x00401dc8 <main+48>:   jne    0x401dd0 <main+56>
0x00401dca <main+50>:   jmp    0x401e6c <main+212>

Here you can see what the assembler code of the main fucntion looks like.


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!
Copyright © 2004-2016 Lubby (V3.0.11 Jan 2016)
Sponsored by Keskon.
Datenschutzerklaerung - Privacy statement - Privacyverklaring