Re: Determine where program is exiting from
On 23.07.14 18.50, ?? Tiib wrote:
On Wednesday, 23 July 2014 19:25:32 UTC+3, Christopher Pisz wrote:
I've got a service kind of console application. It shouldn't exit until
I go and kill it. It seems to be exiting with a return of 0 prematurely
and I am not sure why or how.
Is there some kind of callback/handler type thing I can override to put
a breakpoint and see where is it exiting from? Like I've done for pure
virtual function calls. or is that Windows specific?
Program can set exit handler with 'atexit' and terminate handler with
'set_terminate'.
I am unsure whether this helps, since the call stack of exit might
already be lost at this place.
A full text search for \wexit\( (Regex) over the entire source code
could be helpful. This won't work if exit is called from a library.
Another dirty hack: write a custom function exit(int) and place the
breakpoint there. Of course, this is platform dependent, but usually the
linker prefers this function over the one in the runtime library.
I think you already checked for the trivial case: return from main.
Marcel