繁体   English   中英

GDB 跳过命令

[英]GDB step over command

我有以下 C 代码:

#include <inc/x86.h>
#include <inc/elf.h>

#define SECTSIZE 512
#define ELFHDR  ((struct Elf *)0x10000) // Scratch space

void readsect(void*, unit32_t);
void readsec(uint32_t, uint32_t, uint32_t);

void bootmain(void)
{
    struct Proghdr *ph, *eph;

    // Read the first page off disk
    readseg((uint32_t) ELFHDR, SECTSIZE*8, 0);
    .
    .  // The rest of the code
    .
}

我正在使用 GDB 来介入我的代码,看看发生了什么。

我找到了 bootmain 0x7d0a的地址,并在那里放置了一个断点。

b *0x7d0a
c

上面两条命令: b添加断点, c运行直到到达断点。

我可以看到我按预期停在0x7d0a

然后在几个命令之后,我可以看到函数参数作为参数被推送到堆栈。 并呼吁readseg

0x7d0f push $0x0      // 0
0x7d11 push $0x1000   // 512*8 = 4096 B
0x7d16 push $0x10000  // 64 KB
0x7d1b call 0x7cd1

我如何跳过这个功能? 使用si的下一个命令只是让我进入readseg函数。 我不想踏入,而是跨过去。 我尝试在下一个命令旁边放置一个断点:

    b *0x7d21
    c

但它永远不会回来......

我应该在不同的地址上设置断点吗?

我不确定。 但是,这是一种解决方法,我宁愿使用我在此处的文档中找不到的 step over 命令。

si的“跨越”类似物称为nexti (也缩写为ni )。 这将单步执行单个汇编指令,但会跳过调用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM