From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25741 invoked by alias); 17 Nov 2001 20:21:10 -0000 Mailing-List: contact gdb-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 25701 invoked from network); 17 Nov 2001 20:21:05 -0000 Received: from unknown (HELO nevyn.them.org) (128.2.145.6) by sourceware.cygnus.com with SMTP; 17 Nov 2001 20:21:05 -0000 Received: from drow by nevyn.them.org with local (Exim 3.32 #1 (Debian)) id 165BxG-0006TR-00; Sat, 17 Nov 2001 15:20:46 -0500 Date: Wed, 07 Nov 2001 16:06:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: Mark Kettenis , gdb@sources.redhat.com Subject: Re: Fixing Linux/SPARC Message-ID: <20011117152046.A23292@nevyn.them.org> Mail-Followup-To: Andrew Cagney , Mark Kettenis , gdb@sources.redhat.com References: <200110171407.f9HE7qL00752@delius.kettenis.local> <20011117134010.A15244@nevyn.them.org> <3BF6B812.1080102@cygnus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3BF6B812.1080102@cygnus.com> User-Agent: Mutt/1.3.23i X-SW-Source: 2001-11/txt/msg00077.txt.bz2 On Sat, Nov 17, 2001 at 02:18:42PM -0500, Andrew Cagney wrote: > >On Wed, Oct 17, 2001 at 04:07:52PM +0200, Mark Kettenis wrote: > > > >>Hi Dan & other interested folks, > >> > >>Something like the code below (completely untested, probably doesn't > >>even compile) is needed to fix Linux/SPARC. > > > > > >Compiles, after fixing the obvious typos. I'm going to commit it to > >the mainline as obvious, since it takes Linux/SPARC from not-building > >to building; test results are abysmal, though. It looks as if we can't > >figure out the memory location variables are stored at correctly. > >They're being accessed in the unmapped 0x90000000 segment instead of > >0x70000000, and not even at the right offsets. I'll look in to it more > >later. > > Dan, can you please replace the calls to read_register_gen() with > regcache_collect(). Done. Threads don't work on Sparc still, because prgregset_t is much smaller than an elf_gregset_t, so we corrupt memory in thread_db_fetch_registers. You know by now what my opinion of this problem is :) It appears that, for Sparc at least, this was fixed on: 2000-03-21 Jakub Jelinek My Sparc test machine runs a glibc older than that. I'd like to to come up with some autoconf test to either not compile at all when this bug is present, disable thread support, or compile in some hack to make the type the right size. Any objection? Actually, gross as it may be, something like this in thread-db.c ought to do the trick: union big_enough_gregset_t { prgregset_t p; gdb_gregset_t g; }; and replacing uses of the prgregset with uses of big_enough_gregset_t.p should fix the warnings without any autoconf checks. How's that sound? -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer 2001-11-17 Daniel Jacobowitz * sparc-linux-nat.c (fill_gregset): Replace read_register_gen with regcache_collect. (fill_fpregset): Likewise. Index: sparc-linux-nat.c =================================================================== RCS file: /cvs/src/src/gdb/sparc-linux-nat.c,v retrieving revision 1.1 diff -u -p -r1.1 sparc-linux-nat.c --- sparc-linux-nat.c 2001/11/17 18:38:29 1.1 +++ sparc-linux-nat.c 2001/11/17 20:18:40 @@ -56,22 +56,22 @@ fill_gregset (elf_gregset_t *gregsetp, i for (i = G0_REGNUM; i <= I7_REGNUM; i++) if (regno == -1 || regno == i) - read_register_gen (i, (char *) (regp + (i - G0_REGNUM))); + regcache_collect (i, regp + (i - G0_REGNUM)); if (regno == -1 || regno == PS_REGNUM) - read_register_gen (PS_REGNUM, (char *) (regp + 32)); + regcache_collect (PS_REGNUM, regp + 32); if (regno == -1 || regno == PC_REGNUM) - read_register_gen (PC_REGNUM, (char *) (regp + 33)); + regcache_collect (PC_REGNUM, regp + 33); if (regno == -1 || regno == NPC_REGNUM) - read_register_gen (NPC_REGNUM, (char *) (regp + 34)); + regcache_collect (NPC_REGNUM, regp + 34); if (regno == -1 || regno == Y_REGNUM) - read_register_gen (Y_REGNUM, (char *) (regp + 35)); + regcache_collect (Y_REGNUM, regp + 35); if (regno == -1 || regno == WIM_REGNUM) - read_register_gen (WIM_REGNUM, (char *) (regp + 36)); + regcache_collect (WIM_REGNUM, regp + 36); if (regno == -1 || regno == TBR_REGNUM) - read_register_gen (TBR_REGNUM, (char *) (regp + 37)); + regcache_collect (TBR_REGNUM, regp + 37); } void @@ -92,8 +92,8 @@ fill_fpregset (elf_fpregset_t *fpregsetp for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++) if (regno == -1 || regno == i) - read_register_gen (i, (char *) &fpregsetp->pr_fr.pr_regs[i - FP0_REGNUM]); + regcache_collect (i, &fpregsetp->pr_fr.pr_regs[i - FP0_REGNUM]); if (regno == -1 || regno == FPS_REGNUM) - read_register_gen (FPS_REGNUM, (char *) &fpregsetp->pr_fsr); + regcache_collect (FPS_REGNUM, &fpregsetp->pr_fsr); }