Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] mips n64 support, part 1
@ 2002-07-31 11:28 Kevin Buettner
  2002-07-31 11:56 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Kevin Buettner @ 2002-07-31 11:28 UTC (permalink / raw)
  To: gdb-patches

I've just committed the patch below.

I considering asking for approval on this patch, but decided that the
addition of the constant and string were obvious.  The
mips_gdbarch_init() changes probably aren't obvious, but I think
they're safe in the sense that they won't break support for other MIPS
ABIs.  (I have some other patches on the way that I will ask approval
for though.)

	* mips-tdep.c (enum mips_abi): Add MIPS_ABI_N64.
	(mips_abi_strings): Add "n64".
	(mips_gdbarch_init): Add test for n64 abi.  Add MIPS_ABI_N64 case.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.81
diff -u -p -r1.81 mips-tdep.c
--- mips-tdep.c	19 Jun 2002 16:48:47 -0000	1.81
+++ mips-tdep.c	31 Jul 2002 17:59:02 -0000
@@ -64,6 +64,7 @@ enum mips_abi
     MIPS_ABI_UNKNOWN = 0,
     MIPS_ABI_N32,
     MIPS_ABI_O32,
+    MIPS_ABI_N64,
     MIPS_ABI_O64,
     MIPS_ABI_EABI32,
     MIPS_ABI_EABI64,
@@ -76,6 +77,7 @@ static const char *mips_abi_strings[] = 
   "auto",
   "n32",
   "o32",
+  "n64",
   "o64",
   "eabi32",
   "eabi64",
@@ -4352,7 +4354,11 @@ mips_gdbarch_init (struct gdbarch_info i
 	  break;
 	case bfd_mach_mips8000:
 	case bfd_mach_mips10000:
-	  mips_abi = MIPS_ABI_N32;
+	  if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
+	      && elf_elfheader (info.abfd)->e_ident[EI_CLASS] == ELFCLASS64)
+	    mips_abi = MIPS_ABI_N64;
+	  else
+	    mips_abi = MIPS_ABI_N32;
 	  break;
 	}
     }
@@ -4481,6 +4487,30 @@ mips_gdbarch_init (struct gdbarch_info i
       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);
