Attaching the VC++ compiler/debugger to a process

Posted on 1997-10-16
Last Modified: 2013-12-04
I've been trying to get my VC++ 5.0 debugger to attach to processes for months now.  I've reinstalled NT, formatted and reinstalled VC++ 5.0, and messed with configuration until the sun went down.  I've seen it done, I know it can be done.  I load up task manager and right click on a task and try to attach the debugger, and I get an error - file not found.  Unfortunately, some creep at Microsoft decided that WHICH file wasn't found was unimportant.  So, my question is, how do you attach the debugger to a .dll, service or other file that you've created with debug information?  I've tried using msdev -p PID, and it got into the disassembly, but I haven't gotten past that.  Any ideas?
Question by:vinniew
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1407628
Have you enabled just-in-time debugging in the settings in MSVC?

Expert Comment

ID: 1407629
In Visual Studio, you can click the Build Menu, and move down to Start Debugging.  This will give you an option to attach the debugger to a process.  When you click this option, it will present you with a list of running processes that you can attach to.

Author Comment

ID: 1407630
That's close to what I was looking for.  Yes, I've got the JIT debugging turned on.  Is there something I didn't install?  I did a 'typical' installation of VC++.

With regard to the attach to process function,

I haven't used that... What else do you have to have set up to use it?  Breakpoints?

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now


Expert Comment

ID: 1407631
I haven't done much with attaching it to a process I'm not debugging, but I think you just have to attach it, and then you can step through the process.  The only drawback, of course, is that if there aren't any symbols for the file, you will get the decompilation.

Accepted Solution

mnguyen021997 earned 100 total points
ID: 1407632
the other thing you can do is simply place an ASSERT(0) in your code where you want to break and run it.  it will cause an exception and allow you to attach then.  also a "__asm int 3" will do the same

Author Comment

ID: 1407633
I hadn't thought of that.  Thanks

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

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 …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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