I want to show a PID at the beginning of my C++ program and send a wait signal, so, that I can run gdb - PID
in another terminal. Then by pressing run
in the gdb terminal, the program should continue.
If I use
pid_t pid = getpid();
cout << "PID = " << pid << endl;
raise(SIGSTOP);
I see this in the output
$ ./run
PID = 30261
[1]+ Stopped ./run
$
So, the program goes in the background and stops. On the other hand if I use SIGINT
, I see
$ ./run
PID = 8790
Caught signal: 2
$
How can I fix that?