Discussion:
how to debug a service?
(too old to reply)
zhang
2007-02-07 09:38:47 UTC
Permalink
any advice or any books to introduce?
or give me a simple introduction?
Arnie
2007-02-08 16:10:10 UTC
Permalink
Post by zhang
any advice or any books to introduce?
or give me a simple introduction?
Assuming the service is your project, build it in debug mode. Open the
project. Set any breakpoints that you want to set. Use the SCM to start
the service. Use Tools->Attach to process.

- Arnie
zhang
2007-02-13 01:51:06 UTC
Permalink
Thank you
Post by Arnie
Post by zhang
any advice or any books to introduce?
or give me a simple introduction?
Assuming the service is your project, build it in debug mode. Open the
project. Set any breakpoints that you want to set. Use the SCM to start
the service. Use Tools->Attach to process.
- Arnie
Ashutosh Porwal
2007-05-03 00:58:19 UTC
Permalink
Does anyone know of any books on the same or even some good links shall do
the same?

Ashutosh

Hello zhang,
Post by zhang
Thank you
Post by Arnie
Post by zhang
any advice or any books to introduce?
or give me a simple introduction?
Assuming the service is your project, build it in debug mode. Open
the project. Set any breakpoints that you want to set. Use the SCM
to start the service. Use Tools->Attach to process.
- Arnie
Alexander Nickolov
2007-05-03 16:46:34 UTC
Permalink
"Professional NT Services" by Kevin Miller, Wrox Press
http://www.amazon.com/dp/1861001304
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: ***@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
Post by Ashutosh Porwal
Does anyone know of any books on the same or even some good links shall do
the same?
Ashutosh
Hello zhang,
Post by zhang
Thank you
Post by Arnie
Post by zhang
any advice or any books to introduce?
or give me a simple introduction?
Assuming the service is your project, build it in debug mode. Open
the project. Set any breakpoints that you want to set. Use the SCM
to start the service. Use Tools->Attach to process.
- Arnie
Gary G. Little
2007-05-03 15:39:29 UTC
Permalink
Debugging services are an absolute pain in the ass. Literally. Mostly you
cannot begin debugging them until all the really interesting stuff has
completed, since your mainly dependent upon being able to attach to the
service and you can't do that until it is attached. The VS documentation
will get you there, and check newsgroup archives here and on the NtDev list.
I asked the same question about a year ago and received some good
information. However, I haven't used it for about a year so it's stale and I
don't remember all the gooey details. Search the archives for my name and
you should get some hits.
--
The personal opinion of
Gary G. Little
Post by Ashutosh Porwal
Does anyone know of any books on the same or even some good links shall do
the same?
Ashutosh
Hello zhang,
Post by zhang
Thank you
Post by Arnie
Post by zhang
any advice or any books to introduce?
or give me a simple introduction?
Assuming the service is your project, build it in debug mode. Open
the project. Set any breakpoints that you want to set. Use the SCM
to start the service. Use Tools->Attach to process.
- Arnie
Alexander Nickolov
2007-05-07 17:26:56 UTC
Permalink
Sure you can debug service startup! Use gflags.exe to set up
the debugger for your service - it'll start as soon as the service
is started. (I know this is theory, but I haven't actually debugged
a service in this way myself...) You need to have Debugging
Tools for Windows installed on your machine:

http://www.microsoft.com/whdc/devtools/debugging/default.mspx
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: ***@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
Post by Gary G. Little
Debugging services are an absolute pain in the ass. Literally. Mostly you
cannot begin debugging them until all the really interesting stuff has
completed, since your mainly dependent upon being able to attach to the
service and you can't do that until it is attached. The VS documentation
will get you there, and check newsgroup archives here and on the NtDev
list. I asked the same question about a year ago and received some good
information. However, I haven't used it for about a year so it's stale and
I don't remember all the gooey details. Search the archives for my name
and you should get some hits.
--
The personal opinion of
Gary G. Little
Post by Ashutosh Porwal
Does anyone know of any books on the same or even some good links shall
do the same?
Ashutosh
Hello zhang,
Post by zhang
Thank you
Post by Arnie
Post by zhang
any advice or any books to introduce?
or give me a simple introduction?
Assuming the service is your project, build it in debug mode. Open
the project. Set any breakpoints that you want to set. Use the SCM
to start the service. Use Tools->Attach to process.
- Arnie
Kim Gräsman
2007-05-08 17:26:54 UTC
Permalink
Hi Alexander, zhang,
Post by Alexander Nickolov
Sure you can debug service startup! Use gflags.exe to set up
the debugger for your service - it'll start as soon as the service
is started. (I know this is theory, but I haven't actually debugged
a service in this way myself...) You need to have Debugging
http://www.microsoft.com/whdc/devtools/debugging/default.mspx
FWIW, you can modify the registry manually the same as gflags does, so you
don't need to install the Debugging Tools.

See http://support.microsoft.com/kb/170738.

Cheers,
- Kim
Patrick
2007-05-09 04:45:01 UTC
Permalink
If your service starts during system startup then, yes, that can be
challenging to debug. The best way to do that is to attach a kernel debugger
to your system, and put a breakpoint in your service startup code.

Regard,s

Patrick
Post by Kim Gräsman
Hi Alexander, zhang,
Post by Alexander Nickolov
Sure you can debug service startup! Use gflags.exe to set up
the debugger for your service - it'll start as soon as the service
is started. (I know this is theory, but I haven't actually debugged
a service in this way myself...) You need to have Debugging
http://www.microsoft.com/whdc/devtools/debugging/default.mspx
FWIW, you can modify the registry manually the same as gflags does, so you
don't need to install the Debugging Tools.
See http://support.microsoft.com/kb/170738.
Cheers,
- Kim
Andrew
2007-06-26 06:02:46 UTC
Permalink
Post by Alexander Nickolov
Sure you can debug service startup! Use gflags.exe to set up
the debugger for your service - it'll start as soon as the service
is started. (I know this is theory, but I haven't actually debugged
a service in this way myself...) You need to have Debugging
http://www.microsoft.com/whdc/devtools/debugging/default.mspx
there is 2 possible problems:
1. check start up code (initialize service)
about this case - it's quite common task and should not be difficult
2. check internal logic of service
I guess with (2) no problem -you just debug service as usual executable
process (with small modifications in start up part)

Loading...