Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set step-mode off 无效 #22

Open
lc168 opened this issue Aug 14, 2021 · 1 comment
Open

set step-mode off 无效 #22

lc168 opened this issue Aug 14, 2021 · 1 comment

Comments

@lc168
Copy link

lc168 commented Aug 14, 2021

我阅读了“step-and-next-function.md” 以后,
如果函数没有调试信息,我就希望step不要进入函数里面去,
可是,我执行set step-mode off 以后,却发现step,依旧可以进入printf,printf是没有调试信息的函数,
请问是为啥呢?有什么办法可以,让step不要进入没有调试信息的函数里面去吗?

(gdb) set step-mode off 
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/lc/Desktop/a.out 

Breakpoint 1, main () at ss.c:13
13	int main(void) {
(gdb) s
14	        ex_st st = {1, 2, 3, 4, PTHREAD_MUTEX_INITIALIZER};
(gdb) 
15	        printf("%d,%d,%d,%d\n", st.a, st.b, st.c, st.d);
(gdb) 
__printf (format=0x4006d4 "%d,%d,%d,%d\n") at printf.c:28
28	printf.c: No such file or directory.
(gdb) 
@xingmingjie
Copy link
Member

set step-mode off
Causes the step command to step over any functions which contains no debug information. This is the default.

根据gdb的文档介绍,如果printf确实没有调试信息,是不应该step进去的。所以,看起来有两种可能性:

1)printf所在的c库是使用了-g(一般加上 -O2)之类的选项编译,虽然找不到printf.c源文件,但确实带有调试信息。

2)gdb的bug

看起来第一种可能性更大些。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants