From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30915 invoked by alias); 8 Dec 2011 13:49:57 -0000 Received: (qmail 30692 invoked by uid 22791); 8 Dec 2011 13:49:55 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW 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, 08 Dec 2011 13:49:42 +0000 Received: by vbbfn1 with SMTP id fn1so1640136vbb.0 for ; Thu, 08 Dec 2011 05:49:41 -0800 (PST) Received: by 10.52.114.232 with SMTP id jj8mr1572308vdb.94.1323352181455; Thu, 08 Dec 2011 05:49:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.4.210 with HTTP; Thu, 8 Dec 2011 05:49:20 -0800 (PST) In-Reply-To: References: From: Kevin Pouget Date: Thu, 08 Dec 2011 14:28:00 -0000 Message-ID: Subject: Re: [PATCH] Add bp_location to Python interface To: pmuldoon@redhat.com Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 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: 2011-12/txt/msg00264.txt.bz2 On Thu, Dec 8, 2011 at 2:08 PM, Phil Muldoon wrote: > Kevin Pouget writes: > >> Hello, >> >> I would like to discuss this patch which introduces a new Python class >> gdb.BpLocation, mapped from breakpoint.h::struct bp_location. > > Thanks. > >> I noticed that the Python interface doesn't offer so many details >> about breakpoint location, just gdb.Breakpoint.location, the string >> used to set the breakpoint (its linespec?) > > Because we use gdb.Breakpoints for watchpoints as well, it also > represents the expression used to set the watchpoint. I didn't consider watchpoints at all during this work, I'll add it to the testsuite to ensure it's handling correctly >> So this new class, which is currently strictly read-only and not >> instantiatable, exports the address and inferior in which the >> breakpoint was set (and an enabled flag, and a link to its owner >> breakpoint). > > I think it should only ever be read-only. yes, certainly. My original idea was to allow Python to add new BpLocations, but that's the way GDB was designed to work! Anyway, I think that Tom's patch has solved the problem by correctly spreading breakpoints to new inferiors. >> BpLocation object are available through the gdb.Breakpoint.locations method. > > If a user expected a string for a location, delivering an object here > would break API? I'm not sure to get you right, but I didn't change the original API behavior. There are now two ... method/atribute, `Breakpoint.location` which returns a string (bp->addr_string) and `Breakpoint.location_s_(self)' which returns a tuple of gdb.BpLocation objects. The name "locations" might be confusing, but I've got no other wording for it so far, and I think it's too late to rename "location" to "spec", (there is a missing Py_DECREF(list) in bppy_locations, I'll fix it for the next patch) >> I think that this class would also help Python users to better >> control/understand where their breakpoints are set with Tom's recent >> changes about ambiguous linespec > > Yes I think so too. another advantage is to allow the detection of pending breakpoints: if len(bp.locations()) == 0, the breakpoint is pending (and we'll have to find a way to find a way to keep GDB quite when a pending breakpoint is created (I'll post a bug report for that): > (gdb) py gdb.Breakpoint("pending") > Function "pending" not defined. > Breakpoint 2 (pending) pending. Cordially, Kevin