Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Add support for 64-bit MIPS GNU/Linux targets
Date: Mon, 23 Dec 2002 16:01:00 -0000	[thread overview]
Message-ID: <20021223235639.GA6927@nevyn.them.org> (raw)
In-Reply-To: <1021223225021.ZM25698@localhost.localdomain>

On Mon, Dec 23, 2002 at 03:50:22PM -0700, Kevin Buettner wrote:
> The patch below adds GNU/Linux specific support for the n32 and n64
> MIPS ABIs.

Great!

> I've been able to do both core file debugging and remote debugging
> using this patch when GDB is built as a cross debugger to a
> mips64-linux target.  Unfortunately, I am not presently able to
> (completely) build a native mips64-linux debugger due to issues in
> other parts of the toolchain.

Right, I've heard about the problems.  I'm breathlessly awaiting a
solution :)

> Okay to commit?

I have a couple of comments.

> @@ -95,15 +109,15 @@ supply_gregset (elf_gregset_t *gregsetp)
>    memset (zerobuf, 0, MAX_REGISTER_RAW_SIZE);
>  
>    for (regi = EF_REG0; regi <= EF_REG31; regi++)
> -    supply_register ((regi - EF_REG0), (char *)(regp + regi));
> +    supply_32bit_reg ((regi - EF_REG0), (char *)(regp + regi));
>  
> -  supply_register (LO_REGNUM, (char *)(regp + EF_LO));
> -  supply_register (HI_REGNUM, (char *)(regp + EF_HI));
> +  supply_32bit_reg (LO_REGNUM, (char *)(regp + EF_LO));
> +  supply_32bit_reg (HI_REGNUM, (char *)(regp + EF_HI));
>  
> -  supply_register (PC_REGNUM, (char *)(regp + EF_CP0_EPC));
> -  supply_register (BADVADDR_REGNUM, (char *)(regp + EF_CP0_BADVADDR));
> -  supply_register (PS_REGNUM, (char *)(regp + EF_CP0_STATUS));
> -  supply_register (CAUSE_REGNUM, (char *)(regp + EF_CP0_CAUSE));
> +  supply_32bit_reg (PC_REGNUM, (char *)(regp + EF_CP0_EPC));
> +  supply_32bit_reg (BADVADDR_REGNUM, (char *)(regp + EF_CP0_BADVADDR));
> +  supply_32bit_reg (PS_REGNUM, (char *)(regp + EF_CP0_STATUS));
> +  supply_32bit_reg (CAUSE_REGNUM, (char *)(regp + EF_CP0_CAUSE));
>  
>    /* Fill inaccessible registers with zero.  */
>    supply_register (UNUSED_REGNUM, zerobuf);

Correct me if I'm wrong, but native thread debugging isn't going to
work if you do this.  proc-service.c calls supply_gregset directly and
everything blows up.

Is it time to multiarch supply_gregset?

> @@ -137,9 +151,8 @@ fill_gregset (elf_gregset_t *gregsetp, i
>  
>    if (regno < 32)
>      {
> -      src = &deprecated_registers[REGISTER_BYTE (regno)];
>        dst = regp + regno + EF_REG0;
> -      memcpy (dst, src, sizeof (elf_greg_t));
> +      regcache_collect (regno, dst);
>        return;
>      }
>  

Thanks, should have done this long ago.

> +	set_mips_linux_register_addr (gdbarch, mips_linux_register_addr);

>  void
>  _initialize_mips_linux_tdep (void)
>  {
> +  register_addr_data =
> +    register_gdbarch_data (init_register_addr_data, 0);
> +
>    gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_LINUX,
>  			  mips_linux_init_abi);
>    add_core_fns (&regset_core_fns);

Blech.  So, the way _I_ would have done this would have been to put
this in the tdep structure.  In fact I have several patches which add
similar methods to the tdep structure, for signal handling.  Of course,
this is not compatible with the way Andrew asked to leave the tdep
struct in mips-tdep.c.  This is OK for now, but hopefully we can get
rid of it eventually.  We could multi-arch register_addr (is that
appropriate?  It's a native-only function, isn't it?) to do that.

> Index: config/mips/linux64.mt
> ===================================================================
> RCS file: config/mips/linux64.mt
> diff -N config/mips/linux64.mt
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ config/mips/linux64.mt	23 Dec 2002 22:35:29 -0000
> @@ -0,0 +1,9 @@
> +# Target: Linux/MIPS w/ support for 64-bit ABIs
> +TDEPFILES= mips-tdep.o mips-linux-tdep.o corelow.o \
> +	solib.o solib-svr4.o
> +TM_FILE= tm-linux64.h
> +
> +GDBSERVER_DEPFILES = linux-low.o linux-mips-low.o reg-mips.o

GDBSERVER_DEPFILES isn't actually used any more.  I'll go through and
remove it from everywhere sometime soon; please don't introduce it.

> +
> +SIM_OBS = remote-sim.o
> +SIM = ../sim/mips/libsim.a
> Index: config/mips/tm-linux64.h
> ===================================================================
> RCS file: config/mips/tm-linux64.h
> diff -N config/mips/tm-linux64.h
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ config/mips/tm-linux64.h	23 Dec 2002 22:35:29 -0000
> @@ -0,0 +1,53 @@
> +/* Target-dependent definitions for 64-bit GNU/Linux MIPS.
> +
> +   Copyright 2001, 2002 Free Software Foundation, Inc.

Should only say 2002.  Also, this file could be replaced by:
#include "mips/tm-mips64.h"
#include "mips/tm-linux.h"

because of the way the include guards on tm-mips.h work.  I think.  If
that works, please do it that way.  Hopefully I can kill this header
eventually; need to multi-arch solib handling, among other things.

So:
  supply_gregset?
  GDBSERVER_DEPFILES nit
  tm-linux64 nit

Otherwise, this is OK.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-12-23 23:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-23 15:07 Kevin Buettner
2002-12-23 16:01 ` Daniel Jacobowitz [this message]
2002-12-23 22:37   ` Kevin Buettner
2002-12-24  9:25     ` Daniel Jacobowitz
2002-12-24 11:37       ` Kevin Buettner
2002-12-24 12:09         ` Daniel Jacobowitz
2002-12-24 19:25           ` Kevin Buettner
2003-01-07  0:26   ` Andrew Cagney
2003-01-07 23:16     ` Daniel Jacobowitz
2003-01-08  0:00       ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021223235639.GA6927@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox