Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program ends abruptly even in debugger - how did that happen?

I am trying to debug a program that unexpectedly shuts down. When I say "shuts down, I mean one moment I am seeing all the windows being displayed, each of which is showing all the right data,then suddenly all the windows disappear. The is no messagebox reporting anything wrong. So I tried running the program in the debugger hoping that it would somehow trap whatever was causing the program to abort, but even within the debugger the program simply ends abruptly. The last line in the debugger is:

The program '[5500] test.exe: Native' has exited with code 0 (0x0).

My program, which is extremely large and extremely old, has a lot of self diagnostics. My suspicion is that perhaps a self test has failed and maybe I just called "exit()", forgetting to pop up a dialog explaining why.

My question now is, how can I find out from which point in the code, my program quit?

like image 204
Mick Avatar asked Apr 12 '10 11:04

Mick


People also ask

How does the debugger allows you to control the execution of your program?

The debugger lets you place breakpoints in your program. When program execution reaches one of these breakpoints, the debugger can either perform predefined actions and continue program execution or suspend program execution and return control to you.

What happens when you Debug a program?

Debugging means to run your code step by step in a debugging tool like Visual Studio, to find the exact point where you made a programming mistake. You then understand what corrections you need to make in your code and debugging tools often allow you to make temporary changes so you can continue running the program.

Can you explain the step out action with a debugger?

If the debugger is within a nested scope, this action proceeds until the function returns (exits the current execution context). In case the debugger is within the global scope, this action executes the program to the end.

What is the last step in debugging a program?

The final step of debugging is to test the correction or workaround and make sure it works. In software development, the debugging process begins when a developer locates a code error in a computer program and is able to reproduce it.


1 Answers

Set a breakpoint on exit() and terminate() (maybe one calls the other, but I'm not sure).

like image 108
Marcelo Cantos Avatar answered Oct 24 '22 08:10

Marcelo Cantos