From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5710 invoked by alias); 21 Apr 2011 14:32:12 -0000 Received: (qmail 5701 invoked by uid 22791); 21 Apr 2011 14:32:11 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-vw0-f41.google.com (HELO mail-vw0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Apr 2011 14:31:58 +0000 Received: by vws4 with SMTP id 4so1827219vws.0 for ; Thu, 21 Apr 2011 07:31:57 -0700 (PDT) Received: by 10.220.187.4 with SMTP id cu4mr13129vcb.58.1303396317199; Thu, 21 Apr 2011 07:31:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.61.6 with HTTP; Thu, 21 Apr 2011 07:31:37 -0700 (PDT) In-Reply-To: References: From: Kevin Pouget Date: Thu, 21 Apr 2011 14:32:00 -0000 Message-ID: Subject: Re: GDB Python API: stop/continue after breakpoint To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00131.txt.bz2 before I start any implementation, would you agree if I change > int > emit_stop_event (struct bpstats *bs, enum target_signal stop_signal) > ... > =A0if (bs && bs->breakpoint_at > =A0 =A0 =A0&& bs->breakpoint_at->py_bp_object) > =A0 =A0{ > =A0 =A0 =A0stop_event_obj =3D create_breakpoint_event_object ((PyObject *= ) bs > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->breakpoint_at > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->py_bp_object); > =A0 =A0} so that it browses the `bs->next' list=A0 and returns a python tuple instead of a single object ? > =A0=A0=A0 /* Linked list because there can be more than one breakpoint at > =A0=A0=A0=A0=A0=A0 the same place, and a bpstat reflects the fact that al= l have > =A0=A0=A0=A0=A0=A0 been hit.=A0 */ > =A0=A0=A0 bpstat next; Cordially, Kevin On Thu, Apr 21, 2011 at 9:01 AM, Kevin Pouget wrot= e: >> Kevin> * in event.stop.connect() that's possible, but I can't >> Kevin> `gdb.execute("continue")' the execution because I would miss any >> Kevin> "non-python" reasons to stop (ie, a user-breakpoint, a signal ...) >> >> I think you should be able to examine the stop event object to see what >> caused the event. =A0If the event is a gdb.BreakpointEvent, and if >> event.breakpoint is your breakpoint, then do what you want. > > I'm afraid that's impossible to do it with the current implementation, lo= ok: > > def handle_double_stop(event): > =A0 =A0 =A0 =A0print "Stop event: ", event.breakpoint.number > gdb.events.stop.connect(handle_double_stop) > > (gdb) break main > Breakpoint 1 > (gdb) break main > Breakpoint 2 > (gdb) run > Stop event: 1 > > ... as far as I know, there is no 'easy' way to know that Bp 2 was hit as= well >