zoukankan      html  css  js  c++  java
  • 使用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指针,没啥不同的!

  • 相关阅读:
    BZOJ 1391: [Ceoi2008]order
    BZOJ 4504: K个串
    2019 年百度之星·程序设计大赛
    POJ 2398 Toy Storage (二分 叉积)
    POJ 2318 TOYS (二分 叉积)
    HDU 6697 Closest Pair of Segments (计算几何 暴力)
    HDU 6695 Welcome Party (贪心)
    HDU 6693 Valentine's Day (概率)
    HDU 6590 Code (判断凸包相交)
    POJ 3805 Separate Points (判断凸包相交)
  • 原文地址:https://www.cnblogs.com/honpey/p/9349943.html
Copyright © 2011-2022 走看看