public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30219] New: [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error)
@ 2023-03-10 19:33 simon.marchi at polymtl dot ca
  2023-03-10 19:35 ` [Bug gdb/30219] " simon.marchi at polymtl dot ca
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: simon.marchi at polymtl dot ca @ 2023-03-10 19:33 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30219

            Bug ID: 30219
           Summary: [native-gdbserver] FAIL: gdb.base/quit-live.exp:
                    appear_how=run: extra_inferior=0: quit_how=sigterm:
                    quit with SIGTERM (GDB internal error)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at polymtl dot ca
  Target Milestone: ---

$ make check TESTS="gdb.base/quit-live.exp"
RUNTESTFLAGS="--target_board=native-gdbserver"

(gdb) continue
Continuing.

Breakpoint 1, main () at
/home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/quit-live.c:23
23        int secs = 30;
(gdb) Executing on host: kill -TERM 1423439    (timeout = 300)
builtin_spawn -ignore SIGHUP kill -TERM 1423439
SIGTERM
/home/smarchi/src/binutils-gdb/gdb/exceptions.c:100: internal-error: Bad
switch.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0:
quit_how=sigterm: quit with SIGTERM (GDB internal error)
Resyncing due to internal error.
0x5576e43849ed gdb_internal_backtrace_1
        /home/smarchi/src/binutils-gdb/gdb/bt-utils.c:122
0x5576e4384ee3 gdb_internal_backtrace()
        /home/smarchi/src/binutils-gdb/gdb/bt-utils.c:168
0x5576e6e86f10 internal_vproblem
        /home/smarchi/src/binutils-gdb/gdb/utils.c:401
0x5576e6e87c32 internal_verror(char const*, int, char const*, __va_list_tag*)
        /home/smarchi/src/binutils-gdb/gdb/utils.c:481
0x5576e836c2d9 internal_error_loc(char const*, int, char const*, ...)
        /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:58
0x5576e4ff5780 print_exception
        /home/smarchi/src/binutils-gdb/gdb/exceptions.c:100
0x5576e4ff5930 exception_print(ui_file*, gdb_exception const&)
        /home/smarchi/src/binutils-gdb/gdb/exceptions.c:110
0x5576e6a896dd quit_force(int*, int)
        /home/smarchi/src/binutils-gdb/gdb/top.c:1849
0x5576e4fedf0c async_sigterm_handler
        /home/smarchi/src/binutils-gdb/gdb/event-top.c:1208
0x5576e402c0e6 invoke_async_signal_handlers()
        /home/smarchi/src/binutils-gdb/gdb/async-event.c:233
0x5576e836cc2c gdb_do_one_event(int)
        /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:199
0x5576e587b90a start_event_loop
        /home/smarchi/src/binutils-gdb/gdb/main.c:411
0x5576e587bdb9 captured_command_loop
        /home/smarchi/src/binutils-gdb/gdb/main.c:475
0x5576e5881123 captured_main
        /home/smarchi/src/binutils-gdb/gdb/main.c:1318
0x5576e5881270 gdb_main(captured_main_args*)
        /home/smarchi/src/binutils-gdb/gdb/main.c:1337
0x5576e3a6f60c main
        /home/smarchi/src/binutils-gdb/gdb/gdb.c:32

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/30219] [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error)
  2023-03-10 19:33 [Bug gdb/30219] New: [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error) simon.marchi at polymtl dot ca
@ 2023-03-10 19:35 ` simon.marchi at polymtl dot ca
  2023-03-10 19:59 ` kevinb at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: simon.marchi at polymtl dot ca @ 2023-03-10 19:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30219

Simon Marchi <simon.marchi at polymtl dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kevinb at redhat dot com,
                   |                            |pedro at palves dot net

--- Comment #1 from Simon Marchi <simon.marchi at polymtl dot ca> ---
Started with:

Handle gdb SIGTERM by throwing / catching gdb_exception_force_quit
https://inbox.sourceware.org/gdb-patches/20230222234613.29662-3-kevinb@redhat.com/

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/30219] [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error)
  2023-03-10 19:33 [Bug gdb/30219] New: [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error) simon.marchi at polymtl dot ca
  2023-03-10 19:35 ` [Bug gdb/30219] " simon.marchi at polymtl dot ca
@ 2023-03-10 19:59 ` kevinb at redhat dot com
  2023-03-10 20:00 ` kevinb at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kevinb at redhat dot com @ 2023-03-10 19:59 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30219

--- Comment #2 from Kevin Buettner <kevinb at redhat dot com> ---
It appears that I forgot to add a case for RETURN_FORCED_QUIT.

