正在加载图片...
Problem 3. 24(P208 char getline Ot char buf [8] A fill in the diagram that follows. (after strlen(buf)+1 executing the instruction at line 6) char *result: gets(buf) 返回地址 result= malloc(strlen(buf) bf ff fc 94 呆存‰ebp strcpy(result, buf) buff return result result = null? buff0-31 2. push %ebp 3. mov %esp, %ebp 00000001 保存%esi 4.sub$0×10,%esp 00000002 呆存%ebX 5. push %esi 6. push %ebx 7. add $Oxfffffff4, %esp B. modify your diagram to show the effect of 8. lea Oxfffffff8(%ebp),%ebx the call to gets(line 10) 9. push %ebx 08048600 10. call 80483ac< init +0x50> 31303938 363534 returpadcre The return addr of getline is 0X8048643 %ebp equal to Oxbffffc94 D. What register(s have corrupted' value(s) when getline returns? %esi equal to Ox1, %ebx equal to Ox2 E what two other things are wrong for getline? Type in:"012345678901Problem 3.24 (P208) char *getline(){ char buf[8]; char *result; gets(buf); result = malloc(strlen(buf)); strcpy(result, buf); return result; } 2. push %ebp 3. mov %esp, %ebp 4. sub $0x10, %esp 5. push %esi 6. push %ebx ----- 7. add $0xfffffff4, %esp 8. lea 0xfffffff8(%ebp), %ebx 9. push %ebx 10.call 80483ac <_init + 0x50> The return addr of getline() is 0x8048643, %ebp equal to 0xbffffc94, %esi equal to 0x1, %ebx equal to 0x2. Type in : "012345678901" A. fill in the diagram that follows.(after executing the instruction at line 6). 08 04 86 43 bf ff fc 94 00 00 00 01 00 00 00 02 返回地址 保存%ebp buf[4-7] buf[0-3] 保存%esi 保存%ebx B. modify your diagram to show the effect of the call to gets(line 10). 08 04 86 00 31 30 39 38 37 36 35 34 33 32 31 30 C. new return address? D. what register(s) have corrupted value(s) when getline returns? E. what two other things are wrong for getline? strlen(buf)+1 result == null?
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有