|
|
Where in the source code should I debug a program as it exits?
MSVS 2005, Version 8
C/C++
I have a couple of programs that behave properly except at the end,
when they exit. One of them makes the failure sound and the debugger
displays exit code 0x3.
I come from the Unix world where it is very easy to determine where
the program begins (in main()) and where it ends. It is very confusing
in Windows.
I figured out that a way to debug a Windows program as it begins is
simply pressing F10.
TIA,
-Ramon
|
|
0
|
|
|
|
Reply
|
ramon (1465)
|
8/22/2010 3:05:00 PM |
|
It's impossible to guess but...
On Sun, 22 Aug 2010 08:05:00 -0700 (PDT), Ramon F Herrera
<ramon@conexus.net> wrote:
>
>MSVS 2005, Version 8
>C/C++
>
>I have a couple of programs that behave properly except at the end,
>when they exit. One of them makes the failure sound and the debugger
>displays exit code 0x3.
Are these console programs or win32 projects? If console, then main is
the start, and exit(n) or return 0 are the exits from main.
If Win32 then your exit control points are the WM_DESTROY or IDM_EXIT
cases in the WndProc function both of them post messages to the main
message loop which will process the messages and finally exit the
program at the end of the WinMain or _tWinMain function with:
return (int) msg.wParam;
Set a breakpoint there and examine the call stack.
>
>I come from the Unix world where it is very easy to determine where
>the program begins (in main()) and where it ends. It is very confusing
>in Windows.
>
>I figured out that a way to debug a Windows program as it begins is
>simply pressing F10.
Set a breakpoint at your suspect exit points and see where the program
stops when you close it, then trace (f10) from there.
Remember, Windows programs process messages, a clean exit from a
Windows program is to call PostQuitMessage(0), do not exit() or
ExitProcess().
|
|
0
|
|
|
|
Reply
|
Geoff
|
8/22/2010 5:57:46 PM
|
|
On Aug 22, 12:57=A0pm, Geoff <ge...@invalid.invalid> wrote:
> Are these console programs or win32 projects?
Win32. More specifically, MFC.
Thanks for your tips...
-Ramon
|
|
0
|
|
|
|
Reply
|
Ramon
|
8/22/2010 6:25:05 PM
|
|
Are you trying to access files ? If I remember exit 3 has to do
with the pathname or something to that effect.
If so step thru that area.
|
|
0
|
|
|
|
Reply
|
RB
|
8/28/2010 4:42:36 PM
|
|
|
3 Replies
196 Views
(page loaded in 0.159 seconds)
Similiar Articles: ksh debugging - comp.unix.solarisWhat should I use to debug ksh script on Sun Solaris 9? set -xv? ... lines at a time [default: 1] * List the source code ... inside the script before running your program: env ... How can glClear cause application crashes? - comp.graphics.api ...Is there any way to access the OGL source code in order to properly debug this? ... You've got a problem somewhere in your program ... using "code skip" - I added returns / exits ... debugging c program - comp.programming.threadsI am having some problems debugging my program. I am getting a SIGSEGV. I have a linked ... Points - comp.programming Hi, I'm using dev-c++ to compile a single c source code ... Errrors while debugging in Compaq Visual Fortran 6.6 - comp.lang ...... it should. > Anyway I tried to debug a my code ... program execution. Instead, set a breakpoint or insertion point at > the first executable line of Fortran source code and ... Child Process Exited while Making Connection to Remote Process ...Also, try running a trivial MPI program that you *know* should work. If it doesn't, then don't debug your source code; debug your installation of MPICH instead. Visual C++ Expression Edition Debugging - comp.programming ...... be in a situation where i will need to debug my program ... Usage) and Chapter 7 (Advanced Native Code ... From NASM to Visusal Studio source debugging - comp.lang.asm ... Microfocus animator and CALL statements - comp.lang.cobol ...... calling COBOL; I'll check tomorrow on how to build the calling program for debugging. ... ANIMATED 3ds file loader source code - comp.graphics.api.opengl ... Microfocus ... C decompiler/disassembler? - comp.lang.c... an EXE program as input and generate its source code ... it should easy to extract code (may not be as is but atleast ...) out of .EXE program compiled with debugging ON. FFT program already done: How to use it? - comp.dsp... Transform/Visual_Basic_program ... sin wave of 10Hz I should have frequence spectrum peak at 10Hz. Why if I debug adding this code ... fft source code - comp.soft-sys ... ANNOUNCE: A C++ Class Browser Sidekick for Vi, Vim, Emacs & Xemacs ...o Sirius analyzes C++ programs and weaves a Code Wide Web that is ... machine.) o Ability to browse source code that ... Such code should "look" like C++ code. We ... Debugging with MS Visual C++ - Computer Science, U.Va. Engineering... Debugger is integrated into the IDE, and provides source code level debugging. ... HINT: Use a breakpoint to stop your program before it exits! Using the Watch Windows. How to break into code, as thread exits, when debugging?How to break into code, as thread exits, when debugging? ... you could view the source code if ... 0x84c) has exited with code -1073740791 (0xc0000409). The program ... 7/16/2012 9:28:43 AM
|
|
|
|
|
|
|
|
|