;35 : DExtend de; - - - - - - main栈 - - - - - - 0x401369 lea -0x10(%ebp),%eax 0x40136c mov %eax,%ecx 0x40136e call 0x438628 <DExtend::DExtend()> //定义时调用空构造函数 0x40138a lea -0x10(%ebp),%eax 0x40138d mov %eax,%ecx 0x40138f call 0x438640 <DExtend::~DExtend()> //退出时调用析构函数 0x401394 mov %ebx,%eax ;36 : de.showNumber(agrc); 0x401373 lea -0x10(%ebp),%eax 0x401376 mov (%ebx),%edx //传入第一个形参 0x401378 mov %edx,(%esp) 0x40137b mov %eax,%ecx 0x40137d call 0x4385c8 <DExtend::showNumber(int)> //调用showNumber函数 0x401382 sub $0x4,%esp
;22 : class DExtend: public CBase { 0x438628 push %ebp 0x438629 mov %esp,%ebp 0x43862b sub $0x18,%esp 0x43862e mov %ecx,-0xc(%ebp) // 0x438631 mov -0xc(%ebp),%eax 0x438634 mov %eax,%ecx 0x438636 call 0x438598 <CBase::CBase()> //调用父类构造函数 0x43863b nop 0x43863c leave 0x43863d ret
;7 : CBase() { 0x438598 push %ebp 0x438599 mov %esp,%ebp 0x43859b sub $0x28,%esp 0x43859e mov %ecx,-0xc(%ebp) ;8 : printf("CBase...\n"); 0x4385a1 movl $0x4b9024,(%esp) 0x4385a8 call 0x430b30 <puts> //调用无参打印函数puts ;9 : } 0x4385ad nop 0x4385ae leave 0x4385af ret
;24 : void showNumber(int number) { 0x4385c8 push %ebp 0x4385c9 mov %esp,%ebp 0x4385cb sub $0x28,%esp 0x4385ce mov %ecx,-0xc(%ebp) ;25 : setNumber(number); 0x4385d1 mov -0xc(%ebp),%eax 0x4385d4 mov 0x8(%ebp),%edx //传入形参一 0x4385d7 mov %edx,(%esp) 0x4385da mov %eax,%ecx 0x4385dc call 0x438580 <CBase::setNumber(int)> 调用setNumber 0x4385e1 sub $0x4,%esp ;26 : dNumber = number + 1; 0x4385e4 mov 0x8(%ebp),%eax 0x4385e7 lea 0x1(%eax),%edx //传入形参一+1的结果 0x4385ea mov -0xc(%ebp),%eax 0x4385ed mov %edx,0x4(%eax) //传给类变量dNumber ;27 : printf("cNumber: %d\n", getNumber()); 0x4385f0 mov -0xc(%ebp),%eax 0x4385f3 mov %eax,%ecx 0x4385f5 call 0x438570 <CBase::getNumber()> //调用getNumber 0x4385fa mov %eax,0x4(%esp) //传入getNumber返回值 0x4385fe movl $0x4b9037,(%esp) 0x438605 call 0x430b38 <printf> ;28 : printf("dNumber: %d\n", dNumber); 0x43860a mov -0xc(%ebp),%eax 0x43860d mov 0x4(%eax),%eax //取类变量dNumber 0x438610 mov %eax,0x4(%esp) 0x438614 movl $0x4b9044,(%esp) 0x43861b call 0x430b38 <printf> ;29 : } 0x438620 nop 0x438621 leave 0x438622 ret $0x4
;13 : void setNumber(int number) { 0x438580 push %ebp 0x438581 mov %esp,%ebp 0x438583 sub $0x4,%esp 0x438586 mov %ecx,-0x4(%ebp) ;14 : cNumber = number; 0x438589 mov -0x4(%ebp),%eax 0x43858c mov 0x8(%ebp),%edx 0x43858f mov %edx,(%eax) ;15 : } 0x438591 nop 0x438592 leave 0x438593 ret $0x4
;16 : int getNumber() { 0x438570 push %ebp 0x438571 mov %esp,%ebp 0x438573 sub $0x4,%esp 0x438576 mov %ecx,-0x4(%ebp) ;17 : return cNumber; 0x438579 mov -0x4(%ebp),%eax 0x43857c mov (%eax),%eax ;18 : } 0x43857e leave 0x43857f ret
原文地址:https://www.cnblogs.com/reverse201/p/10360681.html
时间: 2024-10-16 01:02:55