CLion launcher in a separate system terminal

I have an ncurses program that I would like to interactively debug using CLion. The problem is that when I run the program in CLion to debug it, the built-in console on which the program is running does not display the output of the ncurses program correctly.

I want the program to run in my system terminal so that I can normally see the output by debugging the program using the CLions debugger.

Is there any way to do this?

+6
source share
2 answers

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 :)

+3
source

In other debuggers, you will do this by running the ncurses application in the terminal and attach the debugger to the process using ncurses .

This avoids interference between ncurses (which changes the terminal I / O modes) and the debugger command line.

The attach function is the recently released CLions debugger function:

Further reading:

+2
source

All Articles