[LCP]debugging a Segmentation fault
lloyd at acm.jhu.edu
Thu Oct 7 20:50:01 UTC 2004
Compile your code with -g (or -ggdb, which may give better results), and run
your executable from inside gdb:
$ gdb your_executable
<GDB version info>
After it crashes, the 'backtrace' command will (in theory) give you the line
number and stack trace of where you crashed.
On Thu, Oct 07, 2004 at 03:00:45AM -0400, Karthik Vishwanath wrote:
> I develop a monte-carlo code written in standard C. I recently decided to
> "add features" to the previous stable version and now the code aborts with
> a Segmentation fault. I suspect the code is executing different parts of
> the code before crashing, on different runs (and therefore crashing at
> different points?). There is no core dumped either.
> Can I discover which source-line caused the program to abort (or get
> information about which function it was, etc.), or trap the signal
> within the code and print out details -- how?
> This is the Linux C Programming List
> : http://lists.linux.org.au/listinfo/linuxcprogramming List
More information about the linuxCprogramming