I'll work on a fix...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/30219] [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error)
  2023-03-10 19:33 [Bug gdb/30219] New: [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error) simon.marchi at polymtl dot ca
  2023-03-10 19:35 ` [Bug gdb/30219] " simon.marchi at polymtl dot ca
  2023-03-10 19:59 ` kevinb at redhat dot com
@ 2023-03-10 20:00 ` kevinb at redhat dot com
  2023-03-30 21:59 ` cvs-commit at gcc dot gnu.org
  2023-03-30 22:22 ` kevinb at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: kevinb at redhat dot com @ 2023-03-10 20:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30219

Kevin Buettner <kevinb at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |kevinb at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/30219] [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error)
  2023-03-10 19:33 [Bug gdb/30219] New: [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error) simon.marchi at polymtl dot ca
                   ` (2 preceding siblings ...)
  2023-03-10 20:00 ` kevinb at redhat dot com
@ 2023-03-30 21:59 ` cvs-commit at gcc dot gnu.org
  2023-03-30 22:22 ` kevinb at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-30 21:59 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30219

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kevin Buettner <kevinb@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3b431a3c9071d3e654e66a461e152c6bf8386096

commit 3b431a3c9071d3e654e66a461e152c6bf8386096
Author: Kevin Buettner <kevinb@redhat.com>
Date:   Fri Mar 10 15:27:43 2023 -0700

    PR gdb/30219: Clear sync_quit_force_run in quit_force

    PR 30219 shows an internal error due to a "Bad switch" in
    print_exception() in gdb/exceptions.c.  The switch in question
    contains cases for RETURN_QUIT and RETURN_ERROR, but is missing a case
    for the recently added RETURN_FORCED_QUIT.  This commit adds that case.

    Making the above change allows the errant test case to pass, but does
    not fix the underlying problem, which I'll describe shortly.  Even
    though the addition of a case for RETURN_FORCED_QUIT isn't the actual
    fix, I still think it's important to add this case so that other
    situations which lead to print_exeption() being called won't generate
    that "Bad switch" internal error.

    In order to understand the underlying problem, please examine
    this portion of the backtrace from the bug report:

    0x5576e4ff5780 print_exception
            /home/smarchi/src/binutils-gdb/gdb/exceptions.c:100
    0x5576e4ff5930 exception_print(ui_file*, gdb_exception const&)
            /home/smarchi/src/binutils-gdb/gdb/exceptions.c:110
    0x5576e6a896dd quit_force(int*, int)
            /home/smarchi/src/binutils-gdb/gdb/top.c:1849

    The real problem is in quit_force; here's the try/catch which
    eventually leads to the internal error:

      /* Get out of tfind mode, and kill or detach all inferiors.  */
      try
        {
          disconnect_tracing ();
          for (inferior *inf : all_inferiors ())
            kill_or_detach (inf, from_tty);
        }
      catch (const gdb_exception &ex)
        {
          exception_print (gdb_stderr, ex);
        }

    While running the calls in the try-block, a QUIT check is being
    performed.  This check finds that sync_quit_force_run is (still) set,
    causing a gdb_exception_forced_quit to be thrown.  The exception
    gdb_exception_forced_quit is derived from gdb_exception, causing
    exception_print to be called.  As shown by the backtrace,
    print_exception is then called, leading to the internal error.

    The actual fix, also implemented by this commit, is to clear
    sync_quit_force_run along with the quit flag.  This will allow the
    various cleanup code, called by quit_force, to run without triggering
    a gdb_exception_forced_quit.  (Though, if another SIGTERM is sent to
    the gdb process, these flags will be set again and a QUIT check in the
    cleanup code will detect it and throw the exception.)

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30219
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/30219] [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error)
  2023-03-10 19:33 [Bug gdb/30219] New: [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error) simon.marchi at polymtl dot ca
                   ` (3 preceding siblings ...)
  2023-03-30 21:59 ` cvs-commit at gcc dot gnu.org
@ 2023-03-30 22:22 ` kevinb at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: kevinb at redhat dot com @ 2023-03-30 22:22 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30219

Kevin Buettner <kevinb at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Kevin Buettner <kevinb at redhat dot com> ---
Fixed now.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-30 22:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 19:33 [Bug gdb/30219] New: [native-gdbserver] FAIL: gdb.base/quit-live.exp: appear_how=run: extra_inferior=0: quit_how=sigterm: quit with SIGTERM (GDB internal error) simon.marchi at polymtl dot ca
2023-03-10 19:35 ` [Bug gdb/30219] " simon.marchi at polymtl dot ca
2023-03-10 19:59 ` kevinb at redhat dot com
2023-03-10 20:00 ` kevinb at redhat dot com
2023-03-30 21:59 ` cvs-commit at gcc dot gnu.org
2023-03-30 22:22 ` kevinb at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).