+
+      /* Set up the disassembler info, so that we get the right
+	 register names from libopcodes.  */
+      tm_print_insn_info.flavour = bfd_target_elf_flavour;
+      tm_print_insn_info.arch = bfd_arch_mips;
+      if (info.bfd_arch_info != NULL
+	  && info.bfd_arch_info->arch == bfd_arch_mips
+	  && info.bfd_arch_info->mach)
+	tm_print_insn_info.mach = info.bfd_arch_info->mach;
+      else
+	tm_print_insn_info.mach = bfd_mach_mips8000;
+      break;
+    case MIPS_ABI_N64:
+      tdep->mips_default_saved_regsize = 8;
+      tdep->mips_default_stack_argsize = 8;
+      tdep->mips_fp_register_double = 1;
+      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 = 0;
+      tdep->gdb_target_is_mips64 = 1;
+      tdep->default_mask_address_p = 0;
+      set_gdbarch_long_bit (gdbarch, 64);
+      set_gdbarch_ptr_bit (gdbarch, 64);
       set_gdbarch_long_long_bit (gdbarch, 64);
 
       /* Set up the disassembler info, so that we get the right


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mips n64 support, part 1
  2002-07-31 11:28 [PATCH] mips n64 support, part 1 Kevin Buettner
@ 2002-07-31 11:56 ` Daniel Jacobowitz
  2002-07-31 12:00   ` Kevin Buettner
  2002-08-01 11:52 ` Andrew Cagney
  2002-08-01 12:02 ` Andrew Cagney
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2002-07-31 11:56 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

On Wed, Jul 31, 2002 at 11:23:28AM -0700, Kevin Buettner wrote:
> I've just committed the patch below.
> 
> I considering asking for approval on this patch, but decided that the
> addition of the constant and string were obvious.  The
> mips_gdbarch_init() changes probably aren't obvious, but I think
> they're safe in the sense that they won't break support for other MIPS
> ABIs.  (I have some other patches on the way that I will ask approval
> for though.)

Does mips_find_abi_section need another case?  I believe GCC will write
out ".mdebug.abiN64", although I'm not 100% sure that I have the string
right.


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mips n64 support, part 1
  2002-07-31 11:56 ` Daniel Jacobowitz
@ 2002-07-31 12:00   ` Kevin Buettner
  2002-07-31 12:50     ` Kevin Buettner
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Buettner @ 2002-07-31 12:00 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

On Jul 31,  2:28pm, Daniel Jacobowitz wrote:

> Does mips_find_abi_section need another case?

Hmm.  I think it probably will.  For the time being, I'm testing on
Irix and I don't see any .mdebug sections.  I.e, the test that I added
gets the job done for the binaries that I'm working with.

> I believe GCC will write
> out ".mdebug.abiN64", although I'm not 100% sure that I have the string
> right.

I've asked Eric Christopher.  He says that ".mdebug.abiN64" looks
right.  I'll submit a patch which adds this string.

Thanks,

Kevin


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mips n64 support, part 1
  2002-07-31 12:00   ` Kevin Buettner
@ 2002-07-31 12:50     ` Kevin Buettner
  0 siblings, 0 replies; 9+ messages in thread
From: Kevin Buettner @ 2002-07-31 12:50 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

On Jul 31, 11:56am, Kevin Buettner wrote:

> On Jul 31,  2:28pm, Daniel Jacobowitz wrote:
> 
> > Does mips_find_abi_section need another case?
> 
> Hmm.  I think it probably will.  For the time being, I'm testing on
> Irix and I don't see any .mdebug sections.  I.e, the test that I added
> gets the job done for the binaries that I'm working with.
> 
> > I believe GCC will write
> > out ".mdebug.abiN64", although I'm not 100% sure that I have the string
> > right.
> 
> I've asked Eric Christopher.  He says that ".mdebug.abiN64" looks
> right.  I'll submit a patch which adds this string.

Here it is (committed)...

	* mips-tdep.c (mips_find_abi_section): Add N64 ABI recognition
	test.  (Thanks to Daniel Jacobowitz.)

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.82
diff -u -p -r1.82 mips-tdep.c
--- mips-tdep.c	31 Jul 2002 18:13:24 -0000	1.82
+++ mips-tdep.c	31 Jul 2002 19:03:07 -0000
@@ -4252,6 +4252,8 @@ mips_find_abi_section (bfd *abfd, asecti
     *abip = MIPS_ABI_O32;
   else if (strcmp (name, ".mdebug.abiN32") == 0)
     *abip = MIPS_ABI_N32;
+  else if (strcmp (name, ".mdebug.abiN64") == 0)
+    *abip = MIPS_ABI_N64;
   else if (strcmp (name, ".mdebug.abiO64") == 0)
     *abip = MIPS_ABI_O64;
   else if (strcmp (name, ".mdebug.eabi32") == 0)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mips n64 support, part 1
  2002-07-31 11:28 [PATCH] mips n64 support, part 1 Kevin Buettner
  2002-07-31 11:56 ` Daniel Jacobowitz
@ 2002-08-01 11:52 ` Andrew Cagney
  2002-08-01 12:02 ` Andrew Cagney
  2 siblings, 0 replies; 9+ messages in thread
From: Andrew Cagney @ 2002-08-01 11:52 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> I've just committed the patch below.
> 
> I considering asking for approval on this patch, but decided that the
> addition of the constant and string were obvious.  The
> mips_gdbarch_init() changes probably aren't obvious, but I think
> they're safe in the sense that they won't break support for other MIPS
> ABIs.  (I have some other patches on the way that I will ask approval
> for though.)

If you are ever unsure, you should probably ask 8-/

Andrew



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mips n64 support, part 1
  2002-07-31 11:28 [PATCH] mips n64 support, part 1 Kevin Buettner
  2002-07-31 11:56 ` Daniel Jacobowitz
  2002-08-01 11:52 ` Andrew Cagney
@ 2002-08-01 12:02 ` Andrew Cagney
  2002-08-01 12:06   ` Daniel Jacobowitz
  2 siblings, 1 reply; 9+ messages in thread
From: Andrew Cagney @ 2002-08-01 12:02 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> @@ -4352,7 +4354,11 @@ mips_gdbarch_init (struct gdbarch_info i
>  	  break;
>  	case bfd_mach_mips8000:
>  	case bfd_mach_mips10000:
> -	  mips_abi = MIPS_ABI_N32;
> +	  if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
> +	      && elf_elfheader (info.abfd)->e_ident[EI_CLASS] == ELFCLASS64)
> +	    mips_abi = MIPS_ABI_N64;
> +	  else
> +	    mips_abi = MIPS_ABI_N32;
>  	  break;
>  	}
>      }

This bit should at least have a comment explaining the assumptions 
behind it -- have you actually seen this code being triggered?  I don't 
think the code is ever reached (unless the executable is very old) as 
the earlier:

   /* GCC creates a pseudo-section whose name describes the ABI.  */
   if (mips_abi == MIPS_ABI_UNKNOWN && info.abfd != NULL)
     bfd_map_over_sections (info.abfd, mips_find_abi_section, &mips_abi);

