CMAKE build and debug on different target Follow
CMake application build and debug works fine on one remote machine.
I need to build a debug cmake application on one target machine and after that start to debug it at another machine. Please tell me the correct and optimal way to achieve this.
Please sign in to leave a comment.
1. Is the machine for building a Docker container? Or is it a separate remote machine?
2. What OS does the local machine have?
2)both remote machines for building and debug are Linux, local machine is MacOS
This scenario is not fully supported at the moment. Feel free to comment or upvote a related feature request: https://youtrack.jetbrains.com/issue/CPP-22148. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.
As a workaround, you can do the following:
Tools | External Tools) to download the resulted binary to the local machine.
Now each time you launch the "Remote GDB Server" configuration, the project will be built on the "building machine" using the remote toolchain, then it will be downloaded to the local machine using the external tool, then it will be uploaded to the target machine and the debugging process will start.
Does this workaround work for you?
Thanks for reply
1) I created only one remote toolchain "Remote host for build"
2)I created external tool to download binary file from remote host. It works.
3)I added configuration "remote gdbserver".
if i choose in gdb filed "Bundled GDB" - after build, the local binary has been successfully uploaded to the remote debug machine, debugging starts, but breakpoints from code are ignored..
if I choose in gdb filed "Remote host GDB (from 'Remote host for build')" - after build, the local binary has been successfully uploaded to the remote debug machine, debug does not start -
It looks like the build machine is using the path from the local machine
>if i choose in gdb filed "Bundled GDB" - after build, the local binary has been successfully uploaded to the remote debug machine, debugging starts, but breakpoints from code are ignored
As I said earlier, that's expected - the path mapping fails in this case.
This one is unclear. Please enable debugger logging as described here, reproduce the issue and send the resulting idea.log file (`Help | Show Log in ...`) to clion-support at jetbrains.com. Do not forget to disable debug logging after that. Note that logs might contain private user's information (like file paths and names).
Also please send screenshots of your remote toolchain and the external tool along with the log.
Sorry, im not understand . We need run gdb from local machine or from build maschine? I added mapping paths and remote debug machine found symbol files , but then I got a message:
Process finished with exit code 0
^C^CGDB Server stopped, exit code 129
You didn't answer my question - we use BUNDLED GDB from a local machine or GDB from remote building machine?
In all the previous times when we came across a similar scenario, we suggested to use the remote GDB (GDB from remote building machine), as I already wrote in one of my previous comments in the point 7. Because when the local bundled GDB is used, the path mapping fails and breakpoints do not work, as you already noticed.
It's unclear why this method doesn't work for you, that's why I requested the log which you didn't provide.
Everything is correct. But it does not work because the building machine - is a cross compile building machine and has a different architecture (x86) and gdb on it simply cannot run the binary file intended for the arm architecture (target machine). can we run gdb on a target debug machine?
>can we run gdb on a target debug machine?
For now I don't see a way to do it, I'll consult with the developers.
>gdb on it simply cannot run the binary file intended for the arm architecture
Isn't is possible to install gdb-multiarch on the building machine (sudo apt install gdb-multiarch in case of Ubuntu, for example)?
Very strange , in this post https://intellij-support.jetbrains.com/hc/en-us/community/posts/4408376122002-Download-symbol-file-Makefile-project-from-remote-host all works (but there was a small binary and another project)
Yes, I could install gdb-multiarch , but available only 7.7.1 version
>Very strange , in this post https://intellij-support.jetbrains.com/hc/en-us/community/posts/4408376122002-Download-symbol-file-Makefile-project-from-remote-host all works (but there was a small binary and another project)
In that post the scenario was different: there were only two machines and compilation took place on the same machine where it was debugged.
>Yes, I could install gdb-multiarch , but available only 7.7.1 version
Then I kindly ask you to install gdb-multiarch and give it a try by selecting it in your remote toolchain and respectively in the "Remote GDB Server" configuration. Does it work?
It's very hard to read logs on the forum. Please send the idea.log file to clion-support at jetbrains.com, and we will continue to investigate the issue over email.