From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18770 invoked by alias); 9 Sep 2003 17:15:53 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 18758 invoked from network); 9 Sep 2003 17:15:52 -0000 Received: from unknown (HELO zenia.home) (12.223.225.216) by sources.redhat.com with SMTP; 9 Sep 2003 17:15:52 -0000 Received: by zenia.home (Postfix, from userid 5433) id 76FFA204FF; Tue, 9 Sep 2003 12:14:21 -0500 (EST) To: Andrew Cagney Cc: Daniel Jacobowitz , Mark Kettenis , gdb@sources.redhat.com Subject: Re: [RFC] Register sets References: <200308232249.h7NMnvhh090154@elgar.kettenis.dyndns.org> <20030824164347.GA17520@nevyn.them.org> <200308252234.h7PMYqFu001245@elgar.kettenis.dyndns.org> <3F4B8173.1000302@redhat.com> <20030826165547.GA22836@nevyn.them.org> <86he3xrkjb.fsf@elgar.kettenis.dyndns.org> <20030904125514.GA2577@nevyn.them.org> <3F5D5C5D.4070809@redhat.com> From: Jim Blandy Date: Tue, 09 Sep 2003 17:15:00 -0000 In-Reply-To: <3F5D5C5D.4070809@redhat.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-09/txt/msg00112.txt.bz2 Andrew Cagney writes: > > Daniel Jacobowitz writes: > > > >> struct regset > >> { > >> void (*supply_regset)(struct regcache *, const void *, size_t, int); > >> void (*read_regset)(struct regcache *, void *, size_t, int); > >> }; > > If you want to allow people to define regset formats via the CLI, it > > seems to me you probably want some kind of closure argument in there, > > like this: > > struct regset > > { > > /* Always pass this to the supply_regset and read_regset > > functions below as their first argument. */ > > void *closure; > > void (*supply_regset)(void *closure, > > struct regcache *, const void *, size_t, int); > > void (*read_regset)(void *closure, > > struct regcache *, void *, size_t, int); > > }; > > This gives you the hook you need to have a single function for all > > CLI-defined regsets, interpreting the layout the user supplies to the > > CLI command. > > Er, this isn't a closure (at least not in the sense specified on > bfd@). Rather this is an object and so might as well be implemented in > more of an object style - pass the "struct regset" as the first > parameter. Not sure I think the distinction is too meaningful. You should probably post a specific suggestion that shows what you're after.