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

Using of hello_debugger with VSCode on Windows #12

Closed
Elias-Johansson opened this issue Jan 17, 2020 · 7 comments
Closed

Using of hello_debugger with VSCode on Windows #12

Elias-Johansson opened this issue Jan 17, 2020 · 7 comments

Comments

@Elias-Johansson
Copy link

Hello Ben,

thank you very much for your project! Could you clarify whether it is possible to use hello_debugger with VSCode on Windows? It built and installed without errors. So I can find google.cppdap-example-hello_debugger-1.0.0 in my .vscode\extensions and VSCode shows that google.cppdap-example-hello_debugger-1.0.0 is enabled. My launch.json looks like this:

{
"version": "0.2.0",
"configurations": [
{
"name": "cppdap: hello_debugger",
"type": "hello_debugger",
"request": "launch"
}
]
}

However, when I choose "cppdap: hello_debugger" and start debugging, nothing happens. Log (Window) reports the following errror:

[2020-01-17 15:24:36.857] [renderer1] [error] timeout after 500 ms: Error: timeout after 500 ms
at t.RawDebugSession.handleErrorResponse (file:///C:/Users/Elias/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2821:819)
at file:///C:/Users/Elias/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2821:250
at async t.RawDebugSession.shutdown (file:///C:/Users/Elias/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2819:336)

--
Thanks Elias.
@ben-clayton
Copy link
Contributor

Hi @Elias-Johansson,

I'm sorry you're having difficulties running the example.
I just tried the example on Linux, which worked as expected.
I wrote the example on macOS, and I don't think I've changed anything since that was last tested.
Which leaves Windows...

Unfortunately I don't currently have a Windows machine to hand to test this on. I will have one next week, so I will try testing then.

Before then, do you get any useful information when enabling the LOG_TO_FILE macro in hello_debugger.cpp?

Many thanks,
Ben

@Elias-Johansson
Copy link
Author

Hi @Elias-Johansson,

I'm sorry you're having difficulties running the example.
I just tried the example on Linux, which worked as expected.
I wrote the example on macOS, and I don't think I've changed anything since that was last tested.
Which leaves Windows...

Unfortunately I don't currently have a Windows machine to hand to test this on. I will have one next week, so I will try testing then.

Before then, do you get any useful information when enabling the LOG_TO_FILE macro in hello_debugger.cpp?

Many thanks,
Ben

I tried to enable the definition of the LOG_TO_FILE macro and specify the path to the existing file (#define LOG_TO_FILE "C:/Users/Elias/Documents/log.txt"). For some reason, it logs nothing.
--
Thanks Elias.

@Elias-Johansson
Copy link
Author

Ben,

I manually changed "program": "hello_debugger" to "program": "hello_debugger.exe" in .vscode\extensions\google.cppdap-example-hello_debugger-1.0.0\package.json. Subsequently, I disabled and enabled google.cppdap-example-hello_debugger-1.0.0 again in VSCode extensions.
Now it logs the attached data.

log.txt

However, I cannot step over and toggle breakpoints. As far as I understand, hello_debugger generates the synthetic file source. Is it possible to interactively debug the synthetic file source as a usual file, which is opened in VSCode?

--
Thanks Elias.

@ben-clayton
Copy link
Contributor

Hi Elias,

Yes, the executable extension is probably quite important. Good find. :)
I'll be sure to update the CMake template generation to add this suffix to the program name.

The log file suggests that the debugger hasn't responded to the initialize request, which is odd. However, this might just be a lack of file flushing. Is there any more content in the file if you close VSCode after attempting to use the sample debugger?

However, I cannot step over and toggle breakpoints. As far as I understand, hello_debugger generates the synthetic file source. Is it possible to interactively debug the synthetic file source as a usual file, which is opened in VSCode?

Yes, that is the intended behaviour of the example. When I make it back home, I'll try and reproduce on my Windows box.

Cheers,
Ben

@Elias-Johansson
Copy link
Author

Hi Ben,

Yes, the executable extension is probably quite important. Good find. :)
I'll be sure to update the CMake template generation to add this suffix to the program name.

The log file suggests that the debugger hasn't responded to the initialize request, which is odd. However, this might just be a lack of file flushing. Is there any more content in the file if you close VSCode after attempting to use the sample debugger?

Yes, it adds the following:

"Content-Length: 79

{"command":"disconnect","arguments":{"restart":false},"type":"request","seq":2}"

I've attached the updated log file.

log_new.txt

However, I cannot step over and toggle breakpoints. As far as I understand, hello_debugger generates the synthetic file source. Is it possible to interactively debug the synthetic file source as a usual file, which is opened in VSCode?

Yes, that is the intended behaviour of the example. When I make it back home, I'll try and reproduce on my Windows box.

Thanks.

--
Best,
Elias

ben-clayton added a commit to ben-clayton/cppdap that referenced this issue Jan 17, 2020
Without this the vscode extension cannot find the example executable, and the example fails.

Also use $USERPROFILE instead of  $HOME for finding the `.vscode` user directory for installing the extension.

Bug: google#12
ben-clayton added a commit to ben-clayton/cppdap that referenced this issue Jan 17, 2020
`std::atomic<bool>` does not default initialize to `false`.

Bug: google#12
ben-clayton added a commit to ben-clayton/cppdap that referenced this issue Jan 17, 2020
On windows text mode for these plays with newline escape sequences, breaking the ContextStream encoding.

Fixes: google#12
ben-clayton added a commit to ben-clayton/cppdap that referenced this issue Jan 17, 2020
Without this the vscode extension cannot find the example executable, and the example fails.

Also use $USERPROFILE instead of  $HOME for finding the `.vscode` user directory for installing the extension.

Bug: google#12
ben-clayton added a commit to ben-clayton/cppdap that referenced this issue Jan 17, 2020
`std::atomic<bool>` does not default initialize to `false`.

Bug: google#12
ben-clayton added a commit to ben-clayton/cppdap that referenced this issue Jan 17, 2020
On windows text mode for these plays with newline escape sequences, breaking the ContextStream encoding.

Fixes: google#12
@ben-clayton
Copy link
Contributor

Hi @Elias-Johansson,

Thank you for your patience. Lots was broken - my apologies.

I've created PR #13 that should fix your issues.

It's also worth mentioning you'll need to enable VSCode's Debug: Allow Breakpoints Everywhere option in order to be able to set the breakpoint in the synthetic file.

Please let me know how you get on.

Thanks,
Ben

ben-clayton added a commit that referenced this issue Jan 17, 2020
Without this the vscode extension cannot find the example executable, and the example fails.

Also use $USERPROFILE instead of  $HOME for finding the `.vscode` user directory for installing the extension.

Bug: #12
ben-clayton added a commit that referenced this issue Jan 17, 2020
`std::atomic<bool>` does not default initialize to `false`.

Bug: #12
@Elias-Johansson
Copy link
Author

Hi Ben,

Everything works fine. Thanks for the quick response and fix!

--
Best,
Elias

Thank you for your patience. Lots was broken - my apologies.

I've created PR #13 that should fix your issues.

It's also worth mentioning you'll need to enable VSCode's Debug: Allow Breakpoints Everywhere option in order to be able to set the breakpoint in the synthetic file.

Please let me know how you get on.

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

2 participants