From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19066 invoked by alias); 17 Feb 2006 14:18:08 -0000 Received: (qmail 19051 invoked by uid 22791); 17 Feb 2006 14:18:08 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Fri, 17 Feb 2006 14:18:06 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FA6Qu-00052a-6e; Fri, 17 Feb 2006 09:18:04 -0500 Date: Fri, 17 Feb 2006 14:18:00 -0000 From: Daniel Jacobowitz To: gdb@sourceware.org, gdb@sources.redhat.com Subject: Re: MI: output of -break-insert and -break-watch Message-ID: <20060217141804.GA19339@nevyn.them.org> Mail-Followup-To: gdb@sourceware.org, gdb@sources.redhat.com References: <20060217135634.GA18641@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00178.txt.bz2 Message-ID: <20060217141800.xU0TrURxTX0PosqkDu1wY8Et3BobyFJ8hVnUw9Inxeo@z> On Fri, Feb 17, 2006 at 05:13:52PM +0300, Vladimir Prus wrote: > > I don't get it. Why is this a problem? It sounds to me like the only > > reason this would be awkward would be limitations of your front end. > > If you've done -break-insert you should expect a bkpt response, if > > you've done -break-watch you should expect a wpt response. > > Here's the code I use now to extract breakpoint id from response: > > int id = -1; > > if (r.hasField("bkpt")) > id = r["bkpt"]["number"].literal().toInt(); > else if (r.hasField("wpt")) > id = r["wpt"]["number"].literal().toInt(); > else if (r.hasField("hw-rwpt")) > id = r["hw-rwpt"]["number"].literal().toInt(); > > And there's also "hw-awpt", and in future there might be "catchpoint" and > "fork" and what not. > > If I only want to extract the *id* of breakpoint, why do I need to write > such boilerplate? Or should I write a function that will iterate over all > fields of 'r', and check if that field has nested field called 'number'? This still sounds to me like it has more to do with the architecture of your front-end than it does with meaningful layout of MI. This is only about the response to -break-insert and -break-watch as far as I understand. So if you want to avoid the conditional, you can record which type to expect when you issue the command. Or leave the conditional; it's not that bad, is it? -- Daniel Jacobowitz CodeSourcery