Skip to content

Instantly share code, notes, and snippets.

@jpf91
Created February 22, 2013 12:13
Show Gist options
  • Save jpf91/5013037 to your computer and use it in GitHub Desktop.
Save jpf91/5013037 to your computer and use it in GitHub Desktop.
; AT&T syntax
Dump of assembler code for function _Dmain:
0x0805c3ac <+0>: push %ebp
0x0805c3ad <+1>: mov %esp,%ebp
0x0805c3af <+3>: sub $0x8,%esp
0x0805c3b2 <+6>: push %ebx
0x0805c3b3 <+7>: push %esi
0x0805c3b4 <+8>: push %edi
0x0805c3b5 <+9>: movl $0x2a,-0x8(%ebp) ;d = Date(42)
0x0805c3bc <+16>: lea -0x8(%ebp),%eax
0x0805c3bf <+19>: push %eax
0x0805c3c0 <+20>: lea -0x4(%ebp),%eax
0x0805c3c3 <+23>: call 0x805c328 <_D6dmdasm4Date8__cpctorMxFKxS6dmdasm4DateZv> ;void cpctpr(Date* this, ref const Date src), why is src passed on stack?
0x0805c3c8 <+28>: mov -0x4(%ebp),%eax ;pass in eax?
0x0805c3cb <+31>: call 0x805c394 <_D6dmdasm4funcFS6dmdasm4DateZv> ;call func(Date)
0x0805c3d0 <+36>: call 0x805c3d7 <_Dmain+43> ;call dtor via stub?
0x0805c3d5 <+41>: jmp 0x805c3e0 <_Dmain+52> ;skip over stub
0x0805c3d7 <+43>: lea -0x8(%ebp),%eax ;stub
0x0805c3da <+46>: call 0x805c2f4 <_D6dmdasm4Date6__dtorMFZv> ;stub
0x0805c3df <+51>: ret ;stub
0x0805c3e0 <+52>: xor %eax,%eax
0x0805c3e2 <+54>: pop %edi
0x0805c3e3 <+55>: pop %esi
0x0805c3e4 <+56>: pop %ebx
0x0805c3e5 <+57>: leave
0x0805c3e6 <+58>: ret
Dump of assembler code for function _D6dmdasm4funcFS6dmdasm4DateZv:
0x0805c394 <+0>: push %ebp
0x0805c395 <+1>: mov %esp,%ebp
0x0805c397 <+3>: sub $0x4,%esp
0x0805c39a <+6>: mov %eax,-0x4(%ebp) ;put parameter on stack
0x0805c39d <+9>: incl -0x4(%ebp) ;increment, d.data++
0x0805c3a0 <+12>: lea -0x4(%ebp),%eax ;load address of (Date)d to call dtor
0x0805c3a3 <+15>: call 0x805c2f4 <_D6dmdasm4Date6__dtorMFZv>
0x0805c3a8 <+20>: leave
0x0805c3a9 <+21>: ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment