Richard
Richard

Reputation: 15542

On debug of c program

I have a C program which throws segfault. However, as I use gdb to find out where the error is thrown. I get following stack info... I dont understand why #1 points to ??(). What is the possible reason for this? Thanks.

#0  __longjmp () at ../sysdeps/i386/__longjmp.S:68
#1  0x43746a57 in ?? ()

Upvotes: 0

Views: 114

Answers (3)

Jonathan Leffler
Jonathan Leffler

Reputation: 753455

If longjmp() goes astray as it seems it is, then the problem is likely that you're abusing it - either by passing a jmpbuf that was never initialized by a setjmp() call, or by passing a jmpbuf that was set in a routine that has since returned.

For how to find out more with debugging information, see the other answers and compiling with the -g option.

Upvotes: 0

Michael Aaron Safyan
Michael Aaron Safyan

Reputation: 95449

In order to debug your program, you need to compile it with debugging symbols included, which you can do by using the -g3 flag if compiling using GCC. When you run the debug version of your program in GDB and execute bt (for "backtrace") you should get a more sensible piece of output.

Upvotes: 2

Scott M.
Scott M.

Reputation: 7347

gdb doesn't know the name of the function so it puts ??.

have you tried compiling with debug symbols?

Upvotes: 1

Related Questions