Program execution
Hello all,
I have a program that just stops execution and I can't see what is really
going on. Does anyone know how this kind of problem shoud be solved. I've already read something about core dump memory, but I don't know how to make it, or instruct my program to do that. Can anyone help me?
p.s.) My program runs on a Linux machine.
Thanks.
Hello,
first enable coredumps
# ulimit -c unlimited # ./yourfaultyapp
open another shell and kill the process using kill -SIGSEGV then it should say core dumped (also compile your application with -g .. there are a few other debugging options but that one might already help you)
afterwards run your application with gdb (should look like the following line)
# gdb ./yourfaultyapp coredumpfile
Quoted 3 lines
bt // for a backtrace, last functions which got called and so frame #<framenumber> // inspect a frame
list // show the sourcecode which is connected to that frame
hope this helps,
Markus
Quoted 12 lines · r_zaca
Hello all,
I have a program that just stops execution and I can't see what is really
going on. Does anyone know how this kind of problem shoud be solved. I've already read something about core dump memory, but I don't know how to make it, or instruct my program to do that. Can anyone help me?p.s.) My program runs on a Linux machine.
Thanks.
Signature · 3 lines
Markus Rechberger http://www.wikiservice.at/dse/wiki.cgi?MarkusRechberger
Quoted 6 lines · r_zaca
Hello all,
I have a program that just stops execution and I can't see what is really
going on. Does anyone know how this kind of problem shoud be solved. I've already read something about core dump memory, but I don't know how to make it, or instruct my program to do that. Can anyone help me?
When a (UNIX) program exits abnormally it usally has received a signal and probably has, depending on the signal (SIGSEGV, for example), written a core dump. You can then examine the core dump by running gdb:
$ gdb myapp core.1234
gdb usually jumps straight to the line where the crash occured.
If your program does not generate a core dump you can force it to do so by calling abort(). A better solution is to provide an error handler that automatically writes a core dump.
Regards
\Steve
--
Steve Graegert <[email protected]>
Software Consultancy {C/C++ && Java && .NET}
Mobile: +49 (176) 21248869
Office: +49 (9131) 7126409