Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Deuling <deuling@de.ibm.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Ulrich Weigand <uweigand@de.ibm.com>
Subject: [rfc] [04/05] Get rid of current_gdbarch in convert_register_p
Date: Wed, 07 Nov 2007 11:13:00 -0000	[thread overview]
Message-ID: <47319D4B.8040908@de.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

Hi,

this patch adds gdbarch as parameter to convert_register_p.  

Test with gdb_mbuild. Ok to commit?

ChangeLog:

	* gdbarch.sh (convert_register_p): Add gdbarch as parameter.
	* ia64-tdep.c (ia64_convert_register_p): Likewise.
	* i387-tdep.c (i387_convert_register_p): Likewise.
	* i387-tdep.h (i387_convert_register_p): Likewise.
	* alpha-tdep.c (alpha_convert_register_p): Likewise.
	* gdbarch.{c,h}: Regenerate.

	* rs6000-tdep.c (rs6000_convert_register_p): Add gdbarch as parameter.
	Replace current_gdbarch by gdbarch.
	* mips-tdep.c (mips_convert_register_p): Likewise.
	* m68k-tdep.c (m68k_convert_register_p): Likewise.
	* i386-tdep.c (i386_convert_register_p): Likewise.


-- 
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com



[-- Attachment #2: diff-convert-register-p --]
[-- Type: text/plain, Size: 7779 bytes --]

diff -urpN src/gdb/alpha-tdep.c dev2/gdb/alpha-tdep.c
--- src/gdb/alpha-tdep.c	2007-11-07 07:44:39.000000000 +0100
+++ dev2/gdb/alpha-tdep.c	2007-11-07 10:39:13.000000000 +0100
@@ -198,7 +198,7 @@ alpha_sts (void *out, const void *in)
    registers is different. */
 
 static int
-alpha_convert_register_p (int regno, struct type *type)
+alpha_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type)
 {
   return (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31
 	  && TYPE_LENGTH (type) != 8);
diff -urpN src/gdb/gdbarch.c dev2/gdb/gdbarch.c
--- src/gdb/gdbarch.c	2007-11-07 07:57:51.000000000 +0100
+++ dev2/gdb/gdbarch.c	2007-11-07 10:37:19.000000000 +0100
@@ -295,7 +295,7 @@ struct gdbarch startup_gdbarch =
   0,  /* cannot_store_register */
   0,  /* get_longjmp_target */
   0,  /* believe_pcc_promotion */
-  0,  /* convert_register_p */
+  generic_convert_register_p,  /* convert_register_p */
   0,  /* register_to_value */
   0,  /* value_to_register */
   0,  /* value_from_register */
@@ -1922,7 +1922,7 @@ gdbarch_convert_register_p (struct gdbar
   gdb_assert (gdbarch->convert_register_p != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n");
-  return gdbarch->convert_register_p (regnum, type);
+  return gdbarch->convert_register_p (gdbarch, regnum, type);
 }
 
 void
diff -urpN src/gdb/gdbarch.h dev2/gdb/gdbarch.h
--- src/gdb/gdbarch.h	2007-11-07 07:57:51.000000000 +0100
+++ dev2/gdb/gdbarch.h	2007-11-07 10:37:03.000000000 +0100
@@ -319,7 +319,7 @@ extern void set_gdbarch_get_longjmp_targ
 extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch);
 extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, int believe_pcc_promotion);
 
-typedef int (gdbarch_convert_register_p_ftype) (int regnum, struct type *type);
+typedef int (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch, int regnum, struct type *type);
 extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type);
 extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p);
 
diff -urpN src/gdb/gdbarch.sh dev2/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh	2007-11-07 07:57:51.000000000 +0100
+++ dev2/gdb/gdbarch.sh	2007-11-07 10:36:55.000000000 +0100
@@ -452,7 +452,7 @@ F:int:get_longjmp_target:struct frame_in
 #
 v:int:believe_pcc_promotion:::::::
 #
-f:int:convert_register_p:int regnum, struct type *type:regnum, type:0:generic_convert_register_p::0
+m:int:convert_register_p:int regnum, struct type *type:regnum, type:0:generic_convert_register_p::0
 f:void:register_to_value:struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf:frame, regnum, type, buf:0
 f:void:value_to_register:struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf:frame, regnum, type, buf:0
 # Construct a value representing the contents of register REGNUM in
diff -urpN src/gdb/i386-tdep.c dev2/gdb/i386-tdep.c
--- src/gdb/i386-tdep.c	2007-11-07 07:44:39.000000000 +0100
+++ dev2/gdb/i386-tdep.c	2007-11-07 10:40:56.000000000 +0100
@@ -1857,7 +1857,7 @@ i386_next_regnum (int regnum)
    needs any special handling.  */
 
 static int
