Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Debugger mysteriously never enters program...
This started happening a couple of days ago: (console app, debug mode) compiles and links ok, but then I hit F4 to start debugging, and as soon as I hit F8 so that it should stop at first instruction, it says "Program Ended". How can this be? sc main.cpp -cpp -Ae -Ar -mn -C -WA -S -5 -a8 -c -gf -DCONSOLE=1 -D_DEBUG=1 -D_X86_=1 -D_MT=1 -D_MBCS=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -oG:\BACnet\RS485\test\main.obj sc ..\Serial.cpp -cpp -Ae -Ar -mn -C -WA -S -5 -a8 -c -gf -DCONSOLE=1 -D_DEBUG=1 -D_X86_=1 -D_MT=1 -D_MBCS=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -oG:\BACnet\RS485\test\Serial.obj sc ..\rs485.cpp -cpp -Ae -Ar -mn -C -WA -S -5 -a8 -c -gf -DCONSOLE=1 -D_DEBUG=1 -D_X86_=1 -D_MT=1 -D_MBCS=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -oG:\BACnet\RS485\test\rs485.obj sc ..\xeiver.cpp -cpp -Ae -Ar -mn -C -WA -S -5 -a8 -c -gf -DCONSOLE=1 -D_DEBUG=1 -D_X86_=1 -D_MT=1 -D_MBCS=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -oG:\BACnet\RS485\test\xeiver.obj sc ..\..\TIME\mm_timer.cpp -cpp -Ae -Ar -mn -C -WA -S -5 -a8 -c -gf -DCONSOLE=1 -D_DEBUG=1 -D_X86_=1 -D_MT=1 -D_MBCS=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -oG:\BACnet\RS485\test\mm_timer.obj sc ..\..\VARS\variables.cpp -cpp -Ae -Ar -mn -C -WA -S -5 -a8 -c -gf -DCONSOLE=1 -D_DEBUG=1 -D_X86_=1 -D_MT=1 -D_MBCS=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -oG:\BACnet\RS485\test\variables.obj sc ..\..\VARS\params.cpp -cpp -Ae -Ar -mn -C -WA -S -5 -a8 -c -gf -DCONSOLE=1 -D_DEBUG=1 -D_X86_=1 -D_MT=1 -D_MBCS=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -oG:\BACnet\RS485\test\params.obj sc ..\..\REC_FRM\rec_frm.cpp -cpp -Ae -Ar -mn -C -WA -S -5 -a8 -c -gf -DCONSOLE=1 -D_DEBUG=1 -D_X86_=1 -D_MT=1 -D_MBCS=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -oG:\BACnet\RS485\test\rec_frm.obj link /CO /NOI /DE /NOPACKF /XN /NT /ENTRY:mainCRTStartup /BAS:4194304 /A:512 test_serial.LNK ren G:\BACnet\RS485\test\$SCW$.EXE test_serial.EXE G:\BACnet\RS485\test\test_serial.EXE built Lines Processed: 758156 Errors: 0 Warnings: 0 Successful build Jan 19 2004
Found out part of what's happening: I had something being initialized in static initializations time that triggered a start of the multimedia timer. Getting rid of a static member in a class and turning it into a singleton solve the problem of the debugger mysteriously exiting the program before seeming to step into a single instruction. I can now single step through the code to the point of failure, and the cause is still a mystery: As soon as the multi-media timer starts running I get the Program Ended message. Here's the code of my class and the instruction at which the program terminates: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// class timer : public iface { virtual void timerProc_() const = 0; protected: timer ( size_t resolution ); virtual ~timer (); size_t getTimerRes () const { return timerRes; }; bool startTimer ( size_t period, bool oneShot ); bool stopTimer (); size_t timerRes; size_t timerId; public: void timerProc(){ timerProc_(); } }; timer::timer(size_t resolution) : iface(), timerRes(0), timerId(0) { TIMECAPS tc; if(TIMERR_NOERROR == ::timeGetDevCaps(&tc,sizeof(TIMECAPS))) { timerRes = min(max(tc.wPeriodMin,resolution),tc.wPeriodMax); ::timeBeginPeriod(timerRes); } } timer::~timer() { stopTimer(); if( timerRes ) { ::timeEndPeriod( timerRes ); timerRes = 0; } } extern "C" void CALLBACK internalTimerProc(size_t id, size_t msg, DWORD dwUser, DWORD dw1, DWORD dw2) { timer * tmr = static_cast<timer*>(dwUser); tmr->timerProc(); } bool timer::startTimer(size_t period,bool oneShot) { bool res = false; MMRESULT result; //********************************************************************* result = ::timeSetEvent(period, timerRes, internalTimerProc, (DWORD)this,oneShot ? TIME_ONESHOT : TIME_PERIODIC); //<-- Program Ends !!! //********************************************************************* if(NULL != result) { timerId = (size_t)result; res = true; } return res; } bool timer::stopTimer() { MMRESULT result = TIMERR_NOERROR; if( timerId ) result = ::timeKillEvent(timerId); if( result == TIMERR_NOERROR ) timerId = 0; return( result == TIMERR_NOERROR ); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// Cheers! Jan 20 2004
It just seems that the debugger chokes when the multimedia timer is turned on; the code works okay when compiled for Release... Jan 20 2004
"dan" <dan_member pathlink.com> wrote in message news:buk8nj$10jt$1 digitaldaemon.com...It just seems that the debugger chokes when the multimedia timer is turned Jan 23 2004
|