From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26113 invoked by alias); 12 Jun 2009 21:51:42 -0000 Received: (qmail 26105 invoked by uid 22791); 12 Jun 2009 21:51:42 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 12 Jun 2009 21:51:36 +0000 Received: (qmail 1702 invoked from network); 12 Jun 2009 21:51:34 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 12 Jun 2009 21:51:34 -0000 From: Pedro Alves To: Tom Tromey Subject: Re: RFC: next/finish/etc -vs- exceptions Date: Fri, 12 Jun 2009 21:51:00 -0000 User-Agent: KMail/1.9.10 Cc: gdb-patches@sourceware.org, Daniel Jacobowitz , Joel Brobecker References: <200906101848.04782.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200906122252.52837.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00343.txt.bz2 [Reviewing bits and pieces instead of the whole patch at once] On Friday 12 June 2009 21:44:30, Tom Tromey wrote: > +/* A continuation callback for until_next_command. =A0*/ > + > +static void > +until_next_continuation (void *arg) > +{ > + =A0struct thread_info *tp =3D arg; > + =A0delete_longjmp_breakpoint (tp->num); This is broken, in that there's no guarantee that TP is still a valid pointer here. > +} > + > =A0/* Proceed until we reach a different source line with pc greater than > =A0 =A0 our current one or exit the function. =A0We skip calls in both ca= ses. > =A0 > @@ -1170,6 +1181,8 @@ until_next_command (int from_tty) > =A0 =A0struct symbol *func; > =A0 =A0struct symtab_and_line sal; > =A0 =A0struct thread_info *tp =3D inferior_thread (); > + =A0int thread =3D tp->num; > + =A0struct cleanup *old_chain; > =A0 > =A0 =A0clear_proceed_status (); > =A0 > @@ -1205,7 +1218,18 @@ until_next_command (int from_tty) > =A0 > =A0 =A0tp->step_multi =3D 0;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0/* Only one cal= l to proceed */ > =A0 > + =A0tp->initiating_frame =3D set_exception_breakpoint (frame); > + =A0old_chain =3D make_cleanup (delete_longjmp_breakpoint_cleanup, &thre= ad); > + > =A0 =A0proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1); > + > + =A0if (target_can_async_p () && is_running (inferior_ptid)) > + =A0 =A0{ > + =A0 =A0 =A0discard_cleanups (old_chain); > + =A0 =A0 =A0add_continuation (tp, until_next_continuation, tp, NULL); > + =A0 =A0} > + =A0else > + =A0 =A0do_cleanups (old_chain); In sync execution mode, between that `proceed' and this do_cleanups, a lot happens. TP may exit, or the whole process for the matter. So, after `proceed', any TP pointer is invalid. Any other code doing the same thing is equally broken. --=20 Pedro Alves