Skip to content
Snippets Groups Projects
  • Kevin Buettner's avatar
    522044dc
    Introduce gdb_exception_forced_quit · 522044dc
    Kevin Buettner authored
    This commit adds a new exception 'gdb_exception_forced_quit', reason
    code 'REASON_FORCED_QUIT', return mask 'RETURN_MASK_FORCED_QUIT', and
    a wrapper for throwing the exception, throw_forced_quit().
    
    The addition of this exception plus supporting code will allow us to
    recognize that a SIGTERM has been received by GDB and then propagate
    recognition of that fact to the upper levels of GDB where it can be
    correctly handled.  At the moment, when GDB receives a SIGTERM, it
    will attempt to exit via a series of calls from the QUIT checking
    code.  However, before it can exit, it must do various cleanups, such
    as killing or detaching all inferiors.  Should these cleanups be
    attempted while GDB is executing very low level code, such as reading
    target memory from within ps_xfer_memory(), it can happen that some of
    GDB's state is out of sync with regard to the cleanup code's
    expectations.  In the case just mentioned, it's been observed that
    inferior_ptid and the current_thread_ are not in sync; this triggers
    an assert / internal error.
    
    This commit only introduces the exception plus supporting machinery;
    changes which use this new exception are in later commits in this
    series.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26761
    
    
    Tested-by: default avatarTom de Vries <tdevries@suse.de>
    Approved-by: default avatarPedro Alves <pedro@palves.net>
    522044dc
    History
    Introduce gdb_exception_forced_quit
    Kevin Buettner authored
    This commit adds a new exception 'gdb_exception_forced_quit', reason
    code 'REASON_FORCED_QUIT', return mask 'RETURN_MASK_FORCED_QUIT', and
    a wrapper for throwing the exception, throw_forced_quit().
    
    The addition of this exception plus supporting code will allow us to
    recognize that a SIGTERM has been received by GDB and then propagate
    recognition of that fact to the upper levels of GDB where it can be
    correctly handled.  At the moment, when GDB receives a SIGTERM, it
    will attempt to exit via a series of calls from the QUIT checking
    code.  However, before it can exit, it must do various cleanups, such
    as killing or detaching all inferiors.  Should these cleanups be
    attempted while GDB is executing very low level code, such as reading
    target memory from within ps_xfer_memory(), it can happen that some of
    GDB's state is out of sync with regard to the cleanup code's
    expectations.  In the case just mentioned, it's been observed that
    inferior_ptid and the current_thread_ are not in sync; this triggers
    an assert / internal error.
    
    This commit only introduces the exception plus supporting machinery;
    changes which use this new exception are in later commits in this
    series.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26761
    
    
    Tested-by: default avatarTom de Vries <tdevries@suse.de>
    Approved-by: default avatarPedro Alves <pedro@palves.net>