This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/rfc] Zap old style standard register $fp, fix gdb/251


Hello,

Following on from my previous patch, this zaps the old way of handling 
$fp ($pc, ...).  This in turn removes any confusion between $fp (the 
register) and $fp (the frame->base).

There is still more work though, targets are still required to define 
FP_REGNUM when they don't even have an FP register (see MIPS).  That is 
next.

Comments?
Andrew
2002-04-06  Andrew Cagney  <ac131313@redhat.com>

	* frame.c (read_relative_register_raw_bytes_for_frame): Do not
	override FP_REGNUM with frame->fp.
	* parse.c (num_std_regs, std_regs): Delete.
	(target_map_name_to_register): Do not search std_regs.  Update
	function description.
	* parser-defs.h (num_std_regs, std_regs, struct std_regs): Delete
	declarations.  Update copyright.
	Fix PR gdb/251.
	
diff --exclude *CVS* --exclude *#* --exclude *~* --exclude *%* --exclude *.orig --exclude *.rej --exclude *diffs --exclude new-* --exclude old-* --exclude *-new --exclude *-old -u /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/frame.c /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/frame.c
--- /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/frame.c	Fri May  4 00:15:24 2001
+++ /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/frame.c	Sat Apr  6 14:00:02 2002
@@ -182,24 +182,12 @@
 
    Returns 1 if could not be read, 0 if could.  */
 
-/* FIXME: This function increases the confusion between FP_REGNUM
-   and the virtual/pseudo-frame pointer.  */
-
 static int
 read_relative_register_raw_bytes_for_frame (int regnum,
 					    char *myaddr,
 					    struct frame_info *frame)
 {
   int optim;
-  if (regnum == FP_REGNUM && frame)
-    {
-      /* Put it back in target format. */
-      store_address (myaddr, REGISTER_RAW_SIZE (FP_REGNUM),
-		     (LONGEST) FRAME_FP (frame));
-
-      return 0;
-    }
-
   get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame,
 		      regnum, (enum lval_type *) NULL);
 
diff --exclude *CVS* --exclude *#* --exclude *~* --exclude *%* --exclude *.orig --exclude *.rej --exclude *diffs --exclude new-* --exclude old-* --exclude *-new --exclude *-old -u /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/parse.c /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/parse.c
--- /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/parse.c	Sat Apr  6 08:39:35 2002
+++ /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/parse.c	Sat Apr  6 13:39:06 2002
@@ -104,15 +104,9 @@
 
 static struct funcall *funcall_chain;
 
-/* Assign machine-independent names to certain registers 
-   (unless overridden by the REGISTER_NAMES table) */
-
-unsigned num_std_regs = 0;
-struct std_regs *std_regs;
-
 /* The generic method for targets to specify how their registers are
-   named.  The mapping can be derived from three sources:
-   REGISTER_NAME; std_regs; or a target specific alias hook. */
+   named.  The mapping can be derived from two sources: REGISTER_NAME;
+   or builtin regs.  */
 
 int
 target_map_name_to_register (char *str, int len)
@@ -127,14 +121,6 @@
 	return i;
       }
 
-  /* Try standard aliases. */
-  for (i = 0; i < num_std_regs; i++)
-    if (std_regs[i].name && len == strlen (std_regs[i].name)
-	&& STREQN (str, std_regs[i].name, len))
-      {
-	return std_regs[i].regnum;
-      }
-
   /* Try builtin registers.  */
   i = builtin_reg_map_name_to_regnum (str, len);
   if (i >= 0)
@@ -1361,63 +1347,6 @@
     init_type (TYPE_CODE_INT, 1, 0,
 	       "<variable (not text or data), no debug info>",
 	       NULL);
