gpt4 book ai didi

c++ - gdb 无法进入 printf

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:12:51 25 4
gpt4 key购买 nike

这是我的示例程序:

#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 函数。它退出并返回到 main。这是否意味着定义 printf 函数的 shred 库没有提供调试符号?还是我做错了什么?

最佳答案

这意味着 printf 没有可用的源代码/调试符号。无论如何,您都可以使用 stepi 进入 printf,您只能进行反汇编(使用 disas 命令)。

关于c++ - gdb 无法进入 printf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5512895/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com