BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: How could I debug the ServiceApplication?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (IDE)
View previous topic :: View next topic  
Author Message
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Sep 29, 2005 5:50 pm    Post subject: Re: How could I debug the ServiceApplication? Reply with quote




"hawkfly" <bigwasp (AT) 163 (DOT) com> wrote


Quote:
thanks.

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (IDE) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.