-
-  /* create the std_regs table */
-
-  num_std_regs = 0;
-#ifdef PC_REGNUM
-  if (PC_REGNUM >= 0)
-    num_std_regs++;
-#endif
-#ifdef FP_REGNUM
-  if (FP_REGNUM >= 0)
-    num_std_regs++;
-#endif
-#ifdef SP_REGNUM
-  if (SP_REGNUM >= 0)
-    num_std_regs++;
-#endif
-#ifdef PS_REGNUM
-  if (PS_REGNUM >= 0)
-    num_std_regs++;
-#endif
-  /* create an empty table */
-  std_regs = xmalloc ((num_std_regs + 1) * sizeof *std_regs);
-  i = 0;
-  /* fill it in */
-#ifdef PC_REGNUM
-  if (PC_REGNUM >= 0)
-    {
-      std_regs[i].name = "pc";
-      std_regs[i].regnum = PC_REGNUM;
-      i++;
-    }
-#endif
-#ifdef FP_REGNUM
-  if (FP_REGNUM >= 0)
-    {
-      std_regs[i].name = "fp";
-      std_regs[i].regnum = FP_REGNUM;
-      i++;
-    }
-#endif
-#ifdef SP_REGNUM
-  if (SP_REGNUM >= 0)
-    {
-      std_regs[i].name = "sp";
-      std_regs[i].regnum = SP_REGNUM;
-      i++;
-    }
-#endif
-#ifdef PS_REGNUM
-  if (PS_REGNUM >= 0)
-    {
-      std_regs[i].name = "ps";
-      std_regs[i].regnum = PS_REGNUM;
-      i++;
-    }
-#endif
-  memset (&std_regs[i], 0, sizeof (std_regs[i]));
 }
 
 void
@@ -1437,8 +1366,6 @@
   register_gdbarch_swap (&msym_data_symbol_type, sizeof (msym_data_symbol_type), NULL);
   register_gdbarch_swap (&msym_unknown_symbol_type, sizeof (msym_unknown_symbol_type), NULL);
 
-  register_gdbarch_swap (&num_std_regs, sizeof (std_regs), NULL);
-  register_gdbarch_swap (&std_regs, sizeof (std_regs), NULL);
   register_gdbarch_swap (NULL, 0, build_parse);
 
   add_show_from_set (
diff --exclude *CVS* --exclude *#* --exclude *~* --exclude *%* --exclude *.orig --exclude *.rej --exclude *diffs --exclude new-* --exclude old-* --exclude *-new --exclude *-old -u /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/parser-defs.h /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/parser-defs.h
--- /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/parser-defs.h	Wed Nov 14 21:22:39 2001
+++ /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/parser-defs.h	Sat Apr  6 13:40:15 2002
@@ -1,6 +1,8 @@
 /* Parser definitions for GDB.
-   Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000 Free Software Foundation, Inc.
+
+   Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+
    Modified from expread.y by the Department of Computer Science at the
    State University of New York at Buffalo.
 
@@ -26,15 +28,6 @@
 
 #include "doublest.h"
 
-struct std_regs
-  {
-    char *name;
-    int regnum;
-  };
-
-extern struct std_regs *std_regs;
-extern unsigned num_std_regs;
-
 extern struct expression *expout;
 extern int expout_size;
 extern int expout_ptr;
@@ -208,8 +201,8 @@
   };
 
 /* The generic method for targets to specify how their registers are
-   named.  The mapping can be derived from three sources:
-   REGISTER_NAME; std_regs; or a target specific alias hook. */
+   named.  The mapping can be derived from two sources: REGISTER_NAME;
+   and builtin regs. */
 
 extern int target_map_name_to_register (char *, int);
 
diff --exclude *CVS* --exclude *#* --exclude *~* --exclude *%* --exclude *.orig --exclude *.rej --exclude *diffs --exclude new-* --exclude old-* --exclude *-new --exclude *-old -u /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/symtab.c /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/symtab.c
--- /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/symtab.c	Sat Apr  6 08:39:39 2002
+++ /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/symtab.c	Sat Apr  6 13:51:27 2002
@@ -181,7 +181,7 @@
 
     if (real_path != NULL)
       {
-        const char *rp = gdb_realpath (symtab_to_filename (s));
+	char *rp = gdb_realpath (symtab_to_filename (s));
         make_cleanup (xfree, rp);
 	if (FILENAME_CMP (real_path, rp) == 0)
 	  {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]