main函数 ;15 : { 0x40137a push %ebp 0x40137b mov %esp,%ebp 0x40137d and $0xfffffff0,%esp 0x401380 sub $0x60,%esp 0x401383 call 0x427130 <__main> ;16 : A a; ;17 : a.a = 1; 0x401388 movl $0x1,0x38(%esp) ;18 : a.b = 2; 0x401390 movl $0x2,0x3c(%esp) ;19 : strcpy(a.c, "this is question"); 0x401398 lea 0x38(%esp),%eax 0x40139c add $0x8,%eax 0x40139f movl $0x73696874,(%eax) 0x4013a5 movl $0x20736920,0x4(%eax) 0x4013ac movl $0x73657571,0x8(%eax) 0x4013b3 movl $0x6e6f6974,0xc(%eax) 0x4013ba movb $0x0,0x10(%eax) ;20 : printAll(a); 0x4013be mov 0x38(%esp),%eax //下面0x8字节为参数a和参数b 0x4013c2 mov %eax,(%esp) 0x4013c5 mov 0x3c(%esp),%eax 0x4013c9 mov %eax,0x4(%esp) 0x4013cd mov 0x40(%esp),%eax //下面0x20字节为字符数组c有的+没的 0x4013d1 mov %eax,0x8(%esp) 0x4013d5 mov 0x44(%esp),%eax 0x4013d9 mov %eax,0xc(%esp) 0x4013dd mov 0x48(%esp),%eax 0x4013e1 mov %eax,0x10(%esp) 0x4013e5 mov 0x4c(%esp),%eax 0x4013e9 mov %eax,0x14(%esp) 0x4013ed mov 0x50(%esp),%eax 0x4013f1 mov %eax,0x18(%esp) 0x4013f5 mov 0x54(%esp),%eax 0x4013f9 mov %eax,0x1c(%esp) 0x4013fd mov 0x58(%esp),%eax 0x401401 mov %eax,0x20(%esp) 0x401405 mov 0x5c(%esp),%eax 0x401409 mov %eax,0x24(%esp) 0x40140d call 0x401350 <printAll(A)> ;21 : return 0; 0x401412 mov $0x0,%eax ;22 : } 0x401417 leave 0x401418 ret
printAll函数 ;11 : void printAll(A a) { 0x401350 push %ebp 0x401351 mov %esp,%ebp 0x401353 sub $0x18,%esp //变量总数据长度为0x18字节 ;12 : printf("%d,%d %s\n", a.a, a.b, a.c); 0x401356 mov 0xc(%ebp),%edx //此处edx = 2 0x401359 mov 0x8(%ebp),%eax //此处eax = 1 0x40135c lea 0x10(%ebp),%ecx //此处ecx为字符数组首地址 0x40135f mov %ecx,0xc(%esp) 0x401363 mov %edx,0x8(%esp) 0x401367 mov %eax,0x4(%esp) 0x40136b movl $0x4b9025,(%esp) 0x401372 call 0x4b5890 <printf(char const*, ...)> ;13 : } 0x401377 nop 0x401378 leave 0x401379 ret
原文地址:https://www.cnblogs.com/reverse201/p/10325886.html
时间: 2024-10-16 01:02:56