should catch most modern cases.

Andrew



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mips n64 support, part 1
  2002-08-01 12:02 ` Andrew Cagney
@ 2002-08-01 12:06   ` Daniel Jacobowitz
  2002-08-01 12:13     ` Kevin Buettner
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2002-08-01 12:06 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Kevin Buettner, gdb-patches

On Thu, Aug 01, 2002 at 03:02:18PM -0400, Andrew Cagney wrote:
> >@@ -4352,7 +4354,11 @@ mips_gdbarch_init (struct gdbarch_info i
> > 	  break;
> > 	case bfd_mach_mips8000:
> > 	case bfd_mach_mips10000:
> >-	  mips_abi = MIPS_ABI_N32;
> >+	  if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
> >+	      && elf_elfheader (info.abfd)->e_ident[EI_CLASS] == ELFCLASS64)
> >+	    mips_abi = MIPS_ABI_N64;
> >+	  else
> >+	    mips_abi = MIPS_ABI_N32;
> > 	  break;
> > 	}
> >     }
> 
> This bit should at least have a comment explaining the assumptions 
> behind it -- have you actually seen this code being triggered?  I don't 
> think the code is ever reached (unless the executable is very old) as 
> the earlier:
> 
>   /* GCC creates a pseudo-section whose name describes the ABI.  */
>   if (mips_abi == MIPS_ABI_UNKNOWN && info.abfd != NULL)
>     bfd_map_over_sections (info.abfd, mips_find_abi_section, &mips_abi);
> 
> should catch most modern cases.

Kevin is using IRIX CC, I believe. The marker sections are
GCC-specific.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mips n64 support, part 1
  2002-08-01 12:06   ` Daniel Jacobowitz
