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

Port to VS Code #40

Closed
TrackerSB opened this issue Aug 25, 2021 · 13 comments
Closed

Port to VS Code #40

TrackerSB opened this issue Aug 25, 2021 · 13 comments
Labels

Comments

@TrackerSB
Copy link

How hard would it be to port this plugin for VS Code?
Both MSVS and VS Code use the VSIX format and both use the Debug Adapter Protocol Interface.

@awulkiew
Copy link
Owner

I don't know VSCode well enough to tell. VSIX is only a zip file containing some config files. This extension doesn't use the DAP directly (assuming it's what is used internally), it uses EnvDTE assembly which AFAIU is only in MSVS. Another problem is that it has to be possible to draw in a window and AFAIK it is not possible in VSCode. There might be a workaround for this, i.e. drawing to a file and displaying it, who knows. In addition to this it'd be nice to be able to access the memory of the debugged program directly to speed up the debugging. So with VSCode we'd probably need a separate program/library for that and this would be different on all of the platforms supported by VSCode. These are only my guesses but I think this'd be either impossible, very hard or be a maintnance hell. And I don't even have enough free time to look into this. But if you have I'd be curious to know the results.

@awulkiew
Copy link
Owner

@TrackerSB I looked into this and I think I know the majority of the pieces that would be needed, including reading from memory. It seems I was wrong and that writing an extension such as this is possible. I'll play with it but I don't know when it will be ready. Which parts of this extension would you like to see first?

@TrackerSB
Copy link
Author

TrackerSB commented Oct 17, 2021

Wow! I didn't expect that. Thank you. I also thought about how to implement such an extension. So far the most interesting part for me is reading the memory.

@nbwuzhe
Copy link

nbwuzhe commented Nov 2, 2021

Hi @awulkiew Thanks a lot for this useful tool. I'm also interested in porting it to VS Code since this is my most frequently used platform. Just curious whether it is difficult for the array plotting part to be converted to VS code extensions?

@mloskot
Copy link
Contributor

mloskot commented Nov 2, 2021

@nbwuzhe

Just curious whether it is difficult for the array plotting part to be converted to VS code extensions?

I'd start with search for existing solutions, for example, https://marketplace.visualstudio.com/items?itemName=hediet.debug-visualizer and read the code, and compare with this implementation for the big VS.
It's not difficult. It just needs time investment.

@awulkiew
Copy link
Owner

awulkiew commented Nov 2, 2021

@nbwuzhe I'm working on it right now in my free time. I have all building blocks figured out and am currently working on supporting user-defined containers like vector. When I have some basic version ready I'll make the repo public and release it.

I'm also waiting for a response for my issue at MIEngine. My primary concern is C++ and various debuggers may be used with VSCode. There is a problem with VSCode and GDB (maybe LLVM too I haven't checked). If a variable defined with typedef is debugged with GDB the type of variable returned with DAP is the name of the typedef, not the original type. This is also why MSVC natvis files may not work with VSCode and GDB. There are some issues about this at vscode-cpptools. If my issue at MIEngine is addressed then it should at least allow me to work around this. Without solving it such extension doesn't make sense for C++.

@nbwuzhe
Copy link

nbwuzhe commented Nov 2, 2021

@nbwuzhe

Just curious whether it is difficult for the array plotting part to be converted to VS code extensions?

I'd start with search for existing solutions, for example, https://marketplace.visualstudio.com/items?itemName=hediet.debug-visualizer and read the code, and compare with this implementation for the big VS. It's not difficult. It just needs time investment.

Hi Mateusz, thanks for your information. To be honest I tried that visualizer but it seems not to work at all for C++: only the first element of the array/vector is showing. I looked into the Issues of that repo with a similar report from the other users, but unfortunately, the author replied that he was not familiar with Cpp and could not help much.

@nbwuzhe
Copy link

nbwuzhe commented Nov 3, 2021

@nbwuzhe I'm working on it right now in my free time. I have all building blocks figured out and am currently working on supporting user-defined containers like vector. When I have some basic version ready I'll make the repo public and release it.

I'm also waiting for a response for my issue at MIEngine. My primary concern is C++ and various debuggers may be used with VSCode. There is a problem with VSCode and GDB (maybe LLVM too I haven't checked). If a variable defined with typedef is debugged with GDB the type of variable returned with DAP is the name of the typedef, not the original type. This is also why MSVC natvis files may not work with VSCode and GDB. There are some issues about this at vscode-cpptools. If my issue at MIEngine is addressed then it should at least allow me to work around this. Without solving it such extension doesn't make sense for C++.

Thanks for the detailed info. Currently I'm doing remote debugging using my Windows PC on a Linux server and it is easy to achieve with VS Code with SSH-Remote extension, however, Visual Studio 2019 is not supporting this way, and that's why I'm seeking to have your useful tool to be extended to VS Code. I'm trying to grab up your code in this repo to see how to help, but it might take some time. Thanks a lot for your efforts!

@mloskot
Copy link
Contributor

mloskot commented Nov 3, 2021

it is easy to achieve with VS Code with SSH-Remote extension, however, Visual Studio 2019 is not supporting this way

FYI, if your project is CMake-based, then remote debugging a program on Linux machine is also easy to configure:
https://docs.microsoft.com/en-us/cpp/build/configure-cmake-debugging-sessions?

@awulkiew
Copy link
Owner

awulkiew commented Nov 3, 2021

@nbwuzhe The extension for vscode is going to be different than this one, written in typescript, not in C#, using different APIs, etc. So it is not a port of this extension but another one written from scratch. I have it in a different repo which is currently private. As Mateusz said, it's best to search GitHub for extensions for vscode that are communicating with the debugger to see how this may be done. There are of course official references of APIs too.

While debugging remotely which debugger are you using?

@awulkiew
Copy link
Owner

awulkiew commented Nov 9, 2021

@TrackerSB @nbwuzhe @mloskot
I have developed the first version: https://github.com/awulkiew/graphical-debugging-vscode
We can move the discussion there.
As I mentioned typedefs doesn't work with GDB. If my issue is addressed at MIEngine I'll be able to work around it.

@nbwuzhe
Copy link

nbwuzhe commented Nov 9, 2021

@TrackerSB @nbwuzhe @mloskot I have developed the first version: https://github.com/awulkiew/graphical-debugging-vscode We can move the discussion there. As I mentioned typedefs doesn't work with GDB. If my issue is addressed at MIEngine I'll be able to work around it.

That's wonderful! Can't imaging that you done that so quick. Will give a test and give feedback.

And sorry for late reply, I'm using cppdbg while doing remote debugging.

@mloskot
Copy link
Contributor

mloskot commented Nov 9, 2021

Indeed, you've been amazingly quick, kudos!
Since I use VS Code heavily, I will try to try your extension out!

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

No branches or pull requests

4 participants