[英]gdb cannot step into printf
这是我的示例程序:
#include<stdio.h>
int main()
{
printf("hello good morning \n");
return 0;
}
gcc -Wall -g temp.c
/opt/langtools/bin/gdb a.out
HP gdb 3.3 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 3.3 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
..
(gdb) b 6
Breakpoint 1 at 0x2b14: file temp.c, line 6.
(gdb) run
Starting program: /oo_dgfqausr/test/dfqwrk4/temp/a.out
Breakpoint 1, main () at temp.c:6
6 printf("hello good morning \n");
(gdb) step
hello good morning
7 return 0;
(gdb)
一旦我尝试进入printf function.its退出并返回main。 这是否意味着定义了printf函数的shred库没有提供调试符号?或者我做错了什么?
这意味着printf没有可用的源/调试符号。 无论如何,您可以使用stepi
步入printf
,您只能使用反汇编(使用disas
命令)。
这是正确的,您可能没有可用的调试符号。 确保安装了libc-devel或类似软件。 另外,请确保使用-O0
进行编译以防止优化; 优化使调试更难以遵循。
此外,最大符号需要-g3
。 使用-g3
,即使是符号常量也可用。 -ggdb
也可能有用。 来自GDB的Jan告诉我们没有主线GDB扩展,但Apple可能提供了一些并省略了backstrem补丁。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.