This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA/Linux] Ask kernel to kill inferior when GDB terminates
- From: Pedro Alves <palves at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 19 Nov 2014 09:58:44 +0000
- Subject: Re: [RFA/Linux] Ask kernel to kill inferior when GDB terminates
- Authentication-results: sourceware.org; auth=none
- References: <1415984034-27122-1-git-send-email-brobecker at adacore dot com> <54663729 dot 6010708 at redhat dot com> <20141114173255 dot GD5774 at adacore dot com> <20141119092547 dot GP5774 at adacore dot com>
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