]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix swallowed "Quit" when inserting breakpoints
authorPedro Alves <palves@redhat.com>
Thu, 16 Nov 2017 18:44:42 +0000 (18:44 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 16 Nov 2017 18:44:42 +0000 (18:44 +0000)
commit688fca4fe6c83a6802731faa8455d177998d614d
tree6aa69934c00de76f93c0f3998271e75f30427ac6
parente2c33ac745108550dcc2dc61d23378fb2fa9e911
Fix swallowed "Quit" when inserting breakpoints

If GDB is inserting a breakpoint and you type Ctrl-C at the exact
"right" time, you'll hit a QUIT call in target_read, and the
breakpoint insertion is cancelled.  However, the related TRY/CATCH
code in insert_bp_location does:

    CATCH (e, RETURN_MASK_ALL)
      {
      bp_err = e.error;
      bp_err_message = e.message;
    }

The problem with that is that a RETURN_QUIT exception has e.error ==
0, which means that further below, in the places that check for error
with:

      if (bp_err != GDB_NO_ERROR)

because GDB_NO_ERROR == 0, GDB continues as if the breakpoint was
inserted succesfully, and resumes the inferior.  Since the breakpoint
wasn't inserted the inferior runs free, out of our control...

Fix this by having insert_bp_location store a copy of the whole
exception instead of just a error/message parts, and then checking
"gdb_exception::reason" instead.

This was exposed by the new gdb.base/bp-cmds-continue-ctrl-c.exp
testcase added later in the series.

gdb/ChangeLog:
2017-11-16  Pedro Alves  <palves@redhat.com>

* breakpoint.c (insert_bp_location): Replace bp_err and
bp_err_message locals by a gdb_exception local.
gdb/ChangeLog
gdb/breakpoint.c