Skip to content

Debugging

Daniel Imms edited this page Dec 21, 2018 · 4 revisions

Windows

Before building make sure you set environment variable NODE_PTY_DEBUG to 1 to trigger a debug build.

  1. Download WinDbg: https://www.microsoft.com/en-us/p/windbg-preview/9pgjgd53tn86?rtc=1&activetab=pivot%3Aoverviewtab

  2. Build and run WinDbgX.exe node .\examples\fork\index.js

  3. One time setup to set paths:

    Open File > Settings, go to Debugging settings and set:

    • Source path to ...\src\win
    • Symbol path to ...\build\Debug
  4. Break when pty.node is loaded:

    sxe ld pty
    
  5. Go (and break at pty.node):

    g
    
  6. List modules (verify pty.node is loaded):

    lm
    
  7. Reload symbols:

    .reload /f
    
  8. Examine a function:

    x pty!PtyStartProcess
    

    You can then open the file by clicking pty!PtyStartProcess and ...\src\win\pty.cc links. Set a breakpoint by left clicking the gutter.

  9. Go:

    g
    

Debugging Winpty

On Windows, you can show the winpty agent console window by adding the environment variable WINPTY_SHOW_CONSOLE=1 to the pty's environment. See https://github.com/rprichard/winpty#debugging-winpty for more information.

Clone this wiki locally