From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8712 invoked by alias); 5 Jun 2002 21:03:35 -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 8256 invoked from network); 5 Jun 2002 21:03:23 -0000 Received: from unknown (HELO nevyn.them.org) (66.19.120.26) by sources.redhat.com with SMTP; 5 Jun 2002 21:03:23 -0000 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17Fhrc-0005yE-00; Wed, 05 Jun 2002 16:58:40 -0400 Date: Wed, 05 Jun 2002 14:03:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: gdb@sources.redhat.com Subject: Re: GDB broken on MIPS targets with unmarked binaries Message-ID: <20020605205834.GA22729@nevyn.them.org> Mail-Followup-To: Andrew Cagney , gdb@sources.redhat.com References: <20020605200429.GA7956@nevyn.them.org> <3CFE7825.2030001@cygnus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3CFE7825.2030001@cygnus.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-06/txt/msg00052.txt.bz2 On Wed, Jun 05, 2002 at 04:44:21PM -0400, Andrew Cagney wrote: > >There's an interesting crash on startup in a mips-elf GDB nowadays... the > >code reads: > > > > default: > > tdep->mips_abi_string = "default"; > > tdep->mips_default_saved_regsize = MIPS_REGSIZE; > > tdep->mips_default_stack_argsize = MIPS_REGSIZE; > > tdep->mips_fp_register_double = (REGISTER_VIRTUAL_SIZE (FP0_REGNUM) > > == 8); > > tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; > > tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; > > tdep->mips_regs_have_home_p = 1; > > tdep->gdb_target_is_mips64 = 0; > > tdep->default_mask_address_p = 0; > > set_gdbarch_long_bit (gdbarch, 32); > > set_gdbarch_ptr_bit (gdbarch, 32); > > set_gdbarch_long_long_bit (gdbarch, 64); > > break; > > > >Something brought in recently, probably by the OS ABI changes if I had to > >guess, is causing the check of REGISTER_VIRTUAL_SIZE to fail. I've no idea > >why. Compiling a mips-elf (not mips-linux, which sets MIPS_DEFAULT_ABI) > >and > >running gdb on an unmarked ELF binary reproduces this. > > I'd suspect this: > > 2002-05-08 Andrew Cagney > > * gdbarch.sh (init_gdbarch_swap): Do not clear the swap section. > (clear_gdbarch_swap): New function. > (initialize_non_multiarch): Call. > (gdbarch_update_p): Before calling init(), swap out and clear the > existing architecture. > * gdbarch.c: Regenerate. > > The comment from arm-tdep.c should help explain why the above code is > broken: > > /* We can't use NUM_REGS nor NUM_PSEUDO_REGS here, since that still > references the old architecture vector, not the one we are > building here. */ > prologue_cache.saved_regs = (CORE_ADDR *) > xcalloc (1, (sizeof (CORE_ADDR) > * (gdbarch_num_regs (gdbarch) > + gdbarch_num_pseudo_regs (gdbarch)))); > > As far as I can tell though, REGISTER_VIRTUAL_SIZE expands to > REGISTER_VIRTUAL_TYPE which is still a macro? The expansion appears to be: tdep->mips_fp_register_double = (((((38) >= 38 && (38) < 38 +32) ? builtin_type_float : ((38) == 32 ) ? builtin_type_uint32 : ((38) >= 70 && (38) <= 89) ? builtin_type_uint32 : builtin_type_int))->main_type->length == 8); I can't see any reason for it to crash; I haven't reproduced this locally yet, although I'm working on it. The above expansion came from the second person to mention this to me. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer