From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25001 invoked by alias); 29 Oct 2007 19:16:52 -0000 Received: (qmail 24987 invoked by uid 22791); 29 Oct 2007 19:16:51 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate4.de.ibm.com (HELO mtagate4.de.ibm.com) (195.212.29.153) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 29 Oct 2007 19:16:49 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.13.8/8.13.8) with ESMTP id l9TJGk2f078978 for ; Mon, 29 Oct 2007 19:16:46 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l9TJGkS42109450 for ; Mon, 29 Oct 2007 20:16:46 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l9TJGjg4028755 for ; Mon, 29 Oct 2007 20:16:46 +0100 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l9TJGjHh028749; Mon, 29 Oct 2007 20:16:45 +0100 Message-Id: <200710291916.l9TJGjHh028749@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 29 Oct 2007 20:16:45 +0100 Subject: Re: [RFC] Add support for PPC Altivec registers in gcore To: cseo@linux.vnet.ibm.com (Carlos Eduardo Seo) Date: Mon, 29 Oct 2007 19:24:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org (GDB Patches Mailing List) In-Reply-To: <47223F51.4010309@linux.vnet.ibm.com> from "Carlos Eduardo Seo" at Oct 26, 2007 05:26:09 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2007-10/txt/msg00770.txt.bz2 Carlos Eduardo Seo wrote: > The attached patch makes gcore dump the contents of PPC Altivec registers. > > However, I'm not happy with declaring a bunch of PPC-specific stuff in > gregset.h. But since FPXREGSET was there, I put everything in that file > as well. > > I'm open to comments about how to make this better, so please give me > some thoughts. > + if (core_regset_p > + && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg-ppc-vmx", > + sizeof (vrregs))) != NULL > + && regset->collect_regset != NULL) > + regset->collect_regset (regset, regcache, -1, > + &vrregs, sizeof (vrregs)); > + else > + fill_vrregset (regcache, &vrregs); First of all, you certainly do not need the global fill_vrregset fallback. In fact, the existing uses of the global "fill_..." functions should be removed and targets switched over to use the collect_regset method. For *new* support like this, you should simply require the collect_regset method to be used, and not provide any fallback. Also, the current patch as it stands will cause build failures on any native Linux target but PowerPC, as that function is not defined. > Index: src/gdb/gregset.h > +/* For PPC Altivec support */ > + > +#define SIZEOF_VRREGS 33*16+4 > + > +typedef char gdb_vrregset_t[SIZEOF_VRREGS]; Now, the only reason this currently needs to be in common code is that common code allocates a local variable on the stack, and needs to know the size required for it. Everything else is actually not necessary in common code. So maybe be should add a new gdbarch variable that points to a list of supported register notes, each specified via name and size: { { ".reg", sizeof gdb_gregset_t }, { ".reg2", sizeof gdb_fpregset_t }, { ".reg-ppx-vmx", sizeof gdb_vrregset_t }, { NULL } } Common linux-nat code would walk through the list, instead of having to handle each note separately. (Note that corelow.c could also walk that list instead of hard-coding note names.) Probably at least for now the "main" .reg / .reg2 will have to remain special-cased due to the fill_ fallbacks. But the "special" note types, .reg-xfp for Intel and .reg-ppc-vmx for PPC, could certainly be switched to the new method. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com