Solved

How to debug a service program?

Posted on 2001-08-23
10
249 Views
Last Modified: 2013-12-03
I write a background program,then transfer to a server program, but the running result is quite different.
Anyone can tell me how to debug a server program.
My develop env is Win2000+sp2, Vc6.0 + sp5

Many thanks.

0
Comment
Question by:choudes
10 Comments
 
LVL 6

Expert Comment

by:MichaelS
ID: 6417177
Well, try to use Attach to process from VC6.0 but I am not sure that it's possible. Probably you have to use some other debugers. Also remote debug could help, I hope.
0
 
LVL 9

Accepted Solution

by:
ShaunWilde earned 100 total points
ID: 6417209
open up Visual Studio and Build/Start Debug/Attach to process

a dialog will open and you may have to check the show system processes - select your app  and debug away.

also make sure the .pdb is in the same directory as the .exe and that the source is readily available
0
 
LVL 86

Expert Comment

by:jkr
ID: 6417256
See http://support.microsoft.com/support/kb/articles/Q98/8/90.ASP ('HOWTO: Debug a Service Under Windows NT')
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 32

Expert Comment

by:jhance
ID: 6418223
Two ways that I've used:

1) The Visual Studio built-in debugger with the ATTACH feature as noted already.  Be sure to use a DEBUG build or debugging is pretty difficult...

2) SoftICE is really helpful in this case.  It's not cheap but it you do quite a bit of service debugging it can pay for itself quickly.
0
 
LVL 9

Expert Comment

by:BeyondWu
ID: 6420924
I think the service process will not appear in the attach process of VC.

Of couse, you can use SoftICE, but if you haven't installed it.
you can try following methods:
1. Open "Task Manager", select "Process" tab, select your service name, click right button it will popup a menu, select "debug", the default debuger will be invoke(VC), then open the source code in VC and set breakpoints.

2. Add DebugBreak() at servicemain or winmain, so you can debug from the beginning of your code.

Good Luck
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6421035
> I think the service process will not appear in the attach process of VC.

it does if you click the little check box :)
0
 
LVL 86

Expert Comment

by:jkr
ID: 10582783
I think I learned about a MSKB article in this thread that addresses this very issue :o)
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question