From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1495 invoked by alias); 6 Sep 2003 14:18:05 -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 1480 invoked from network); 6 Sep 2003 14:18:04 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 6 Sep 2003 14:18:04 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p2/8.12.5) with ESMTP id h86EHn80004768; Sat, 6 Sep 2003 16:17:49 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p2/8.12.6) with ESMTP id h86EHndY034348; Sat, 6 Sep 2003 16:17:49 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p2/8.12.6/Submit) id h86EHmu1034345; Sat, 6 Sep 2003 16:17:48 +0200 (CEST) Date: Sat, 06 Sep 2003 14:18:00 -0000 Message-Id: <200309061417.h86EHmu1034345@elgar.kettenis.dyndns.org> From: Mark Kettenis To: jimb@redhat.com CC: drow@mvista.com, gdb@sources.redhat.com In-reply-to: (message from Jim Blandy on 05 Sep 2003 19:01:34 -0500) 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> X-SW-Source: 2003-09/txt/msg00087.txt.bz2 From: Jim Blandy Date: 05 Sep 2003 19:01:34 -0500 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. Actually I need this closure argument for the corefile regset stuff too. For the i386 I have a single supply_regset function for all the different "gregsets", and I define a table with offsets that defines rhe proper mapping in `struct gdbarch_tdep'. I could get at that mapping since I was passing the architecture in, but that's just a special case of the closure argument you propose. Mark