From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19658 invoked by alias); 28 Apr 2007 16:19:47 -0000 Received: (qmail 19647 invoked by uid 22791); 28 Apr 2007 16:19:46 -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; Sat, 28 Apr 2007 17:19:42 +0100 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 l3SGJbx4059530 for ; Sat, 28 Apr 2007 16:19:37 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.3) with ESMTP id l3SGJbbU4165748 for ; Sat, 28 Apr 2007 18:19:37 +0200 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 l3SGJaS0030506 for ; Sat, 28 Apr 2007 18:19:36 +0200 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 l3SGJaEi030503; Sat, 28 Apr 2007 18:19:36 +0200 Message-Id: <200704281619.l3SGJaEi030503@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Sat, 28 Apr 2007 18:19:36 +0200 Subject: Re: powerpc-linux biarch corefile support To: amodra@bigpond.net.au (Alan Modra) Date: Sat, 28 Apr 2007 16:24:00 -0000 From: "Ulrich Weigand" Cc: mark.kettenis@xs4all.nl (Mark Kettenis), gdb-patches@sourceware.org In-Reply-To: <20070123065726.GG8686@bubble.grove.modra.org> from "Alan Modra" at Jan 23, 2007 05:27:26 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-04/txt/msg00371.txt.bz2 Alan Modra wrote: > Yes, it is for zero extending, and also for initializing unused > fields. Random values in unused fields (eg. orig_gpr3) look odd in > core dumps. I could cure that particular problem by clearing the > buffer in linux-nat.c:linux_nat_do_thread_registers, but that doesn't > help ps_lgetregs. I'm sure we'll need to clear the high word of regs > for libthread_db when the inferior is 32-bit and gdb is 64-bit. So > that would seem to mean we need the rather messy business of clearing > individual registers, except that fill_gregset and fill_fpregset > are always called with regno == -1 and are not used in the powerpc > linux store_inferior_registers. (That code needs cleaning up to use > ppc_collect_gregset et al too. Maybe for my next gdb patch..) > ie. fill_gregset and fill_fpregset are always storing into an > uninitialised buffer. How about we just clear the buffers in > fill_gregset and fill_fpregset? I'm not sure I'm happy with this, it will cause problems if at some time in the future fill_gregset is indeed called with regno != -1. Why don't we push the task of clearing individual registers down to ppc_supply_reg and ppc_collect_reg in rs6000-nat.c? Have their callers always provide them with an "offset" value pointing to the start of the full field in REGS, and provide an extra "size" value denoting the length of the field in REGS. The helper functions can compare that size with GDB's notion of the register_size, and if it is bigger (it cannot be smaller), supply only the right part of the field, and zero out the left part of the field when collecting. The callers of ppc_supply_reg and ppc_collect_reg should be able to provide that new size value using offsets->gpr_size or fixed values. Note that this should make ppc64_32_linux_reg_offsets unnecessary, you'll need to always use ppc64_linux_reg_offsets on a 64-bit host. Mark, would this be OK with you as well? Another minor issue: > +const struct regset * > +ppc_linux_gregset (struct gdbarch *gdbarch) > +{ > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + if (tdep->wordsize == 8) > + return &ppc64_linux_gregset; > + if (sizeof (long) == 8) > + return &ppc64_32_linux_gregset; > + return &ppc32_linux_gregset; > } While you'll indeed have to check sizeof (long), you should not do so in ppc-linux-tdep.c (which is built on many different hosts when building a cross-debugger), but rather in ppc-linux-nat.c (which is only built on the native system). Pass the value in as argument similar to what the old code did ... Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com