This is an archive of the discontinued LLVM Phabricator instance.

debugserver: spawn process in its own process group
ClosedPublic

Authored by aarzilli on Jun 24 2022, 1:06 AM.

Details

Summary

Change POSIX spawn launch flavor to spawn process in its own process group, like the fork/exec flavor does.
This is useful because the target process can then be made controlling process for its tty and receive terminal signals (such as SIGINT generated in response to the user pressing ^C) without debugserver also receiving them.

Diff Detail

Event Timeline

aarzilli created this revision.Jun 24 2022, 1:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2022, 1:06 AM
aarzilli requested review of this revision.Jun 24 2022, 1:06 AM

Why is it desirable to have the debugger not see signals sent to the process?

Jim

Why is it desirable to have the debugger not see signals sent to the process?

Jim

Regardless of this patch, it is always possible to send signals directly to the target process. This is only about signals generated by the terminal.
Suppose you are debugging a program that does something in response to ^C: you will have to use kill in a different terminal to send the signal to the target process, because pressing ^C will send a signal to both debugserver and the target process, causing debugserver to die in response. I think it should be possible to set up the target process so that it has full control of its terminal, as it would be if it had been run outside of a debugger.

Seems to make sense to me, but I will let Jason Molenda give the final OK.

Jason? Are you ok with this?

Sorry for the delay in replying to this, I'm fine with integrating this change. I won't pretend to understand all the ins & outs of signal delivery to process groups, but the best way to find if there's an issue with this kind of change is to try it out. Do you have commit access to the repository?

Do you have commit access to the repository?

I do not.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 24 2022, 10:59 AM
This revision was automatically updated to reflect the committed changes.