eclipse-cdt-cloud / cdt-gdb-adapter

CDT GDB Debug Adapter
Eclipse Public License 2.0
27 stars 40 forks source link

Can cwd work in launch.json? #310

Closed wss29 closed 8 months ago

wss29 commented 8 months ago

hi, I use cdt-gdb-adapter in vscode,config in launch.json as follow { "type": "gdbtarget", "request": "attach", "name": "gdb-TARGET", "program": "E:\bm3823\sparc_demo\dacdemo\a.out", "gdb": "E:\gdb\sparc-gdb.exe", "target": {"host": "127.0.0.1","port": "9000","server": "gdbserver"} }, my problem is that

  1. the a.out is build in another computer, in that computer the source file is in D disk.
  2. I copy a.out to my computer into E disk
  3. when I debug use above config and try to insert break point, the debugger will try to find the source file in D, not my current opened folder image
  4. as you can see the left main.c is in D disk, the right main.c is my current opened project file. break point do not appear in E main.c
  5. I remember there is a cmd arg in config when use cpptools, but I try to set cwd in above it not work, how to deal with this situation in cdt-gdb-adapter?
jonahgraham commented 8 months ago

Thanks for the bug report! Where did you install the adapter from? In particular which version is it. I ask because this sounds like the bug I recently tried to fix in https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter/pull/306

wss29 commented 8 months ago

Hi, I use eclipse-cdt.cdt-gdb-vscode-0.0.103.vsix, I download from https://open-vsx.org/extension/eclipse-cdt/cdt-gdb-vscode. #306 is mine

jonahgraham commented 8 months ago

v0.0.103 doesn't include the fix. I'll publish a new version soon if possible.

306 is mine

What does this ^^^ mean?

wss29 commented 8 months ago

v0.0.103 doesn't include the fix. I'll publish a new version soon if possible.

306 is mine

What does this ^^^ mean?

haha, sorry for mistake, some copy paste error in replay

jonahgraham commented 8 months ago

Cross reference to what is holding up getting the fix in #306 on to open vsx: https://github.com/eclipse-cdt-cloud/cdt-gdb-vscode/pull/96#issuecomment-1783316667

jonahgraham commented 8 months ago

v0.0.104 is scheduled to be auto-published to openvsx overnight tonight and that should fix your issue. Please let me know if you still have issues once you update.

wss29 commented 8 months ago

hi, when I update to v0.0.104, I click debug and no response. image nothing in debugconsole, and I remove cwd option and debug still no reponse in v0.0.104. image when I use v0.0.103, I can debug it. image did I missing some setting in v0.0.104?

jonahgraham commented 8 months ago

did I missing some setting in v0.0.104?

No, you didn't miss anything. There is a critical error in v0.0.104, see https://github.com/eclipse-cdt-cloud/cdt-gdb-vscode/issues/104

jonahgraham commented 8 months ago

PS The default for cwd is the dirname of the program, so you shouldn't need to specify the cwd explicitly:

https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter/blob/1dc3d634c4d949d95fe154dedf11776505561ff4/src/GDBDebugSession.ts#L47-L48

wss29 commented 8 months ago

hi, it is a pitty, v0.0.105 still no response when debug, I check v0.0.103's package json, image v0.0.103 use follow line,but works, "program": "./node_modules/cdt-gdb-adapter/dist/debugAdapter.js" may be some other problem cause debug no response in v0.0.105

jonahgraham commented 8 months ago

I have tried 0.0.105 in both VSCode and Theia (cdt cloud blueprint) on both Windows and Linux and I cannot reproduce the problem you are seeing. Can you provide additional details?

wss29 commented 8 months ago

hi, I upload my demo project, you can open it with vscode and click debug you will get follow info when use 0.0.103 image but if you use 0.0.105,no response, nothing happen because my gdb size is bigger than 25M, I can not upload it to there.if you can get sparc-gdb.exe ENOENT when using 0.0.105, you can give a email , I will send my sparc-gdb to you.

dacdemo.zip

jonahgraham commented 8 months ago

@wss29 we're tracking this problem here: https://github.com/eclipse-cdt-cloud/cdt-gdb-vscode/issues/111