3
votes

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

1
In the bottom of the IDE I see this message: IBus prior to 1.5.11 may cause input problemsjose luis gonzalez clua
FYI: your issue seems to be caused by an unwanted "command timeout" during attaching and is tracked as youtrack.jetbrains.com/issue/CPP-7906, please feel free to vote. Disclaimer: I'm responsible for debuggers in CLion, and I'm aware of the logs you sent to our support channel.Eldar Abusalimov
BTW, As a workaround, you might try to specify sysroot in the debug configuration, I'd recommend to start with just /. More info here: sourceware.org/gdb/onlinedocs/gdb/…Eldar Abusalimov
Hi, I've tried adding sysroot, first as / and also using the path in the server where the program executable is deployed but neither had solved the issue. The only diffrence I've noticed is that using these settings the message "readchar: Got EOF" was displayed multiple times (8 times in former and 20 in latter) In CLion console I still get Command Time Out I really appreciate all the effort is being made to help. Thanks!jose luis gonzalez clua

1 Answers

5
votes

I met with the same problem. In my case root cause of problem was that absolute path to the project folder on target device was differ from absolute path on my local machine. After adding proper path mapping in Run/Debug Configuration dialog debugger start working.
For example:
Path Mapping:
server path: /home/ubuntu/src/yourprojectname/
local path: /home/michael/Documents/src/yourprojectname/