 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Sep 29, 2005 5:50 pm Post subject: Re: How could I debug the ServiceApplication? |
|
|
"hawkfly" <bigwasp (AT) 163 (DOT) com> wrote
For future reference, please place your questions in the BODY of the
message, not the SUBJECT. Not everyone reads subjects, so your questions
could go unnoticed.
As for the actual question - do the following:
1) enable debug info for the executable as you would any other project.
2) place a Sleep() in the service's OnStart event hander. Set the interval
to slightly less than the service's WaitHint interval. Call the service's
ReportStatus() method immediately after the Sleep(). For example:
void __fastcall TService1::ServiceStart(TObject *Sender)
{
#ifdef _DEBUG
::Sleep(WaitHint-100);
ReportStatus();
#endif
//...
}
You may want to increase the WaitHint value while debugging to give yourself
adequate time for the next steps.
3) compile the executable, then install and start the service via the SCM
normally.
4) while the OnStart event is sleeping, you can attach the IDE's debugger to
the service's process via the "Attach to Process" menu item. You will have
to click on the "Show system processes" checkbox in order to see the
service.
5) when you attach to a running process, the CPU view will appear. Press F9
to continue the service's execution.
6) once the code finishes sleeping, you can debug the service's code like
any other project.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|