A windows service is basically an application started by the SCM. In its stopped state, it’s not running, and there is no process to attach to.
Assuming you have its corresponding pdb, a good way to debug a service during its startup is to attach a debugger using Gflags - see https://msdn.microsoft.com/en-us/library/windows/hardware/ff554648.aspx and use windbg as the remote client debugger.
I use ntsd as the Gflags debugger with a command similar to
c:\debuggers\ntsd.exe -server tcp:port=5000,icfenable -G -y "C:\path\to\service\symbols"
which sets up ntsd as a debugging server listening on tcp port 5000 with an initial breakpoint but no final breakpoint (-G), with the service’s .pdb file in C:\path\to\service\symbols\
and then, in Windbg, “Connect to a Remote session…” with a connection string like
tcp:server=192.168.1.30,port=5000
(don’t forget to use the correct target IP address).
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-584405-
xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: 09 June 2015 05:57
To: Kernel Debugging Interest List
Subject: [windbg] Unable to Attach process using WinDbg
In SAN boot machine, I have my windows service ( daemon process )
which is in stopped state once booted.
I have to figure out that whether StartServiceCtrlDispatcher function
gets suceeded. I have added log messages below that function.
My service start type is: Automatic, Since my service is automatic, My
service is started by SCM ( Service Control Manager ) after the wininit
process. Changing service type to boot, or manual doesn’t help to start
my service.
Using windbg attach to process i tried to debug my service. Windbg
command ( F6 - Attach to process ) lists services only which are in
running state. Since my service is in stopped state, my service doesn’t
gets listed. So I am unable to debug my service.
In elevated comand prompt tried to attach a process with process name
using the command windbg -pn MyServiceProcessName, I am getting the
error
Unable to find process ‘MyServiceProcessName’,
HRESULT 0x80004002’
No such interface supported.
Kindly help me regarding this…
- D Anantha Krishnan
This email message has been delivered safely and archived online by Mimecast.
For more information please visit http://www.mimecast.com