@ 2002-08-01 12:13     ` Kevin Buettner
  2002-08-01 12:21       ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Buettner @ 2002-08-01 12:13 UTC (permalink / raw)
  To: Daniel Jacobowitz, Andrew Cagney; +Cc: Kevin Buettner, gdb-patches

On Aug 1,  3:06pm, Daniel Jacobowitz wrote:

> On Thu, Aug 01, 2002 at 03:02:18PM -0400, Andrew Cagney wrote:
> > >@@ -4352,7 +4354,11 @@ mips_gdbarch_init (struct gdbarch_info i
> > > 	  break;
> > > 	case bfd_mach_mips8000:
> > > 	case bfd_mach_mips10000:
> > >-	  mips_abi = MIPS_ABI_N32;
> > >+	  if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
> > >+	      && elf_elfheader (info.abfd)->e_ident[EI_CLASS] == ELFCLASS64)
> > >+	    mips_abi = MIPS_ABI_N64;
> > >+	  else
> > >+	    mips_abi = MIPS_ABI_N32;
> > > 	  break;
> > > 	}
> > >     }
> > 
> > This bit should at least have a comment explaining the assumptions 
> > behind it -- have you actually seen this code being triggered?  I don't 
> > think the code is ever reached (unless the executable is very old) as 
> > the earlier:
> > 
> >   /* GCC creates a pseudo-section whose name describes the ABI.  */
> >   if (mips_abi == MIPS_ABI_UNKNOWN && info.abfd != NULL)
> >     bfd_map_over_sections (info.abfd, mips_find_abi_section, &mips_abi);
> > 
> > should catch most modern cases.
> 
> Kevin is using IRIX CC, I believe.

Yes.

> The marker sections are GCC-specific.

Actually, I think they're platform specific.  In the tests I did yesterday,
I didn't see the marker sections in binaries created by gcc either.

I'll add a comment though.

Kevin


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mips n64 support, part 1
  2002-08-01 12:13     ` Kevin Buettner
@ 2002-08-01 12:21       ` Daniel Jacobowitz
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2002-08-01 12:21 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: Andrew Cagney, gdb-patches

On Thu, Aug 01, 2002 at 12:13:36PM -0700, Kevin Buettner wrote:
> On Aug 1,  3:06pm, Daniel Jacobowitz wrote:
> 
> > On Thu, Aug 01, 2002 at 03:02:18PM -0400, Andrew Cagney wrote:
> > > >@@ -4352,7 +4354,11 @@ mips_gdbarch_init (struct gdbarch_info i
> > > > 	  break;
> > > > 	case bfd_mach_mips8000:
> > > > 	case bfd_mach_mips10000:
> > > >-	  mips_abi = MIPS_ABI_N32;
> > > >+	  if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
> > > >+	      && elf_elfheader (info.abfd)->e_ident[EI_CLASS] == ELFCLASS64)
> > > >+	    mips_abi = MIPS_ABI_N64;
> > > >+	  else
> > > >+	    mips_abi = MIPS_ABI_N32;
> > > > 	  break;
> > > > 	}
> > > >     }
> > > 
> > > This bit should at least have a comment explaining the assumptions 
> > > behind it -- have you actually seen this code being triggered?  I don't 
> > > think the code is ever reached (unless the executable is very old) as 
> > > the earlier:
> > > 
> > >   /* GCC creates a pseudo-section whose name describes the ABI.  */
> > >   if (mips_abi == MIPS_ABI_UNKNOWN && info.abfd != NULL)
> > >     bfd_map_over_sections (info.abfd, mips_find_abi_section, &mips_abi);
> > > 
> > > should catch most modern cases.
> > 
> > Kevin is using IRIX CC, I believe.
> 
> Yes.
> 
> > The marker sections are GCC-specific.
> 
> Actually, I think they're platform specific.  In the tests I did yesterday,
> I didn't see the marker sections in binaries created by gcc either.
> 
> I'll add a comment though.

Blah.  They appear to be conditioned on TARGET_GAS, for whatever
reason; Eric added that in Sept. 2001, not long after they were
originally added.

Hmm...
        (mips_asm_file_start): Add new section to pass abi to gdb.

Just curious - did Red Hat's internal tree have code in GDB to read
this, before I added it to the community tree?  There was about nine
months worth of lag there.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-08-01 19:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-31 11:28 [PATCH] mips n64 support, part 1 Kevin Buettner
2002-07-31 11:56 ` Daniel Jacobowitz
2002-07-31 12:00   ` Kevin Buettner
2002-07-31 12:50     ` Kevin Buettner
2002-08-01 11:52 ` Andrew Cagney
2002-08-01 12:02 ` Andrew Cagney
2002-08-01 12:06   ` Daniel Jacobowitz
2002-08-01 12:13     ` Kevin Buettner
2002-08-01 12:21       ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox