如何解释GDB“信息框架”输出? [英] How to interpret GDB "info frame" output?

查看:190
本文介绍了如何解释GDB“信息框架”输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 (gdb)信息框
堆栈等级0,可以帮助我理解这一点: frame:0xb75f7390:
eip = 0x804877f in base :: func()(testing.cpp:16);保存的eip 0x804869a
在0xb75f73b0
源语言c ++中被帧调用。
Arglist在0xb75f7388,args:this = 0x0
0xb75f7388的本地数据,上一帧的数据是0xb75f7390
保存的寄存器:
ebp在0xb75f7388,eip在0xb75f738c

什么是ebp,eip Locals at和Previous Frame的sp是什么意思?请解释

解决方案

(gdb)信息框

堆栈级别0




  • 回溯中的帧数,0是当前正在执行的帧,向下增长 ,与堆栈一致。



frame at 0xb75f7390



    $ b eip = 0x804877f在base :: func()(testing()中测试这个堆栈帧的内存地址
    的.cpp:16);保存的eip 0x804869a




    • eip是下一条执行指令的寄存器(也称为程序计数器)。
      ,所以此时执行的下一个位于0x804877f,即test.cpp的第16行。保存的eip0x804869a被称为返回地址,即从该被调用栈返回后在主调栈帧中恢复的指令。按CALL指令将其压入堆栈(保存返回)。



    以帧0xb75f73b0调用




    • 调用者堆栈帧的地址


    源语言c ++


    • 使用哪种语言



    arglist在0xb75f7388,args:this = 0x0




    • 参数的起始地址


    本地变量的地址0xb75f7388





    前一帧的sp为0xb75f7390

    这是前一帧的位置堆栈指针指向(调用者框架),在调用时,它也是调用堆栈框架的起始内存地址。

    保存的寄存器:
    这是被调用堆栈上的两个地址,用于保存两个寄存器。
    $ b


    • ebp在0xb75f7388
      这是调用者堆栈帧的ebp寄存器保存的地址(请注意,它是寄存器,而不是调用者的堆栈地址)。
      ,即对应于PUSH%ebp。 ebp是通常被认为是这个堆栈帧的本地地址的起始地址的寄存器,它使用偏移量来寻址。
      换句话说,局部变量的操作都使用这个ebp,所以你会看到类似于 mov -0x4(%ebp),%eax 的东西,等等。

    • 如前所述,在0xb75f738c
      处提取,但这里是堆栈的地址(其中包含值0x804877f)。



    Can some please help me to understand this:-

    (gdb) info frame
    Stack level 0, frame at 0xb75f7390:
     eip = 0x804877f in base::func() (testing.cpp:16); saved eip 0x804869a
     called by frame at 0xb75f73b0
     source language c++.
     Arglist at 0xb75f7388, args: this=0x0
     Locals at 0xb75f7388, Previous frame's sp is 0xb75f7390
     Saved registers:
      ebp at 0xb75f7388, eip at 0xb75f738c
    

    What is "ebp, eip Locals at and Previous Frame's sp " means? Please explain

    解决方案

    (gdb) info frame

    stack level 0

    • frame num in backtrace, 0 is current executing frame, which grows downwards, in consistence with the stack.

    frame at 0xb75f7390

    • starting memory address of this stack frame

    eip = 0x804877f in base::func() (testing.cpp:16); saved eip 0x804869a

    • eip is the register for next instruction to execute (also called program counter). so at this moment, the next to execute is at "0x804877f", which is line 16 of testing.cpp.

    • saved eip "0x804869a" is so called "return address", i.e., the instruction to resume in caller stack frame after returning from this callee stack. It is pushed into stack upon "CALL" instruction (save it for return).

    called by frame at 0xb75f73b0

    • the address of the caller stack frame

    source language c++

    • which language in use

    Arglist at 0xb75f7388, args: this=0x0

    • the starting address of arguments

    Locals at 0xb75f7388,

    address of local variables.

    Previous frame's sp is 0xb75f7390

    this is where the previous frame´s stack pointer point to (the caller frame), at the moment of calling, it is also the starting memory address of called stack frame.

    Saved registers: These are the two addresses on the callee stack, for two saved registers.

    • ebp at 0xb75f7388 that is the address where the "ebp" register of the caller´s stack frame saved (please note, it is the register, not the caller´s stack address). i.e., corresponding to "PUSH %ebp". "ebp" is the register usually considered as the starting address of the locals of this stack frame, which use "offset" to address. In another word, the operations of local variables all use this "ebp", so you will see something like mov -0x4(%ebp), %eax, etc.

    • eip at 0xb75f738c as mentioned before, but here is the address of the stack (which contains the value "0x804877f").

    这篇关于如何解释GDB“信息框架”输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