Solved

How to debug a service program?

Posted on 2001-08-23
10
247 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
Comment Utility
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
Comment Utility
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
Comment Utility
See http://support.microsoft.com/support/kb/articles/Q98/8/90.ASP ('HOWTO: Debug a Service Under Windows NT')
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 32

Expert Comment

by:jhance
Comment Utility
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
Comment Utility
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
Comment Utility
> 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
Comment Utility
I think I learned about a MSKB article in this thread that addresses this very issue :o)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now