6

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 step into the printf function.its exiting and returning to main. does this mean that the shred library in which the printf function is defined is not provided with the debug symbols?Or am i doing something wrong?

3 Answers 3

7

This means there's no available source/debug symbols for printf. You can use stepi to step into printf anyway, you'll only have disassembly available (use the disas command).

Sign up to request clarification or add additional context in comments.

2 Comments

Out of curiosity ,does the presence source but not debug symbols mean you can step into a function ?
@Ricko M: No, you need debug symbols to step into, and source to have gdb display source lines while stepping.
3

That's correct, you likely do not have debugging symbols available. Make sure libc-devel or similar is installed. Also, make sure to compile with -O0 to prevent optimization; optimizations make debugging more difficult to follow.

Comments

0

Also, -g3 is required for maximum symbols. With -g3, even symbolic constants will be available. -ggdb may be helpful too. Jan from GDB tells us there are no mainline GDB extensions, but Apple may have offered some and omitted backstrem patches.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.