Archive

Archive for October, 2010

Attaching Microsoft Script Debugger to a Running Process

October 7th, 2010 No comments

OK, I’ve just learnt how to do something that I’m going to find very useful in the future! I’ve wanted to do this for a while and didn’t know, but necessity is the mother of invention (or investigation in this case.)

Here’s the scenario. I have a running Internet Explorer session connected to a Live environment. I cannot change the Live code to add in a “Stop” statement. That Internet Explorer session is actually a hosted version of the IE ActiveX control inside of a custom executable. I have a VBScript bug and I need to see what’s happening.

So, what I need to do is to attached Microsoft Script Debugger (MSD) to the running IE session, and force a breakpoint in the code. Here’s how….

  1. Start MSD.
  2. Go to “Debug” -> “Processes”.
  3. Find the appropriate process, use the “Title” column to help.
  4. Click “Attach”.
  5. When the “Attach to Process” screen is displayed, click “OK”.
  6. Click “Close”

That will now attach you to the correct process. All you need to do now is to add a break point.

  1. Go to “Debug” -> “New Breakpoint”
  2. Type in the name of a function, sub-routine or event that you want to trap.
  3. Perform the actions in IE that would cause the function where you inserted the breakpoint to fire.
  4. You should then be directed to MSD with the source code of the lines where you inserted the break point.
  5. Step-Over, Out-of or Into as much as you’d like!

Simple really – just needed five minutes of Googling and playing around in MSD!