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 1st page off disk
readseg((uint32_t) ELFHDR, SECTSIZE*8, 0);
.
. // REST OF CODE
.
}
我正在使用gdb插入我的代码,看看正在发生什么.
我找到了bootmain 0x7d0a
的地址,并在其中放置了一个断点.
I am using gdb to step in my code and see what is happening.
I found the address of bootmain 0x7d0a
and I put a breakpoint there.
b *0x7d0a
c
以上2条命令:b
放置断点,而c
运行直到达到断点.
The above 2 commands: b
puts break-point and c
runs until break-point is reached.
我可以看到我像预期的那样在0x7d0a
停了下来.
然后,在执行几条命令后,我可以看到函数参数作为参数被压入堆栈.并呼吁readseg
.
I can see that I stoped at 0x7d0a
as expected.
Then after few commands I can see the function parameters being pushed to stack as arguments. And a call for readseg
.
0x7d0f push $0x0 // 0
0x7d11 push $0x1000 // 512*8 = 4096 B
0x7d16 push $0x10000 // 64 KB
0x7d1b call 0x7cd1
我的问题是:我如何才能跨过此功能?使用si
的下一条命令仅使我进入readseg
函数.我不想跨步而已.我尝试在下一个下一个命令后放置一个断点:
My question is: How do I just step over this function ? next command using si
just gets me inside the readseg
function. I don't want to step into but to step over. I tried putting a break-point next next command:
b *0x7d21
c
但是它永远不会返回...
But it never returns...
也许我应该在其他地址上设置断点?没有把握.但这是一种解决方法,我宁愿使用在文档此处.
Perhaps I should have set the break-point on a different address ? not sure. However this is a way around and I'd rather use step over command which I couldn't find in the documentation here.
推荐答案
si
的跳过"类似物称为nexti
(也缩写为ni
).这将只执行一条汇编指令,但会结束调用.
The "step over" analogue of si
is called nexti
(also abbreviated ni
). This will step a single assembly instruction, but step over calls.
这篇关于GDB越过命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!