Gdb cannot enter printf

here is my sample program:

#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) 

as soon as I try to enter the printf function. He leaves and returns to the main one. Does this mean that the shred library in which the printf function is defined is not equipped with debugging symbols? Or am I doing something wrong?

+4
source share
3 answers

This means that there are no source / debug symbols available for printf. You can use stepi to enter printf anyway, you will only have disassembly (use the disas command).

+6
source

That's right, you probably don't have debugging symbols available. Make sure libc-devel or similar is installed. Also, be sure to compile with -O0 to prevent optimization; optimization makes debugging harder to follow.

+3
source

In addition, -g3 is required for maximum characters. At -g3 even symbolic constants will be available. -ggdb may be useful. GDB Yang tells us that there are no GDB extensions for the main line, but Apple may have suggested some and omitted backstrem fixes.

0
source

Source: https://habr.com/ru/post/1346214/


All Articles