From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4057 invoked by alias); 10 Jun 2009 17:47:06 -0000 Received: (qmail 4045 invoked by uid 22791); 10 Jun 2009 17:47:05 -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; Wed, 10 Jun 2009 17:46:58 +0000 Received: (qmail 13909 invoked from network); 10 Jun 2009 17:46:55 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 Jun 2009 17:46:55 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: RFC: next/finish/etc -vs- exceptions Date: Wed, 10 Jun 2009 17:47:00 -0000 User-Agent: KMail/1.9.10 Cc: Daniel Jacobowitz , tromey@redhat.com, Joel Brobecker References: <200906101806.31977.pedro@codesourcery.com> <20090610171328.GA32661@caradoc.them.org> In-Reply-To: <20090610171328.GA32661@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906101848.04782.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/msg00267.txt.bz2 On Wednesday 10 June 2009 18:13:28, Daniel Jacobowitz wrote: > On Wed, Jun 10, 2009 at 06:06:31PM +0100, Pedro Alves wrote: > > I assume that exceptions have a property that raw longjmp doesn't, > > which is what makes stepping over longjmp complicated --- they never > > switch to alternate stacks? That was one reason why comparing > > frame/stack pointers with inner_than kind of comparisions is > > verboten (to know when the longjmp/exception is all inner to the > > step/next and can be ignored, for example). That, and frames > > crossing architectures, like on Cell. I did spot one such comparision > > by a quick look at the patch, but I don't know if it OK to do so in > > your case or not. I assume other people who know more about > > frames and unwinders than me can provide better input there. :-) > > Not sure what you mean exactly, but exceptions can be thrown through > signal handlers on many platforms; so yes, they might switch stack. > They could go to any stack higher on the call frame. > Oh, C++ exceptions across signals, neat. Didn't think of that. Other than the cross-arch exceptions, I was thinking of things like using longjmp for continuations and coroutines, and tricks like that. There may be clever ways to do such things with C++ exceptions, I don't know then. Anyway, not wanting to finger-point I was refering to things like these in the patch: + /* We use the current stack pointer and not the CFA here, + because the unwinder seems to compute the callee's CFA, and + so the breakpoint does not trigger. */ + stack_ptr = get_frame_sp (frame); and... + if (!what.is_longjmp && ecs->event_thread->step_range_start + && (get_frame_sp (get_current_frame ()) + == ecs->event_thread->exception_frame)) + { and... + if (!nexting_cfa + || gdbarch_inner_than (arch, cfa, nexting_cfa)) + { + /* Not an interesting exception. */ + break; + } Which I guessed should be using frame_id comparisions, and something other than gdbarch_inner_than, frame_find_by_id perhaps (that does require a well behaved unwinder). I'm not much an expert on C++ unwinding, and haven't really studied the patch, so I don't exactly what is being compared here. -- Pedro Alves