The best way to achieve this is to use GDB, now it can be very unpleasant to start, so I will show you how I did it in linux
- open a terminal and go to the project debug file and enter
gdbserver localhost:1234 ./myFile - open the clion project for myFile and in the upper right corner you will see everything that you built (or the name of your projects), click it and go to "edit configurations"
- in the upper left corner you should see a plus sign, click it and click "Remote GDB Debugging"
- then in type "target remote"
tcp:127.0.0.1:1234 - Next, in the "path mappings," click the plus
/location/to/file/myFile and enter /location/to/file/myFile (the same file as in 1.) both on the remote and local network - Click OK and in the upper right corner select the name of the configuration you just created and click debug
you may need to restart gdbserver again for this to work, but if you have completed all of the above steps, you should see a debug prompt, and on the terminal you will see that your project is running.
There are some limitations with this, for example, you always need to run the gdbserver localhost:1234 ./myFile on your terminal for it to work.
Some videos / documentation that helped me:
Hope this helps :)
source share