Giter Site home page Giter Site logo

vscode-quickjs-debug's Introduction

QuickJS Debug for VS Code

This is a VS Code debug adapter for QuickJS.

QuickJS Debugger supports stepping, continue, breakpoints, evaluation, and variable access.

The official QuickJS release does not have any debugger support. The QuickJS Debugger requires a forked version of QuickJS, that has minimal changes necessary to support debugging.

Using QuickJS Debug

  • Install the QuickJS Debug extension in VS Code.
  • Build the QuickJS fork from koush.
  • Specify the qjs runtime path in .vscode/launch.json.
  • Switch to the debug viewlet and press the gear dropdown.
  • Select the debug environment "Launch QuickJS".
  • Press the green 'play' button to start debugging.

You can now step through the test.js file, set and hit breakpoints.

QuickJS Debug

Embedding

To listen for a connection in embedded quickjs (attach + connect with vscode debugger):

// address is in format "0.0.0.0:6666" to listen on all addresses on port 6666
void js_debugger_wait_connection(JSContext *ctx, const char* address);

To initiate a connection in embedded quickjs (attach + listen with vscode debugger):

// address is in format "192.168.1.66:6666" to connect to 192.168.1.66 on port 6666
void js_debugger_connect(JSContext *ctx, const char* address);

Alternatively, provide one of the following environment variables before starting the process embedded with QuickJS:

QUICKJS_DEBUG_ADDRESS or QUICKJS_DEBUG_LISTEN_ADDRESS with the same value as above.

Using these methods will block execution until the debugger has attached.

QuickJS does not provide an event loop, so the debugger should (optionally, but recommended) be periodically called from your event loop to check for messages. Otherwise, debugger messages may go unhandled until the next time Javascript is invoked. This can be done with:

void js_debugger_cooperate(JSContext *ctx);

Protocol

Protocol documentation is here.

vscode-quickjs-debug's People

Contributors

aweinand avatar chrisdias avatar isidorn avatar koush avatar weinand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-quickjs-debug's Issues

Support runtimeArgs in launch.json

Please add support for runtime parameters. It's currently not possible to add qjs params like --std and --include ....

Thanks for your work on this project! I find it extremely useful.

"Step Over" hangs

Hello, I followed the steps:

  1. I cloned https://github.com/koush/quickjs and ran make qjs-debug
  2. Installed the QuickJS Debugger extension from VS Code
  3. I opened the quickjs repo in VS Code and, from the VS Code window, I did RUN AND DEBUG > Attach QuickJS
  4. Finally, QUICKJS_DEBUG_ADDRESS=localhost:5555 ./qjs-debug test.js

I'm able to set the breakpoints in test.js, but if I keep pressing Step Over every once in a while it gets stuck. To get unstuck, I have to press Pause and then Step Over again.

Is that I known bug or am I doing anything wrong?
Thanks

debug typescript help

hi, koush,your work is very good, it make us could debug javascript in quickjs with vscode.

now, i want to debug typescirpt because my project use typescript, how could i do, please provide some guidance.

Source map support

I assume VSCode is able to handle source maps by parsing them out of the source code and grabbing them. Is it just a matter of finding the right call in VSC to use source maps from the browser/node based debugger? I wouldn't mind hacking it in, I'm just not sure how much of the work already exists in VSC itself. Has anyone ever looked into this?

SourceMap is not work?

I am using the qjs debug extension to debug js file on mac, and set breakpoints in index.ts file ,but can not stoped the program

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.