Script Debugger Microsoft

Microsoft Script Debugger is relatively minimal debugger for Windows Script Host-supported scripting languages, such as VBScript and JScript. Its user interface allows the user to set breakpoints and/or step through execution of script code line by line, and examine values of variables and properties after any step. In effect, it provides a way for developers to see script code behavior as it runs, thus eliminating much of the guess-work when things don't quite work as intended.

Microsoft considers it to be deprecated in favor of the more sophisticated Microsoft Script Editor (MSE.EXE),[citation needed][1] an optional tool included in Microsoft Office 2000[2] through Office 2007.[3] Also, Internet Explorer 8 comes with a different, tightly integrated JScript debugger part of the Internet Explorer Developer Tools.[4]

Features[edit]

According to Microsoft, the Script Debugger provides these traditional debugging features:[5]

Windows never shipped with a VBScript debugger. Microsoft once had a (very minimalistic) script debugger in the download area, but it has been removed long ago. If you still have the installer somewhere it might still work on Windows 10 (haven't tested, though).

  • Ability to set and clear breakpoints.
  • Ability to step through and over procedures.
  • Ability to display and change the values of variables and properties.
  • Ability to evaluate expressions.
  • Ability to view the call stack, and navigate to any currently loaded procedure.

Additionally, it can open and edit HTML pages, and it supports script colorization for improved readability.[5]

Limitations[edit]

Debugger

The debugger has several limitations, including the following:[6]

  • The line indicator may be incorrect when stepping through inline JScript or debugging a framed document.
  • When debugging documents open in Internet Explorer, only one can be debugged at a time.
  • Commands typed in the Command window have no effect unless the user is in break mode.
  • A breakpoint immediately after a Document.Write is ignored.
  • Entering a Document.Write command while debugging, or refreshing a document in Internet Explorer while debugging it, can cause hangs or other unexpected behavior.
  • Unlike in other debuggers, there is no Watch window for monitoring variables; they must be checked via manual commands.
  • Unlike in other debuggers, breakpoints can't be set by clicking in the left margin; they must be set via keypress or menu.

Usage[edit]

After installation, new options can be found in Internet Explorer'sScript Debugger menu, which gets added in the View menu. Debugging can optionally be turned off from the Advanced tab in the Internet Options dialog.

See also[edit]

Microsoft script debugger latest version

References[edit]

Microsoft script debugger install
  1. ^The download details page indicates Script Debugger is deprecated, but doesn't say in favor of what. It could be MSE, but it could also be Visual Studio.
  2. ^'DLL Help Database info on MSE.EXE version 6.1.83.92'. Microsoft. Archived from the original on 2009-01-30. Retrieved 2009-09-08.
  3. ^'2007 Microsoft Office System Known Issues/ReadMe'. Microsoft. Archived from the original on 2009-09-07. Retrieved 2009-09-08. Excel 2007 Question or Issue: Microsoft Script Editor is no longer available. Answer: MSE will no longer be supported in Excel 2007.
  4. ^'Discovering Internet Explorer Developer Tools'. Microsoft. Retrieved 2009-08-08.
  5. ^ ab'Introduction to Microsoft Script Debugger for Internet Explorer'. Microsoft. Retrieved 2009-09-08.
  6. ^'Contents of Script Debugger Release Notes'. Microsoft. June 23, 2005. Retrieved 2009-09-08.
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Microsoft_Script_Debugger&oldid=918848649'
-->

This topic provides the following user and kernel mode JavaScript code samples.

Microsoft GitHub Repo Example Scripts

The debugger team hosts a GitHub repo that contains example JavaScript scripts and extensions.

You can find it at - https://github.com/Microsoft/WinDbg-Samples

The readme file describes the current example code that is available.

Working with Samples

Use the general process to test any of the samples.

  1. Determine if the sample JavaScript is intended for kernel or user mode debugging. Then either load an appropriate dump file or establish a live connection to a target system.

  2. Use a text editor such as Notepad to create a text file named and save it with a .js file extension, such as HelloWorld.js

  1. Use the .load (Load Extension DLL) command to load the JavaScript provider.

Script Debugger Microsoft 10

  1. Use the .scriptrun (Run Script)command to load and execute the script. The .scriptrun command will run code at the root/top and the code under the function names initializeScript and invokeScript.
  1. If the script contains a uniquely named function, use the dx command to execute that function, that is located in Debugger.State.Scripts.ScriptName.Contents.FunctionName.

Refer to JavaScript Debugger Scripting for additional information about working with JavaScript.

Determining process architecture

This JavaScript code adds a property called 'ProcessArchitecture' on to the debugger object model process object to indicate if the process is x86 or x64.

This script is intended to support kernel mode debugging.

Either load a kernel dump file or establish a kernel mode connection to a target system. Then load the JavaScript provider and the sample script.

Use the dx command to display the process architecture of the current process.

Note that this sample code may not always be able to determine the architecture correctly. For example in certain cases working with dump files when you are using the 32-bit debugger.

Data Filtering: Plug and Play Device Tree in KD (Kernel Mode)

This sample code filters the device node tree to display just devices that contain a path of PCI that are started.

This script is intended to support kernel mode debugging.

You can use the !devnode 0 1 command to display information about the device tree. For more information, see !devnode.

Either load a kernel dump file or establish a kernel mode connection to a target system.

Call the filterAllDevices() function.

Each of these objects presented above, automatically supports DML, and can be clicked through just as with any other dx query.

Alternatively to using this script, it is possible to use a LINQ query to accomplish a similar result.

Extend Devices Specific To Multimedia (Kernel Mode)

This larger JavaScript example extends a kernel _DEVICE_OBJECT for information specific to multimedia and adds StreamingDevices to a debugger session.

Microsoft Script Editor Download

This script is intended to support kernel mode debugging.

Note that the choice to extend Session with StreamingDevices is done for example purposes only. This should be either left to _DEVICE_OBJECT only or deeper inside a namespace under the existing .Devices.* hierarchy.

First load the script provider as described previously. Then load the script.

Then use the dx command to access the new StreamingDevices capabilities that the script provides.

Adding Bus Information to _DEVICE_OBJECT (Kernel Mode)

This script extends the visualization of _DEVICE_OBJECT to add a BusInformation field which has PCI specific information underneath it. The manner and namespacing of this sample are still being discussed. It should be considered a sample of the capabilities of the JavaScript provider.

Microsoft Script Debugger For Uft

This script is intended to support kernel mode debugging.

First load the script provider as described previously. Then load the script.

We need to locate the address of the device object we are interested in. In this example, we will examine the audio HDAudBus driver.

After the script is loaded use the dx command to display bus information for device objects.

Find an Application Title (User Mode)

This example iterates through all the threads in the debugger's current process, finds a frame which includes __mainCRTStartup and then returns the string from the StartupInfo.lpTitle within the CRT's startup. This script shows examples of iteration, string manipulation, and LINQ queries within JavaScript.

This script is intended to support user mode debugging.

Calling the findTitle() function returns notepad.exe

Calling the LINQ version, findTitleWithLINQ() also returns notepad.exe

Related topics