Git Product home page Git Product logo

cdt-gdb-vscode's Introduction

VS Code Debug Extension for GDB

Note: This is a preliminary milestone release. Please help us by trying out this extension and providing feedback using our github issues page.

This is a Visual Studio Code extension that supports debugging using gdb and any other debugger that supports the MI protocol. It is built by the experts that provide the gdb support in the Eclipse C/C++ IDE (CDT).

This extension provides a number of features that integrate into the Visual Studio Code debug environment. This includes launch types, support for the standard debug views as well as a custom viewer for memory browsing.

Launch Settings

TODO

Memory Browser

TODO

Building

Building the extension

We use yarn to as our package manager. To build, simply do

yarn
yarn build

You can also run the build in watch mode using

yarn watch

Co-developing cdt-gdb-adapter

If you are working on the cdt-gdb-adapter you can check it out to a different location and then link it in.

From the cdt-gdb-adapter project run

yarn link

Then from this project run

yarn link cdt-gdb-adapter

You can set up a VS Code workspace that has both folders. Also make sure you have builds running in each folder to pick up updates.

cdt-gdb-vscode's People

Contributors

adhamragabmchp avatar alicetrifu avatar colin-grant-work avatar dependabot[bot] avatar dschaefer avatar eclipse-cdt-bot avatar eclipsewebmaster avatar jonahgraham avatar kummallinen avatar mkuznyetsov avatar paul-marechal avatar quocdobv avatar quyettrinhrvc avatar thamho0902 avatar trongle0504 avatar

Stargazers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cdt-gdb-vscode's Issues

Add Registers viewlet

Create a viewlet to show the registers using something similar to 'info registers'.

This will need work in the cdt-gdb-adapter to provide the information.

Adding languages other than c/cpp

Hello,

GDB supports some languages besides than c/cpp. I've tried to add Ada to the language list and it seems the DAP server works.

Would you consider to add other languages to package.json? I can send a PR for Ada or for other languages too.

CI: build, testing (possibly with codecov), vsix artifact

This would help to check the quality of PRs / commits and also enables users to manually test the results of un-merged PRs, as well as locally using this extension until #40 #42 are solved (and even then as likely not each commit will result in an updated vsix release).

update to support newer vscode debugadapter functions

Both the debug adapter protocol (DAP) and the vscode counterpart had different "updates" since this was created.
Things like inline values, set and query memory directly and possibly a lot more are on the table.

The question is: Are there plans to maintain this extension for the future and add those here? If yes it may help to do some planning and creating issues for every feature "missing", so people both know about the state (including "accepts PR", if this is the case) and about the possible changes of those.

Publish cdt-gdb-vscode to NPM

Currently cdt-gdb-adapter is published to NPM but not cdt-gdb-vscode

It would be useful for extenders if cdt-gdb-vscode was also published

How to deal with native modules

The cdt-gdb-adapter now has some native code. I don't think this will be a one off as there are some really good native modules out there for things like USB enumeration for finding USB serial devices used for debugging, for example.

node.js generally struggles with native modules and the norm is for modules to be built by the consumer at npm install time using gyp. Electron which usually has a node version different than the one running npm has electron-rebuild to rebuild the native libraries for it's version.

VS Code adds a layer of complexity on top of that as evidence in this issue: microsoft/vscode#658.

And I imagine Theia has a similar issue, though Theia seems to be built for every product that uses it, i.e., you don't just download Theia like you do VS Code. So maybe it has more control.

We also don't want to assume users have native build environments installed on their machines to build these at extension install time (or do we, hopefully not). So how do we deal with this?

The worse case scenario is that we have to build the libraries for every version of VS Code we want to support (and how do we decide) and either bundle them with the extension or have a downloader in the extension to fetch the right one. Yuck. Way open to ideas here.

Can not wait for user input with getchar() at least

For now I was only able to get the user input properly with the Microsoft C++ extension.

I'm expected to see : Press enter to continue... when the program is started.

No possible interation :
Started
Stopped

The command line is ok :
The command line is ok.

ps: I can hit the breakpoints normally.

(Configuration) problem with remote debugging from x86_64 to aarch64

Hello,

I am trying out the cdt-gdb-vscode extension in eclipse Theia on Windows.
I want to attach to a gdbserver that is already running on localhost.

I tried it with the native-debug extension and it works out of the box (https://open-vsx.org/extension/webfreak/debug).

However using the cdt-gdb-vscode extension I cannot pause the execution of the target and I get no thread name.
My launch configuration looks like the following

{
"name": "Attach to VDK (CDT)",
"type": "gdbtarget",
"request": "attach",
"program": "<path to executable>",
"gdb": "<path to aarch64-linux-gnu-gdb>",
"verbose": "false",
"openGdbConsole": "true",
"target": {
"host": "<host>",
"port": "<port>"
}

The way the debug UI looks like
image

In the Debug console I can also see messages that indicate success of pausing the main thread:
From client: pause({"threadId":1})
To client: {"seq":0,"type":"response","request_seq":9,"command":"pause","success":true}

However the executable is not suspended, and the UI also does not indicate the target as suspended.

Are there still known limitations or do you have any idea what might be wrongly configured?

Thanks and best regards,
Jan

Simplify migration from cpptools

One goal of ours is to provide a more GNU/embedded development friendly extension for VS Code that is developed fully in the open. Many VS Code users are using (and struggling with) Microsoft's extension for C++, cpptools.

To help those users migrate to CDT's extension, we should strive to make it easy to convert launches. In theory, it should be a simple as changing the launch type. We should strive to use the same arguments.

First, find out what the cpptools launch settings are. Then plan how to support them.

Discussion: Remove Memory Browser

The VSCode Memory Inspector is a sister project in CDT Cloud that derives ultimately from an enhancement of the Memory Browser in this repository. Would it make sense to remove the Memory Browser code from this repository and direct users to the Memory Inspector in some way?

@thegecko as a Memory Inspector contributor. @asimgunes as a consumer of the exports here.

UI Test Strategy

Now that we have an incoming Memory Browser that uses vscode's webview API and React, how do we test such a thing?

This would include unit testing the components, testing of the UI while mocking out the back end server (i.e. the extension), and end to end testing in vscode (if that's even possible?)

With multiple real target launches, debug operation changes call stack selection

I'm testing using two debug launches (Real hardware debugging) in windows, cdt-gdb-vscode v0.0.108 is used. When continuously stepping on one launch, with other launch suspended, the call stack suddenly switches to suspended launch. If I continue stepping, the second launch is being stepped.

This is a wired behavior. Please let me guide on where to be focused to fix the issue.

Note : Issue is not reproducible with local debugging (Tried using amalgamator workspace https://github.com/eclipse-cdt-cloud/cdt-amalgamator )

@jonahgraham @MatthewKhouzam @thegecko @marco-miller

image

Extension availability for VSCode users ?

[Question] :
I try to find a common set of extensions working on VSCode, VSCode Remote and GitPod. I'm interested in C/C++ and Ada development.
Is there any chance to see this extension available on the Microsoft VSCode registry?

Thanks for the extension on GitPod already ! ;)

v0.0.106: Can't launch debugger

Download source: https://open-vsx.org/api/eclipse-cdt/cdt-gdb-vscode/0.0.106/file/eclipse-cdt.cdt-gdb-vscode-0.0.106.vsix.
Issue: After having a valid launch.json file and clicking "Start Debugging", something appears under "Threads" but quickly disappears. The debug session doesn't start.
image
I don't think this was introduced by the change in v0.0.106 - MI parser fix. The last working version we used in our IDE was v0.0.103. So I think the issue might be introduced by the packaging change or some change between v0.0.103 and v0.0.106.

yarn error

I download this project and run "yarn",but it comes to errors, how can I fix it:

yarn install v1.22.0
[1/5] Validating package.json...
warning [email protected]: The engine "vscode" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
[1/2] ⡀ cdt-gdb-adapter
error E:\code\cdt-gdb-vscode\node_modules\cdt-gdb-adapter: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: E:\code\cdt-gdb-vscode\node_modules\cdt-gdb-adapter
Output:
E:\code\cdt-gdb-vscode\node_modules\cdt-gdb-adapter>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.7.3 found at "D:\Python3\python.exe"
gyp info find VS using VS2017 (15.5.27130.2024) found at:
gyp info find VS "D:\Microsoft Visual Studio 2017"
gyp info find VS run with --verbose for detailed information
gyp info spawn D:\Python3\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\code\\cdt-gdb-vscode\\node_modules\\cdt-gdb-adapter\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dmodule_root_dir=E:\\code\\cdt-gdb-vscode\\node_modules\\cdt-gdb-adapter',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'E:\\code\\cdt-gdb-vscode\\node_modules\\cdt-gdb-adapter\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 547, in main
    return gyp_main(args)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
    options.duplicate_basename_check)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 139, in Load
    params['parallel'], params['root_targets'])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 2779, in Load
    variables, includes, depth, check, True)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 391, in LoadTargetBuildFile
    includes, True, check)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 263, in LoadOneBuildFile
    aux_data, includes, check)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 300, in LoadBuildFileIncludesIntoDict
    LoadOneBuildFile(include, data, aux_data, None, False, check),
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 233, in LoadOneBuildFile
    build_file_contents = open(build_file_path, 'rU').read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 2353: illegal multibyte sequence
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\code\cdt-gdb-vscode\node_modules\cdt-gdb-adapter
gyp ERR! node -v v12.16.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

Not breaking at Breakpoint when Debugging

When I try to use cdt-gdb-vscode to achieve debugging of cpp files in Theia with GDB, the code doesn't break at breakpoint, the breakpoint is faded and when I hover over a message saying r -break-insert: Unknown option ``-source'' is shown . I use the below Launch.json configuratoin

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "launch",
"name": "Debug (GDB)",
"program": "${workspaceFolder}\HelloWorld.exe"
}
]
}

Error (On hover near breakpoint):
image

Open VSX Registry: Awareness and Important Steps

@marcdumais-work has published this extension in the Open VSX Registry.

The service was recently transferred to the Eclipse Foundation and we want to ensure a seamless transition for our users. To ensure uninterrupted service and more exposure for your extension, I recommend the following.

To the maintainers: If you would like to take over publishing to open-vsx.org, here’s how: https://github.com/eclipse/openvsx/wiki/Publishing-Extensions

Claiming ownership of the namespace for your extension(s). To find out how to do this, see:
https://github.com/eclipse/openvsx/wiki/Namespace-Access
As owner you can add more namespace members (including service accounts) yourself in https://open-vsx.org/user-settings/namespaces. Note that publishing can be done by any contributor to the extension, namely those you add as namespace members once they have signed the Publisher Agreement as well.

Useful links:
Eclipse Publisher Agreement
Eclipse Foundation Open VSX Registry Frequently Asked Questions (FAQ)

More details are in these recent blog posts:
https://blogs.eclipse.org/post/brian-king/open-vsx-registry-under-new-management
https://blogs.eclipse.org/post/brian-king/new-era-open-vsx-registry

Today, there’s growing momentum around open source tools and technologies that support Visual Studio (VS) Code extensions. Leading global organizations are adopting these tools and technologies. This momentum has spurred demand for a marketplace without restrictions and limitations. We hope you join us on this journey as we continue to build the Open VSX community.
We look forward to continued innovation from you in 2021!

Add Memory webview

Using the React component provided by the cdt-gdb-adapter for memory, create a webview panel to show memory.

How to spawn gdb with superuser permission (sudo)?

I installed cdt-gdb-vscode in VS Code on Windows, and opened a folder in Remote WSL mode. Then start debugging, gdb says ptrace: Operation not permitted. The same warning is shown when I use bash instead. But in bash, debugging session works via sudo gdb attach xxxcommand. So how to launch "sudo gdb" to start debugging? Thanks for replying!

launch.json configurations is:

        {
            "type": "gdb",
            "request": "attach",
            "name": "linux",
            "gdb": "gdb",
            "processId": "${command:askProcessId}",
            "program": "/usr/bin/vi",
            "verbose": "true",
        }

Distribution / Publishing

IIRC to be distributed correctly, this extension will have to be compiled once on each major platform and then somehow uploaded to the VS Code marketplace.

Right now to be able to use it in Theia for instance, I compile it and make a release on a fork.

Was just wondering if there was some kind of publishing made with this package as of now?

This issue can also be used to track this, until the CI is up and running.

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.