From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6998 invoked by alias); 18 Feb 2008 18:42:56 -0000 Received: (qmail 6989 invoked by uid 22791); 18 Feb 2008 18:42:55 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.29.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 18 Feb 2008 18:42:31 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.8/8.13.8) with ESMTP id m1IIgRsC138978 for ; Mon, 18 Feb 2008 18:42:27 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.7) with ESMTP id m1IIgRJC2302004 for ; Mon, 18 Feb 2008 19:42:27 +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 m1IIgRbt001138 for ; Mon, 18 Feb 2008 18:42:27 GMT 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 m1IIgR1u001135; Mon, 18 Feb 2008 18:42:27 GMT Message-Id: <200802181842.m1IIgR1u001135@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 18 Feb 2008 19:42:27 +0100 Subject: Re: [RFC] Add support for PPC Altivec registers in gcore To: cseo@linux.vnet.ibm.com (Carlos Eduardo Seo) Date: Mon, 18 Feb 2008 18:42:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org (GDB Patches Mailing List) In-Reply-To: <47ACCCAF.4080200@linux.vnet.ibm.com> from "Carlos Eduardo Seo" at Feb 08, 2008 07:42:07 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: 2008-02/txt/msg00301.txt.bz2 Carlos Eduardo Seo wrote: > Ok, here's my first shot at this new approach for writing core files. I > had to add a new BFD function (binutils patch is attached as well - I'll > submit this to the binutils mailing list later) and I didn't include the > fill_register fallbacks in the new implementation. OK. > I believe a similar loop could also be used in -tdep.c files to read the > core files as well, right? Yes, a similar loop should be used to read core files, but this doesn't go into -tdep.c files, but rather into corelow.c:get_core_registers. > Only wrote the code for ppc, but this could be easily expanded to other > archs, adding modifications similar to those I did in ppc-linux-tdep.c. > > I think this first code is very raw, but I believe we can improve it and > use this approach for all archs in the future. I'd very much prefer if we could just switch over all archs at the same time -- we already have enough partial transitions in GDB as is :-/ This should in fact be quite easy to achieve, as the only other arch that supports any non-standard reg section today is i386 with its .reg-xfp. We'd only need to implement this, and a default fallback for all other archs that only supports ".reg" and ".reg2". > fprintf_unfiltered (file, > + "gdbarch_dump: core_regset_sections = %s\n", > + (char *) gdbarch->core_regset_sections); This doesn't work -- core_regset_sections is not a string. > +v:struct core_regset_section *:core_regset_sections:const char *name, int len::::::(char *) gdbarch->core_regset_sections You should either use some routine that formats the (host) pointer properly (similar to gdb_print_host_address) or else maybe just disable debug output for this field. > +static struct core_regset_section ppc_regset_sections[] = > +{ > + {".reg2", 264}, > + {".reg-ppc-vmx", 544}, > + {NULL, 0} > +}; Formatting: space after { and before }. I'm wondering if it wouldn't be better to include ".reg" in the table, and just treat it separately where necessary. > + if (core_regset_p && sect_list != NULL) > + while ((sect_list + i)->sect_name != NULL) > + { > + if ((regset = gdbarch_regset_from_core_section (gdbarch, > + (sect_list + i)->sect_name, > + (*(sect_list + i)).size)) > + != NULL && regset->collect_regset != NULL) > + { > + gdb_regset = xmalloc ((*(sect_list + i)).size); > + regset->collect_regset (regset, regcache, -1, > + gdb_regset, (*(sect_list + i)).size); > + note_data = (char *) elfcore_write_register_note (obfd, > + note_data, > + note_size, > + (sect_list + i)->sect_name, > + gdb_regset, > + (*(sect_list + i)).size); > + xfree (gdb_regset); > + } > + i++; > + } If you'd just use sect_list++, all those *(sect_list + i) could go away. > + /* For architectures that does not have the struct core_regset_section implemented, > + we use the old method. When all the architectures have the new support, the code > + below should be deprecated. */ As mentioned above, please just convert everything in one go. > 2008-02-03 Carlos Eduardo Seo > > * elf.c (elfcore_write_register_note): New function. > * elf-bfd.h (elfcore_write_register_note): New prototype. These look fine to me, but need to be posted to the binutils list. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com