Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Aktemur, Tankut Baris via Gdb-patches" <gdb-patches@sourceware.org>
To: Pedro Alves <pedro@palves.net>, Simon Marchi <simark@simark.ca>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH 3/3] Make scoped_restore_current_thread's cdtors exception free (RFC)
Date: Fri, 30 Oct 2020 07:44:59 +0000	[thread overview]
Message-ID: <SN6PR11MB2893282E9AB82015008B403EC4150@SN6PR11MB2893.namprd11.prod.outlook.com> (raw)
In-Reply-To: <ae0fa8af-5b32-c2ee-0781-e9dcda6ae69e@palves.net>

On Friday, October 30, 2020 2:14 AM, Pedro Alves wrote:
> On 7/10/20 3:55 AM, Simon Marchi wrote:
> >>> I don't know if it would be worth it, but I'd like if we could assert (abort
> >>> GDB) if an exception does try to exit the destructor.  The `restore` method
> >>> is non-trivial and calls into other non-trivial functions, so it would be
> >>> possible for a change far far away to cause that to happen.
> >>
> >> It will already abort.  Destructors are noexcept by default, so if an exception
> >> escapes a destructor, std::terminate() is called, and that calls abort by default.
> >
> > Oh, didn't know that!  I thought it was just "undefined behavior".
> >
> >>> What do you think of keeping the try/catch, but using `gdb_assert_not_reached`
> >>> in it?
> >>
> >> Not sure.  If we do that, we do get a nicer error message.  However if the user
> >> says "n" to "Quit this debugging session" we still abort.
> >>
> >> /home/pedro/brno/pedro/gdb/binutils-gdb-2/build/../src/gdb/thread.c:1441: internal-error:
> scoped_restore_current_thread::~scoped_restore_current_thread(): unexpected exception thrown
> from destructor: hello
> >> A problem internal to GDB has been detected,
> >> further debugging may prove unreliable.
> >> Quit this debugging session? (y or n) n
> >>
> >> This is a bug, please report it.  For instructions, see:
> >> <https://www.gnu.org/software/gdb/bugs/>.
> >>
> >> /home/pedro/brno/pedro/gdb/binutils-gdb-2/build/../src/gdb/thread.c:1441: internal-error:
> scoped_restore_current_thread::~scoped_restore_current_thread(): unexpected exception thrown
> from destructor: hello
> >> A problem internal to GDB has been detected,
> >> further debugging may prove unreliable.
> >> Create a core file of GDB? (y or n) n
> >> terminate called after throwing an instance of 'gdb_exception_quit'
> >> Aborted (core dumped)
> >>
> >> Maybe it would be interesting to add a variant of internal_error that did
> >> not throw a quit, so the user could swallow the exception...  Maybe consider
> >> wrapping that as a generic facility to add to all non-trivial RAII destructors
> >> we have?  Like a function that takes a function_view as parameter, so
> >> we would write:
> >>
> >> foo::~foo ()
> >> {
> >>   safe_dtor (__FILE__, __LINE__, [&] ()
> >>     {
> >>       restore ();
> >>     });
> >> }
> >>
> >> Even better, add a SAFE_DTOR macro using similar magic SCOPE_EXIT
> >> macro uses to be able to write:
> >>
> >> foo::~foo ()
> >> {
> >>   SAFE_DTOR { restore (); };
> >> }
> >
> > That's fancier than what I hoped for :).  My goal was just to make sure
> > we catch it if we ever make a change that causes an exception to escape.
> > Although I wouldn't be against what you proposed.
> >
> >> Here's the current version of the patch.
> >
> > That looks fine to me.
> 
> FYI, I've finally merged this to master.
> 
> Thanks,
> Pedro Alves

Hi Pedro,

This patch created the regression below:

  Breakpoint 1, 0x00000000004012bb in eh2 (/gdb-up/gdb/frame.c:641: internal-error: frame_id get_frame_id(frame_info*): Assertion `stashed' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n) FAIL: gdb.base/eh_return.exp: hit breakpoint (GDB internal error)

-Baris



Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  parent reply	other threads:[~2020-10-30  7:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 23:31 [PATCH 0/3] Fix crash if connection drops in scoped_restore_current_thread's ctor Pedro Alves
2020-07-08 23:31 ` [PATCH 1/3] Fix crash if connection drops in scoped_restore_current_thread's ctor, part 1 Pedro Alves
2020-07-09  3:17   ` Simon Marchi
2020-07-09 10:51     ` Pedro Alves
2020-07-09 14:13       ` Simon Marchi
2020-07-08 23:31 ` [PATCH 2/3] Fix crash if connection drops in scoped_restore_current_thread's ctor, part 2 Pedro Alves
2020-07-09  3:31   ` Simon Marchi
2020-07-09 11:12     ` Pedro Alves
2020-07-09 14:16       ` Simon Marchi
2020-07-09 17:23         ` Pedro Alves
2020-07-09 17:28           ` Simon Marchi
2020-07-08 23:31 ` [PATCH 3/3] Make scoped_restore_current_thread's cdtors exception free (RFC) Pedro Alves
2020-07-09  3:49   ` Simon Marchi
2020-07-09 11:56     ` Pedro Alves
2020-07-09 12:09       ` Pedro Alves
2020-07-09 15:40       ` Simon Marchi
2020-07-09 22:22         ` Pedro Alves
2020-07-10  2:55           ` Simon Marchi
2020-10-30  1:13             ` Pedro Alves
2020-10-30  1:37               ` [pushed] Move lookup_selected_frame to frame.c Pedro Alves
2020-10-30  7:44               ` Aktemur, Tankut Baris via Gdb-patches [this message]
2020-10-30 11:32                 ` [PATCH 3/3] Make scoped_restore_current_thread's cdtors exception free (RFC) Pedro Alves
2020-10-31 14:35                   ` [PATCH] Fix frame cycle detection (Re: [PATCH 3/3] Make scoped_restore_current_thread's cdtors exception free (RFC)) Pedro Alves
2020-11-09 14:05                     ` Aktemur, Tankut Baris via Gdb-patches
2020-11-16 13:48                       ` Tom de Vries
2020-11-16 14:57                         ` Pedro Alves
2020-07-10 23:02 ` [PATCH 0/3] Fix crash if connection drops in scoped_restore_current_thread's ctor Pedro Alves
2020-07-22 19:37   ` Simon Marchi
2020-07-22 20:37     ` Pedro Alves
2020-07-22 20:47       ` Simon Marchi
2020-07-23 15:28         ` [pushed] Don't touch frame_info objects if frame cache was reinitialized (was: Re: [PATCH 0/3] Fix crash if connection drops in scoped_restore_current_thread's ctor) Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SN6PR11MB2893282E9AB82015008B403EC4150@SN6PR11MB2893.namprd11.prod.outlook.com \
    --to=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    --cc=simark@simark.ca \
    --cc=tankut.baris.aktemur@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox