Question

I want to analyse a program that i've written in KDevelop. I compile the Program and start it with

Right Click on the CMake Project -> Debug as... -> Native Application

Now the program runs in KDevelop and I can see the output on the console embedded into KDevelop. My program stops running when I press Ctrl+C" (SIGTERM). I can press it when I'm running the program in a console outside KDevelop.

How can I send the signal "SIGTERM" to the embedded console inside KDevelop?

As a workaround I can start htop, select the program and send a SIGTERM from there, which works fine although it would be nicer to have all the functionality in KDevelop itself.

Was it helpful?

Solution

One possible Solution is:

  • Right Click on the CMake Project -> Debug as... -> Native Application.
  • Change to the "gdb"-Tab inside KDevelop.
  • Hit the "Pause"-Icon on the right corner to enable the input field of the "gdb"-Tab
  • Type signal <Signal>, e.g. signal SIGTERM
  • The program continues and it catches the signal sent.

OTHER TIPS

Use the kill command to send a signal to a process. kill -l should provide you with a list of signals and their IDs.

For example, on FreeBSD, the SIGTERM signal is #15 as shown by this output:

$ kill -l
 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP
 6) SIGABRT      7) SIGEMT       8) SIGFPE       9) SIGKILL     10) SIGBUS
11) SIGSEGV     12) SIGSYS      13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGURG      17) SIGSTOP     18) SIGTSTP     19) SIGCONT     20) SIGCHLD
21) SIGTTIN     22) SIGTTOU     23) SIGIO       24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGINFO     30) SIGUSR1
31) SIGUSR2

So to send a SIGTERM to my process, I look up the process ID and then send it a kill command like so:

kill -15 <process ID>

You can send SIGINT from inside KDevelop:

Run -> Interrupt

However you can't send any other signal.

If you think that's an useful feature create a wish request on bugs.kde.org - eventually including an attached patch :D

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top