14 April 2006

Miscellany

I'm searching for a way to ask the Visual Studio debugger to attach and break as soon as a given process starts. I don't care which version of Visual Studio, or if I have to attach to the parent process first, or how much scripting I have to do, as long as it's possible to get to a point where I can do this conveniently. For the world's most complicated debugger, this seems like a really obvious feature, but I can't find it.

Update: No luck yet, but I'm slightly warmer. VS.NET has macros; the EnvDTE namespace provides a tiny amount of programmatic access to the debugger; VS2005 allows you to set breakpoints in DLLs that are not loaded.

Firefox has a menu option, View → Page Style → No Style, that is perfect for pages like this one.

My side project is going well. Some 300 tests are passing. I need to pause a moment and figure out specifically what to do next. There are a lot of little things I'm eager to work on.

For one thing, it's slow. I've been using the Venkman JavaScript debugger to find the worst bits. It actually has a usable profiler. Fanstastic.

I have never (in maybe 6 tries) succeeded in getting any version of the Visual Studio debugger to work with a symbol server. The error messages are totally useless.

2 comments:

jto said...

That's exactly what I'm looking for! Thanks!

jto said...

OK, on further reading, this feature is rather strangely behaved. :)

Really what I want is like this:

Let P=the parent process and C=the child process. Say P is running under the debugger. Let D=the debugger process.

In D, I set a tracepoint in P, in CreateProcess (or in the jump table, whatever). The tracepoint has a condition involving the ApplicationName argument, to make sure it only hits for the particular child executable I care about. When the tracepoint hits:

- D adds CREATE_SUSPENDED to the dwCreationFlags argument in P.

- D steps over the CreateProcess call. This starts C suspended and returns C's process id.

- D attaches to C and sets a breakpoint in C, in main().

- D causes P to call ResumeThread on the child process's primary thread, if necessary (that is, if P didn't actually intend to use the CREATE_SUSPENDED flag). C will break basically right away.

- D lets P run.