Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Step Over" hangs #7

Open
eloparco opened this issue Oct 27, 2023 · 2 comments
Open

"Step Over" hangs #7

eloparco opened this issue Oct 27, 2023 · 2 comments

Comments

@eloparco
Copy link

eloparco commented Oct 27, 2023

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

@eloparco
Copy link
Author

eloparco commented Oct 27, 2023

If I attach with the debugger I can see that it hangs here https://github.com/koush/quickjs/blob/fe9aeaa703e3887866f3f32b217a27ee39b91268/quickjs-debugger-transport-unix.c#L29

Here is the stack trace:

thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x000000019ac6cacc libsystem_kernel.dylib`read + 8
    frame #1: 0x00000001000c3ca4 qjs-debug`js_transport_read(udata=0x0000000100206f90, buffer="00000081", length=9) at quickjs-debugger-transport-unix.c:29:19
    frame #2: 0x00000001000c1b00 qjs-debug`js_transport_read_fully(info=0x0000000100206558, buffer="00000081", length=9) at quickjs-debugger.c:16:24
    frame #3: 0x00000001000c08fc qjs-debug`js_process_debugger_messages(info=0x0000000100206558, cur_pc="!\xca\v\nLD\U00000002") at quickjs-debugger.c:443:14
    frame #4: 0x00000001000c1404 qjs-debug`js_debugger_check(ctx=0x0000000100405f00, cur_pc="!\xca\v\nLD\U00000002") at quickjs-debugger.c:669:9
    frame #5: 0x00000001000198f0 qjs-debug`JS_CallInternal(caller_ctx=0x0000000100405f00, func_obj=JSValue @ 0x000000016fdf7150, this_obj=JSValue @ 0x000000016fdf7140, new_target=JSValue @ 0x000000016fdf7130, argc=1, argv=0x000000016fdf7900, flags=0) at quickjs.c:16372:9
    frame #6: 0x000000010001b054 qjs-debug`JS_CallInternal(caller_ctx=0x0000000100405f00, func_obj=JSValue @ 0x000000016fdf9530, this_obj=JSValue @ 0x000000016fdf9520, new_target=JSValue @ 0x000000016fdf9510, argc=0, argv=0x000000016fdf9ce0, flags=0) at quickjs.c:16670:27
    frame #7: 0x000000010001b054 qjs-debug`JS_CallInternal(caller_ctx=0x0000000100405f00, func_obj=JSValue @ 0x000000016fdfb900, this_obj=JSValue @ 0x000000016fdfb8f0, new_target=JSValue @ 0x000000016fdfb8e0, argc=0, argv=0x000000016fdfc0d0, flags=0) at quickjs.c:16670:27
    frame #8: 0x000000010001b348 qjs-debug`JS_CallInternal(caller_ctx=0x0000000100405f00, func_obj=JSValue @ 0x000000016fdfdce0, this_obj=JSValue @ 0x000000016fdfdcd0, new_target=JSValue @ 0x000000016fdfdcc0, argc=0, argv=0x0000000000000000, flags=2) at quickjs.c:16706:27
    frame #9: 0x000000010000e354 qjs-debug`JS_CallFree(ctx=0x0000000100405f00, func_obj=JSValue @ 0x000000016fdfe4b0, this_obj=JSValue @ 0x000000016fdfe4a0, argc=0, argv=0x0000000000000000) at quickjs.c:18750:19
    frame #10: 0x000000010004f1c8 qjs-debug`js_evaluate_module(ctx=0x0000000100405f00, m=0x0000000100510b60) at quickjs.c:28361:19
    frame #11: 0x000000010002576c qjs-debug`JS_EvalFunctionInternal(ctx=0x0000000100405f00, fun_obj=JSValue @ 0x000000016fdfe680, this_obj=JSValue @ 0x000000016fdfe670, var_refs=0x0000000000000000, sf=0x0000000000000000) at quickjs.c:33582:19
    frame #12: 0x0000000100025648 qjs-debug`JS_EvalFunction(ctx=0x0000000100405f00, fun_obj=JSValue @ 0x000000016fdfe6c0) at quickjs.c:33597:12
    frame #13: 0x0000000100002634 qjs-debug`eval_buf(ctx=0x0000000100405f00, buf=0x0000000100510770, buf_len=971, filename="test.js", eval_flags=1) at qjs.c:65:19
    frame #14: 0x00000001000027a8 qjs-debug`eval_file(ctx=0x0000000100405f00, filename="test.js", module=1) at qjs.c:100:11
    frame #15: 0x0000000100002228 qjs-debug`main(argc=2, argv=0x000000016fdfedd8) at qjs.c:522:17
    frame #16: 0x000000019a953f28 dyld`start + 2236

@eloparco
Copy link
Author

I spent some time investigating, but I couldn't find much.
I could only see that, when the debugger was getting stuck, it was because a StackTrace request was sent by vscode, but no following Scopes request was being made. And it seemed that quickjs was waiting on that one.

So I decided to try an older vscode version (I went to the one from October 2021) and there the problem doesn't appear.
Not sure if that's a bug in the most recent vscode versions or the fact that this repo is using an old vscode-mock-debug template not compatible with newer versions of vscode (for instance, now the vscode module has been deprecated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant