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

how to specify custom gdb path to Adapter #301

Open
wss29 opened this issue Sep 23, 2023 · 9 comments
Open

how to specify custom gdb path to Adapter #301

wss29 opened this issue Sep 23, 2023 · 9 comments

Comments

@wss29
Copy link

wss29 commented Sep 23, 2023

Hi,
I use cdt-gdb-vscode in eclipse theia application in linux. it is ok when I debug c++ code by default gdb. debug config as follows
{
"name": "c++ test",
"types": "gdb",
"request": "launch",
"program": "my c++ a.out",
"cwd": "${workspaceFolder}"
}
now I want to use my custom gdb to debug some specific c++ code. I set miDebuggerPath in configuration, but it seems that debugger still use default gdb, not my custom gdb. I am not sure whether miDebuggerPath is the right param. config as follow
{
"name": "custom gdb c++ test",
"types": "gdb",
"request": "launch",
"program": "my c++ a.out",
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"miDebuggerPath": "path/to/my/custom gdb"
}

@jonahgraham
Copy link
Contributor

The right option is "gdb". Try the autocomplete in the launch.json editor to explore the options and feel free to ask follow ups.

@wss29
Copy link
Author

wss29 commented Sep 23, 2023

The right option is "gdb". Try the autocomplete in the launch.json editor to explore the options and feel free to ask follow ups.

Hi,
I use the gdb option, but it seems that still use Linux default gdb, not the sparc-gdb I specify. Am I missing something?
image

@jonahgraham
Copy link
Contributor

That's weird the error says ENOENT which means it couldn't find the path. I'm surprised it displayed an error like that and still started a different gdb. Is the path passed as "gdb" work in the terminal? I wonder if you are experiencing a bug with encoding. Does it work if you put sparc gdb in /tmp?

@wss29
Copy link
Author

wss29 commented Sep 23, 2023

That's weird the error says ENOENT which means it couldn't find the path. I'm surprised it displayed an error like that and still started a different gdb. Is the path passed as "gdb" work in the terminal? I wonder if you are experiencing a bug with encoding. Does it work if you put sparc gdb in /tmp?

hi
before using cdt-gdt-vscode, we use ms-vscode.cpptools as the adapter for debug gdb, in cpptools the path works. We will try to test it in /tmp next Monday.

@jonahgraham
Copy link
Contributor

I look forward to your analysis. Your use case should work and if we find an issue in the adapter I'll be pleased to fix or help fix it.

@wss29
Copy link
Author

wss29 commented Sep 25, 2023

hi,
I tried copying spac-gdb to the tmp folder, and it still does not work. As you can see in the terminal spac-gdb works, but not by launch.json options.
image
image
image
image
image

@jonahgraham
Copy link
Contributor

The error message certainly matches up with the adapter not being able to find sparc-gdb - however I can't see why sparc-gdb isn't working.

I will point out that while you copied sparc-gdb to your /tmp, you didn't screenshot an updated launch.json that pointed at that gdb.

In addition I see this in your screenshots.

In this screenshot where you show sparc-gdb working:

image

the directory that contains sparc-gdb is different that what you entered in the "gdb" field of the launch.json:

image

Can you confirm that the paths are all correct?

@wss29
Copy link
Author

wss29 commented Sep 26, 2023

hi
I set the gdb path to tmp in launch.json. it works okay now, but I have another option that needs to be set. in cpp-tools it is 'miDebuggerServerAddress'. I look at options in cdt-gdb-vscode, and it seems that debuggerServer is , I try to give it value. but it is not work.
image

@jonahgraham
Copy link
Contributor

For remote connections use "type" --> gdbtarget and fill out the target section which has all the settings you expect, like host, port, server. If you use type = gdbtarget and request = launch, then the adapter will automatically start the gdbserver you specify in server - if you are launching the gdbserver manually (perhaps on another machine via ssh), you will probably want to use type = gdbtarget and request = attach

BTW Are you an end user or an extender?

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