Here is my scenario:
I am able to debug using terminal with these commands:
- gdb myprog
- break myprog.c:4115
- run --myarg
- the breakpoint works and I can step in the program
I try the remote debug using CLion 16.2.2 in Fedora System:
- in server I run: gdbserver localhost:8080 myprog --myarg
- I get this: Process data created; pid = 80199 Listening on port 8080
- In Linux client with CLion:
- Settings / Deployment / configure SFTP (upload and download working fine)
- Download all files from server
- Edit Configuration
- Create new GDB Remote Debug:
- GDB: Default (Bundled)
- Target: tcp:193.101.144.128:8080
- Symbol file: {blank}
- Sysroot: {blank}
- Path Mapping: server path and local path
- Run the debugger
- on the server terminal I see:
- Remote debugging from host 172.24.10.2 (this makes me believe I am close)
- address_string = T:servername:4311
- In CLion console I see:
- Debugger connected to tcp:193.101.144.128:8080 (connection works!)
Although it seems the connection from the GDB server and client is working it seems I am missing something because the debugger tools (step in, step over, continue, etc.) remain grayed out and the breakpoints are never reached.
From the first test I know that the breakpoints I am using should work.
I suspect the way I am using to pass in the program argument (--myarg) in this line: gdbserver localhost:8080 myprog --myarg its not right but I don't know where else to pass it.
I am looking forward to be able to debug using this awesome IDE rather than using the terminal. I am close but got stucked here. I really appreciate some help!
Thank you
sysroot
in the debug configuration, I'd recommend to start with just/
. More info here: sourceware.org/gdb/onlinedocs/gdb/… – Eldar Abusalimov