-i386_convert_register_p (int regnum, struct type *type)
+i386_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
 {
   int len = TYPE_LENGTH (type);
 
@@ -1880,7 +1880,7 @@ i386_convert_register_p (int regnum, str
 	return 1;
     }
 
-  return i387_convert_register_p (regnum, type);
+  return i387_convert_register_p (gdbarch, regnum, type);
 }
 
 /* Read a value of type TYPE from register REGNUM in frame FRAME, and
diff -urpN src/gdb/i387-tdep.c dev2/gdb/i387-tdep.c
--- src/gdb/i387-tdep.c	2007-10-24 22:29:14.000000000 +0200
+++ dev2/gdb/i387-tdep.c	2007-11-07 10:38:39.000000000 +0100
@@ -289,7 +289,7 @@ i387_print_float_info (struct gdbarch *g
    needs any special handling.  */
 
 int
-i387_convert_register_p (int regnum, struct type *type)
+i387_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
 {
   if (i386_fp_regnum_p (regnum))
     {
diff -urpN src/gdb/i387-tdep.h dev2/gdb/i387-tdep.h
--- src/gdb/i387-tdep.h	2007-10-24 22:29:14.000000000 +0200
+++ dev2/gdb/i387-tdep.h	2007-11-07 10:38:53.000000000 +0100
@@ -58,7 +58,8 @@ extern void i387_print_float_info (struc
 /* Return nonzero if a value of type TYPE stored in register REGNUM
    needs any special handling.  */
 
-extern int i387_convert_register_p (int regnum, struct type *type);
+extern int i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
+				    struct type *type);
 
 /* Read a value of type TYPE from register REGNUM in frame FRAME, and
    return its contents in TO.  */
diff -urpN src/gdb/ia64-tdep.c dev2/gdb/ia64-tdep.c
--- src/gdb/ia64-tdep.c	2007-11-07 07:44:39.000000000 +0100
+++ dev2/gdb/ia64-tdep.c	2007-11-07 10:37:46.000000000 +0100
@@ -918,7 +918,7 @@ ia64_pseudo_register_write (struct gdbar
    and the special ia64 floating point register format.  */
 
 static int
-ia64_convert_register_p (int regno, struct type *type)
+ia64_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type)
 {
   return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM
 	  && type != builtin_type_ia64_ext);
diff -urpN src/gdb/m68k-tdep.c dev2/gdb/m68k-tdep.c
--- src/gdb/m68k-tdep.c	2007-11-07 07:44:40.000000000 +0100
+++ dev2/gdb/m68k-tdep.c	2007-11-07 10:40:38.000000000 +0100
@@ -168,9 +168,9 @@ m68k_register_name (struct gdbarch *gdba
    needs any special handling.  */
 
 static int
-m68k_convert_register_p (int regnum, struct type *type)
+m68k_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
 {
-  if (!gdbarch_tdep (current_gdbarch)->fpregs_present)
+  if (!gdbarch_tdep (gdbarch)->fpregs_present)
     return 0;
   return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7
 	  && type != builtin_type_m68881_ext);
diff -urpN src/gdb/mips-tdep.c dev2/gdb/mips-tdep.c
--- src/gdb/mips-tdep.c	2007-11-07 07:57:51.000000000 +0100
+++ dev2/gdb/mips-tdep.c	2007-11-07 10:40:10.000000000 +0100
@@ -692,14 +692,14 @@ set_mips64_transfers_32bit_regs (char *a
 /* Convert to/from a register and the corresponding memory value.  */
 
 static int
-mips_convert_register_p (int regnum, struct type *type)
+mips_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
 {
-  return (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG
-	  && register_size (current_gdbarch, regnum) == 4
-	  && (regnum % gdbarch_num_regs (current_gdbarch))
-		>= mips_regnum (current_gdbarch)->fp0
-	  && (regnum % gdbarch_num_regs (current_gdbarch))
-		< mips_regnum (current_gdbarch)->fp0 + 32
+  return (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
+	  && register_size (gdbarch, regnum) == 4
+	  && (regnum % gdbarch_num_regs (gdbarch))
+		>= mips_regnum (gdbarch)->fp0
+	  && (regnum % gdbarch_num_regs (gdbarch))
+		< mips_regnum (gdbarch)->fp0 + 32
 	  && TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8);
 }
 
diff -urpN src/gdb/rs6000-tdep.c dev2/gdb/rs6000-tdep.c
--- src/gdb/rs6000-tdep.c	2007-11-07 07:44:40.000000000 +0100
+++ dev2/gdb/rs6000-tdep.c	2007-11-07 10:39:42.000000000 +0100
@@ -2424,9 +2424,10 @@ rs6000_pseudo_register_reggroup_p (struc
    double, we need a conversion if the memory format is float.  */
 
 static int
-rs6000_convert_register_p (int regnum, struct type *type)
+rs6000_convert_register_p (struct gdbarch *gdbarch, int regnum,
+			   struct type *type)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   return (tdep->ppc_fp0_regnum >= 0
 	  && regnum >= tdep->ppc_fp0_regnum


             reply	other threads:[~2007-11-07 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 11:13 Markus Deuling [this message]
2007-11-08 21:39 ` Ulrich Weigand
2007-11-09  5:32   ` Markus Deuling

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=47319D4B.8040908@de.ibm.com \
    --to=deuling@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.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