Saturday, September 24, 2016

Intel Assembly Basics GCC and GDB Disassembly

Intel Assembly Basics

I want to write a C program in linux and see what X86 assembly it generates. Let's try this.

nano increment.c

int main(){
  int x = 15;

gcc -mpreffered-stack-boundary=2 --ggdb increment.c -o increment

gdb ~/increment

(gdb) disas main

Dump of assembler code for function main:
  0x080483bb <+0>: push %ebp
  0x080483bc <+1>: mov %esp,%ebp
  0x080483be <+3>: sub $0x4,%esp
  0x080483c1 <+6>: movl $0xf,-0x4(%ebp)
  0x080483c8 <+13>: addl $0x1,-0x4(%ebp)
  0x080483cc <+17>: mov $0x0,%eax
  0x080483d1 <+22>: leave
  0x080483d2 <+23>: ret
End of assembler dump.

More about neonprimetime

Top Blogs of all-time
  1. pagerank botnet sql injection walk-thru
  2. DOM XSS 101 Walk-Through
  3. An Invoice email and a Hot mess of Java

Top Github Contributions
  1. Qualys Scantronitor 2.0

Copyright © 2016, this post cannot be reproduced or retransmitted in any form without reference to the original post.

No comments:

Post a Comment