qballer
qballer

Reputation: 2111

debugger already attached - cscript

I have a short JScript which creates an active X object and calls a function. That active X object is written in C++. When I run the command cscript scriptName.js //X I start VS2012 in debug mode. Than I try to attach a debugger but as you know one is already attached.

Is there a way to reattach the debugger or connect to it some how?

My current solution is not to use JScript and call the code from C++.

Upvotes: 0

Views: 501

Answers (1)

Uri London
Uri London

Reputation: 10797

Which debugger do you want to use?Visual Studio or WinDBG? Do you really need to debug both the JavaScript code AND the C++ code simultanously?

If the latter isn't an issue for you, and you want to focus on the C++ code, in Visual Studio (or WinDBG) just debug cscript.exe, without the /x flag. No need even to attach, you can start debugging with F5 from Visual Studio.

  1. In Visual Studio (2008, 2010, or 2012 - they all work), right click on the ActiveX project (That's the C++ project).
  2. Go to: Configuration Properties -> Debugging
  3. In the Command put the cscript full path: C:\Windows\System32\cscript.exe
  4. In the Command Arguments put the full path of you JS file
  5. Put a break point on your ActiveX code (on dllmain, or the constructor of your COM object)
  6. Hit F5
  7. Visual Studio will complain about lack of symbols of cscript. That's OK. keep going.
  8. You'll hit your breakpoint

Some point to consider:

  1. Setup the symbol path to include the Microsoft Symbols. This way, you'll see the names of the functions that calls your code (oleaut32.dll and friends).

Also, this is the default, but make sure that:

  1. The debugger type in the same property box would be either Native or Auto.

Upvotes: 1

Related Questions