Solved

Attaching the VC++ compiler/debugger to a process

Posted on 1997-10-16
6
583 Views
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?
0
Comment
Question by:vinniew
6 Comments
 
LVL 5

Expert Comment

by:y96andha
ID: 1407628
Have you enabled just-in-time debugging in the settings in MSVC?
0
 
LVL 5

Expert Comment

by:dirtdart
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.
0
 
LVL 3

Author Comment

by:vinniew
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?

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 5

Expert Comment

by:dirtdart
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.
0
 
LVL 2

Accepted Solution

by:
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
0
 
LVL 3

Author Comment

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

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

786 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