使用gdb查看栈帧的情况,有ebp

0x7fffffffdb30:    0x00000000    0x00000000    0xf7ffe700    0x0000001a
0x7fffffffdb40:    0xffffdc98    0x00007fff    0xf7de1b1f    0x00007fff
0x7fffffffdb50:    0xffffdb70    0x00007fff    0x004005b7    0x00000000
0x7fffffffdb60:    0x00000000    0x00000000    0x00000000    0x0000001a  <-------funcb的栈帧[0x7ffffffdb60, 0x7fffffffdb80], 其中a=0x1a 
0x7fffffffdb70:    0xffffdb90    0x00007fff    0x004005d3    0x00000000                    另外0x4005d3是函数调用者返回值ip 
0x7fffffffdb80:    0x00400470    0x00000000    0xffffdd90    0x00000019     <------funca的栈帧[0x7fffffffdb80,0x7fffffffdba0],其中a=0x19
0x7fffffffdb90:    0xffffdbc0    0x00007fff    0x00400601    0x00000000                     另外0x400601是函数调用这的返回值ip
0x7fffffffdba0:    0x00000000    0x00000000    0x00000028    0x00000018  <------add的栈帧[0x7ffffffdba0,0x7fffffffdbd0],其中a=0x18
0x7fffffffdbb0:    0x00000001    0x00000000    0x00000040    0x00000000
0x7fffffffdbc0:    0xffffdca0    0x00007fff    0x0040068e    0x00000000
0x7fffffffdbd0:    0xffffdd60    0x00007fff    0xf7dee923    0x00000002
0x7fffffffdbe0:    0x00000000    0x00000017    0x00000027    0x00000000
0x7fffffffdbf0:    0x00000000    0x00000000    0x00000003    0x00000000
0x7fffffffdc00:    0xffffdda8    0x00007fff    0x00000000    0x00000000
0x7fffffffdc10:    0x00400740    0x00000000    0xf7de7ab0    0x00007fff

在gdb中的caller of frame表示的是调用这个栈帧的起始地址,rbp也都是在rsp的上面

(gdb) info frame 1
Stack frame at 0x7fffffffdb80: 【栈的基地址】
 rip = 0x4005b7 in funcb (sleep.c:15); saved rip = 0x4005d3
 called by frame at 0x7fffffffdba0, caller of frame at 0x7fffffffdb60
 source language c.
 Arglist at 0x7fffffffdb70, args: a=26
 Locals at 0x7fffffffdb70, Previous frame's sp is 0x7fffffffdb80
 Saved registers:
  rbp at 0x7fffffffdb70, rip at 0x7fffffffdb78
 从gdb上没看出有没有ebp指针,没啥不同的!

posted @ 2018-07-22 13:49  honpey  阅读(894)  评论(0编辑  收藏  举报