Receive signals for the process on the main thread by default


In Linux, signals sent to the process are by default received on the main thread, unless certain conditions are met (e.g. signal is blocked on the main thread). See https://code.woboq.org/linux/linux/kernel/signal.c.html#983 Yes this is not guaranteed strictly speaking, but the behaviour seems to be stable.

According to @autkin , Undo behaves differently when in recording mode. In other words, a signal sent to the process is not necessarily received by the main thread, even under normal circumstances.

It would be great to eliminate this discrepancy at least with a flag, since it can cause certain corner-cases in the debuggee which are otherwise very unlikely or even impossible to hit without Undo.

I’m actually mildly surprised to hear that LiveRecorder will exhibit different behaviour here. We certainly attempt to deliver signals to the task on which they’re received, whether that’s the process id (thread-group leader in Linux parlance) or not.

If we’re seeing observable difference in behaviour on which thread receives a signal when a process is recorded or not, then I there is a reasonable argument that we should consider that a bug.

Is this definitely what we’re seeing?

As an aside, note that there are different ways to send a signal - `kill`, `tkill` and `tgkill`. I presume we’re talking about `kill` here, as `tkill` and `tgkill` are precise and if there is any change of behaviour here it is definitely a bug!