views:

141

answers:

2

Visual C++ 2008 has a great tool called "Attach to Process", which start watching a specific process for debugging symbols and handles correctly your breakpoints. This is fantastic, but I would like some more.

I would like to attach my debugging session to a executable file, such that when it is executed, debugger takes command. So I would, say, attach my debugging session to d:\listener\solver.exe, and start an app that eventually will call this executable, and then Visual C++ would pop on the screen when it reached a breakpoint.

Is that possible? How do I do that?

A: 

Not sure how far this will get you, but if you go into task manager, look at the processes tab, you can right-click a file and choose "Debug" it will then load this file into Visual Studio.

Although, it might just load the machine code and not the actual code. But might be worth checking out.

taylonr
Also, this is no better than the method I'm using now, of attaching the process to the debug session. I will also lose the first seconds of processing, which shall make me lose the runtime of some methods.
Luís Guilherme
That's a good point
taylonr
A: 

There is a build in feature in windows that enables you to start a process with a debugger attached to it. I wrote about this feature on another SO Question. you can read all about it here.

Moshe Levi
You could have pointed this link directly: http://msdn.microsoft.com/en-us/library/a329t4ed(VS.71).aspx But this solves my problem (not perfectly, but well enough) and thus it's accepted!
Luís Guilherme