This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/Linux] Ask kernel to kill inferior when GDB terminates


On 11/19/2014 09:25 AM, Joel Brobecker wrote:
>>> I could see this making some sense when GDB has spawned the process,
>>> but it seems harsh when GDB has attached to the process instead
>>> of spawning it?
>>
>> Hmmm, good point. I'd like to verify what happens in that case, and
>> whether the process remains stopped or if execution resumes in that
>> case.
> 
> I took a little bit of time to experiment today. The experimentation
> was conducted with Linux 3.13.0-39-generic from x86_64 Ubuntu.
> In both cases, when GDB runs the program or attaches to a program,
> killing GDB while the inferior is still running detaches GDB from
> the inferior, which means it keeps running.

Sorry, I didn't realize you meant to verify what happens without
the patch.  Yeah, it's because the ptracer always detaches that
the option was introduced, not that long ago.

Note that with PTRACE_TRACEME there's still a time window between
starting to trace a task and setting its ptrace options, where
GDB could crash, and thus we can still miss killing the tracee.  To
completely close that, we'd have to switch to use the newer PTRACE_SEIZE
instead, which takes the ptrace options as argument, but that'd be
a story of its own.

> I will adapt my patch when I have a moment.

Thank you.

Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]