Assembly language is giving me headaches.
Is there an easy way to identify arguments and variables with assembly language?In the example below how can I figure oout the value(s) that prairieDog() obtains as arguments from main()? also, how can I identify the registers where they passed?
I am having a hard time understand how to identify How many local variables does prairieDog() example have? and where are these local variables the stack?
Dump of assembler code for function prairieDog:
(gdb) disass prairieDog
Dump of assembler code for function prairieDog:
0x0000000000400506 <+0>: push %rbp
0x0000000000400507 <+1>: mov %rsp,%rbp
0x000000000040050a <+4>: sub $0x18,%rsp
0x000000000040050e <+8>: mov %edi,-0x14(%rbp)
0x0000000000400511 <+11>: mov %esi,-0x18(%rbp)
0x0000000000400514 <+14>: movl $0x0,-0x4(%rbp)
0x000000000040051b <+21>: mov -0x14(%rbp),%eax
0x000000000040051e <+24>: mov %eax,-0x8(%rbp)
0x0000000000400521 <+27>: jmp 0x400534 <prairieDog+46>
0x0000000000400523 <+29>: mov -0x8(%rbp),%eax
0x0000000000400526 <+32>: mov %eax,%edi
0x0000000000400528 <+34>: callq 0x4004ed <meerkat>
0x000000000040052d <+39>: add %eax,-0x4(%rbp)
0x0000000000400530 <+42>: addl $0x2,-0x8(%rbp)
0x0000000000400534 <+46>: mov -0x8(%rbp),%eax
0x0000000000400537 <+49>: cmp -0x18(%rbp),%eax
0x000000000040053a <+52>: jle 0x400523 <prairieDog+29>
0x000000000040053c <+54>: mov -0x4(%rbp),%eax
0x000000000040053f <+57>: leaveq
0x0000000000400540 <+58>: retq
End of assembler dump.