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

Joel Brobecker brobecker@adacore.com
Mon Dec 15 20:43:00 GMT 2014


> I think we can get by without adding a new field.  The process_info
> structure has the "process->attached" field already.  We could
> check that here.

Indeed! Attached is an updated patch which uses that flag.

gdb/ChangeLog:

        * nat/linux-ptrace.h (PTRACE_O_EXITKILL): Define if not
        already defined.
        (linux_enable_event_reporting): Add parameter "attached".
        * nat/linux-ptrace.c (linux_test_for_exitkill): New advance
        declaration.  New function.
        (linux_check_ptrace_features): Add new paramter "attached".
        Call linux_test_for_exitkill if !ATTACHED.
        (linux_enable_event_reporting): Add new parameter "attached".
        Update call to linux_check_ptrace_features.
        * linux-nat.c (linux_init_ptrace): Add parameter "attached".
        Use it.  Update function description.
        (linux_child_post_attach, linux_child_post_startup_inferior):
        Update call to linux_enable_event_reporting.

gdb/gdbserver/ChangeLog:

        * linux-low.c (linux_low_filter_event): Update call to
        linux_enable_event_reporting following the addition of
        a new parameter to that function.

Tested on x86_64-linux, native and native-gdbserver.

I also verified by hand that the inferior gets killed when killing
GDB in the "run" case, while the inferior remains in the "attach"
case. Same for GDBserver.

OK to push?

Thank you!
-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Linux-Ask-kernel-to-kill-inferior-when-GDB-terminate.patch
Type: text/x-diff
Size: 6830 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20141215/8705a898/attachment.bin>


More information about the Gdb-patches mailing list