]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
merge with trunk
authorAndrew Cagney <cagney@redhat.com>
Fri, 28 Jun 2002 23:19:26 +0000 (23:19 +0000)
committerAndrew Cagney <cagney@redhat.com>
Fri, 28 Jun 2002 23:19:26 +0000 (23:19 +0000)
25 files changed:
gdb/Makefile.in
gdb/abug-rom.c
gdb/arch-utils.c
gdb/blockframe.c
gdb/breakpoint.c
gdb/command.h
gdb/cpu32bug-rom.c
gdb/cris-tdep.c
gdb/dbug-rom.c
gdb/frame.h
gdb/m68k-tdep.c
gdb/monitor.c
gdb/monitor.h
gdb/objfiles.h
gdb/ppcnbsd-tdep.c
gdb/regcache.c
gdb/remote-est.c
gdb/rom68k-rom.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/sh-tdep.c
gdb/symtab.h
gdb/vax-tdep.c
gdb/vax-tdep.h
gdb/version.in

index 29e7060390c68841209927731568c5c8c0af4175..ef35cccdb1d39086d3c94994959c0f2e97cc2bb3 100644 (file)
@@ -641,7 +641,7 @@ macrotab_h =    macrotab.h $(obstack_h) $(bcache_h)
 macroscope_h =  macroscope.h $(macrotab_h) $(symtab_h)
 memattr_h =     memattr.h
 monitor_h =    monitor.h
-objfiles_h =   objfiles.h
+objfiles_h =   objfiles.h $(bcache_h)
 parser_defs_h =        parser-defs.h $(doublest_h)
 ppc_tdep_h =   ppc-tdep.h osabi.h
 regcache_h =   regcache.h
@@ -655,7 +655,7 @@ solist_h =  solist.h
 source_h =     source.h
 stabsread_h =  stabsread.h
 symfile_h =    symfile.h
-symtab_h =     symtab.h $(bcache_h)
+symtab_h =     symtab.h
 target_h =      target.h $(bfd_h) $(symtab_h) $(dcache_h) $(memattr_h)
 terminal_h =   terminal.h
 top_h =                top.h
@@ -665,6 +665,7 @@ ui_out_h =      ui-out.h
 valprint_h =   valprint.h
 value_h =      value.h $(symtab_h) $(gdbtypes_h) $(expression_h) $(doublest_h)
 varobj_h =      varobj.h $(symtab_h) $(gdbtypes_h)
+vax_tdep_h =   vax-tdep.h osabi.h
 version_h =    version.h
 wrapper_h =    wrapper.h
 xcoffsolib_h = xcoffsolib.h
@@ -875,7 +876,7 @@ init.c: $(INIT_FILES)
            -e 's|\([^  ][^     ]*\)|$(srcdir)/\1|g' | \
        while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \
        sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' | \
-       ( echo _initialize_gdbtypes ; grep -v -e '^_initialize_gdbtypes$$' ) > init.l-tmp
+       ( echo _initialize_gdbtypes ; grep -v '^_initialize_gdbtypes$$' ) > init.l-tmp
        @echo '/* Do not modify this file.  */' >>init.c-tmp
        @echo '/* It is created automatically by the Makefile.  */'>>init.c-tmp
        @echo '#include "defs.h"' >>init.c-tmp
@@ -2236,7 +2237,7 @@ values.o: values.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \
        $(gdb_string_h) scm-lang.h $(doublest_h)
 
 vax-tdep.o: vax-tdep.c $(OP_INCLUDE)/vax.h $(defs_h) $(symtab_h) \
-       $(arch_utils_h) $(inferior_h) vax-tdep.h
+       $(arch_utils_h) $(inferior_h) $(vax_tdep_h)
 
 x86-64-linux-tdep.o : x86-64-linux-tdep.c $(defs_h) $(inferior_h) \
        $(gdbcore_h) $(regcache_h) x86-64-tdep.h i386-tdep.h $(dwarf2cfi_h)
index b4c44a94b541e08b8ba790286ec3f33e8caedba5..8a9e8ff47c7fdbc1925997c9b7ea48eba6d7e7c9 100644 (file)
@@ -76,12 +76,22 @@ abug_supply_register (char *regname, int regnamelen, char *val, int vallen)
  * registers either. So, typing "info reg sp" becomes an "A7".
  */
 
-static char *abug_regnames[NUM_REGS] =
+static const char *
+abug_regname (int index)
 {
-  "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
-  "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
-  "PC",
-};
+  static char *regnames[] =
+  {
+    "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
+    "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
+    "PC",
+  };
+
+  if ((index >= (sizeof (regnames) / sizeof (regnames[0]))) 
+       || (index < 0) || (index >= NUM_REGS))
+    return NULL;
+  else
+    return regnames[index];
+}
 
 /*
  * Define the monitor command strings. Since these are passed directly
@@ -141,7 +151,8 @@ init_abug_cmds (void)
   abug_cmds.cmd_end = NULL;    /* optional command terminator */
   abug_cmds.target = &abug_ops;        /* target operations */
   abug_cmds.stopbits = SERIAL_1_STOPBITS;      /* number of stop bits */
-  abug_cmds.regnames = abug_regnames;  /* registers names */
+  abug_cmds.regnames = NULL;   /* registers names */
+  abug_cmds.regname = abug_regname;
   abug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
 };
 
index d60eeb36ed79553e49af69327e147249365fd61a..b79a02a76abb40b3546b667ee3d6d38ea34867b4 100644 (file)
@@ -117,22 +117,6 @@ legacy_register_sim_regno (int regnum)
     return LEGACY_SIM_REGNO_IGNORE;
 }
 
-int
-legacy_register_sim_regno (int regnum)
-{
-  /* Only makes sense to supply raw registers.  */
-  gdb_assert (regnum >= 0 && regnum < NUM_REGS);
-  /* NOTE: cagney/2002-05-13: The old code did it this way and it is
-     suspected that some GDB/SIM combinations may rely on this
-     behavour.  The default should be one2one_register_sim_regno
-     (below).  */
-  if (REGISTER_NAME (regnum) != NULL
-      && REGISTER_NAME (regnum)[0] != '\0')
-    return regnum;
-  else
-    return LEGACY_SIM_REGNO_IGNORE;
-}
-
 int
 generic_frameless_function_invocation_not (struct frame_info *fi)
 {
index 7362f5de603229af798356666bbe1e3e609c91b5..9971e5dff33ac6666f5fbaa4ba4c9aaf90a6c6cc 100644 (file)
@@ -1144,7 +1144,7 @@ static struct dummy_frame *dummy_frame_stack = NULL;
    adjust for DECR_PC_AFTER_BREAK.  This is because it is only legal
    to call this function after the PC has been adjusted.  */
 
-struct regcache *
+static struct regcache *
 generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
 {
   struct dummy_frame *dummyframe;
@@ -1161,6 +1161,15 @@ generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
   return 0;
 }
 
+char *
+deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
+{
+  struct regcache *regcache = generic_find_dummy_frame (pc, fp);
+  if (regcache == NULL)
+    return NULL;
+  return deprecated_grub_regcache_for_registers (regcache);
+}
+
 /* Function: pc_in_call_dummy (pc, sp, fp)
 
    Return true if the PC falls in a dummy frame created by gdb for an
@@ -1233,7 +1242,7 @@ generic_push_dummy_frame (void)
   dummy_frame->sp = read_sp ();
   dummy_frame->top = dummy_frame->sp;
   dummy_frame->fp = fp;
-  regcache_save (dummy_frame->regcache);
+  regcache_cpy (dummy_frame->regcache, current_regcache);
   dummy_frame->next = dummy_frame_stack;
   dummy_frame_stack = dummy_frame;
 }
@@ -1281,7 +1290,7 @@ generic_pop_dummy_frame (void)
   if (!dummy_frame)
     error ("Can't pop dummy frame!");
   dummy_frame_stack = dummy_frame->next;
-  regcache_restore (dummy_frame->regcache);
+  regcache_cpy (current_regcache, dummy_frame->regcache);
   flush_cached_frames ();
 
   regcache_xfree (dummy_frame->regcache);
@@ -1366,10 +1375,11 @@ generic_call_dummy_register_unwind (struct frame_info *frame, void **cache,
 #endif
       gdb_assert (registers != NULL);
       /* Return the actual value.  */
-      memcpy (bufferp,
-             (deprecated_grub_regcache_for_registers (registers)
-              + REGISTER_BYTE (regnum)),
-             REGISTER_RAW_SIZE (regnum));
+      /* FIXME: cagney/2002-06-26: This should be via the
+         gdbarch_register_read() method so that it, on the fly,
+         constructs either a raw or pseudo register from the raw
+         register cache.  */
+      regcache_read (registers, regnum, bufferp);
     }
 }
 
@@ -1515,6 +1525,10 @@ generic_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
          if (lval)             /* found it in a CALL_DUMMY frame */
            *lval = not_lval;
          if (raw_buffer)
+           /* FIXME: cagney/2002-06-26: This should be via the
+              gdbarch_register_read() method so that it, on the fly,
+              constructs either a raw or pseudo register from the raw
+              register cache.  */
            regcache_read (generic_find_dummy_frame (frame->pc, frame->frame),
                           regnum, raw_buffer);
          return;
index 187061e45e7b9e6fc14a732557787179d0f3c0cd..ce1360d53e816f6548b9d96ffa1d788d851e8fb3 100644 (file)
@@ -6769,6 +6769,8 @@ delete_command (char *arg, int from_tty)
 {
   struct breakpoint *b, *temp;
 
+  dont_repeat ();
+
   if (arg == 0)
     {
       int breaks_to_delete = 0;
index 00110ce555d25e8c146df56f1e909f3abf8d7c69..9aceef6446ab00544442089535a6c5ff7f3ade2e 100644 (file)
@@ -210,6 +210,26 @@ extern void help_list (struct cmd_list_element *, char *,
 extern void help_cmd_list (struct cmd_list_element *, enum command_class,
                           char *, int, struct ui_file *);
 
+extern void add_setshow_cmd (char *name,
+                            enum command_class class,
+                            var_types var_type, void *var,
+                            char *set_doc, char *show_doc,
+                            cmd_sfunc_ftype *set_func,
+                            cmd_sfunc_ftype *show_func,
+                            struct cmd_list_element **set_list,
+                            struct cmd_list_element **show_list);
+
+extern void add_setshow_cmd_full (char *name,
+                                 enum command_class class,
+                                 var_types var_type, void *var,
+                                 char *set_doc, char *show_doc,
+                                 cmd_sfunc_ftype *set_func,
+                                 cmd_sfunc_ftype *show_func,
+                                 struct cmd_list_element **set_list,
+                                 struct cmd_list_element **show_list,
+                                 struct cmd_list_element **set_result,
+                                 struct cmd_list_element **show_result);
+
 extern struct cmd_list_element *add_set_cmd (char *name, enum
                                             command_class class,
                                             var_types var_type, void *var,
index 2801be9ea0fb5f8ad5cd96575877113015bf161f..efaf89a4b70844775a8fe2a7565613749e9cdf42 100644 (file)
@@ -74,12 +74,22 @@ cpu32bug_supply_register (char *regname, int regnamelen, char *val, int vallen)
  * registers either. So, typing "info reg sp" becomes an "A7".
  */
 
-static char *cpu32bug_regnames[NUM_REGS] =
+static const char *
+cpu32bug_regname (int index)
 {
-  "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
-  "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
-  "SR", "PC",
-};
+  static char *regnames[] =
+  {
+    "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
+    "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
+    "SR", "PC"
+  };
+
+  if ((index >= (sizeof (regnames) / sizeof (regnames[0]))) 
+       || (index < 0) || (index >= NUM_REGS))
+    return NULL;
+  else
+    return regnames[index];
+}
 
 /*
  * Define the monitor command strings. Since these are passed directly
@@ -139,7 +149,8 @@ init_cpu32bug_cmds (void)
   cpu32bug_cmds.cmd_end = NULL;        /* optional command terminator */
   cpu32bug_cmds.target = &cpu32bug_ops;                /* target operations */
   cpu32bug_cmds.stopbits = SERIAL_1_STOPBITS;  /* number of stop bits */
-  cpu32bug_cmds.regnames = cpu32bug_regnames;  /* registers names */
+  cpu32bug_cmds.regnames = NULL;       /* registers names */
+  cpu32bug_cmds.regname = cpu32bug_regname;
   cpu32bug_cmds.magic = MONITOR_OPS_MAGIC;     /* magic */
 };                             /* init_cpu32bug_cmds */
 
index b223f8734eeb8b04be52fa48958192f378fe70f6..864bac1c7ddcb0c129d680c4af79bf3ae6a9ee80 100644 (file)
@@ -1155,7 +1155,7 @@ cris_frame_init_saved_regs (struct frame_info *fi)
   CORE_ADDR ip;
   struct symtab_and_line sal;
   int best_limit;
-  char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+  char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame);
   
   /* Examine the entire prologue.  */
   register int frameless_p = 0; 
index f31555738ebf4b5f33c72bfb184aa1b780ff2162..bd20184c006ec6905ce66c28fd96439a42a18fd6 100644 (file)
@@ -76,13 +76,25 @@ dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
    different names than GDB does, and don't support all the registers
    either. So, typing "info reg sp" becomes an "A7". */
 
-static char *dbug_regnames[NUM_REGS] =
+static const char *
+dbug_regname (int index)
 {
-  "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
-  "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
-  "SR", "PC"
-  /* no float registers */
-};
+  static char *regnames[] =
+  {
+    "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
+    "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
+    "SR", "PC"
+    /* no float registers */
+  };
+
+  if ((index >= (sizeof (regnames) / sizeof (regnames[0]))) 
+      || (index < 0) || (index >= NUM_REGS))
+    return NULL;
+  else
+    return regnames[index];
+
+}
+
 static struct target_ops dbug_ops;
 static struct monitor_ops dbug_cmds;
 
@@ -135,7 +147,8 @@ init_dbug_cmds (void)
   dbug_cmds.cmd_end = NULL;    /* optional command terminator */
   dbug_cmds.target = &dbug_ops;        /* target operations */
   dbug_cmds.stopbits = SERIAL_1_STOPBITS;      /* number of stop bits */
-  dbug_cmds.regnames = dbug_regnames;  /* registers names */
+  dbug_cmds.regnames = NULL;   /* registers names */
+  dbug_cmds.regname = dbug_regname;
   dbug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
 }                              /* init_debug_ops */
 
index 27bd7ff8943b14824d8ffce0e97a9bba0257469e..d3bd2ab4d516c7e671b7626f6f73f3099a199140 100644 (file)
@@ -310,7 +310,13 @@ extern void generic_pop_dummy_frame (void);
 
 extern int generic_pc_in_call_dummy (CORE_ADDR pc,
                                     CORE_ADDR sp, CORE_ADDR fp);
-extern struct regcache *generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp);
+
+/* NOTE: cagney/2002-06-26: Targets should no longer use this
+   function.  Instead, the contents of a dummy frames registers can be
+   obtained by applying: frame_register_unwind to the dummy frame; or
+   get_saved_register to the next outer frame.  */
+
+extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp);
 
 extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
                                    int nargs, struct value **args,
index 7450d212ec5e803995ade0fc4ca66cfb3fa0e2ea..d1ab13fb6e195e89a7b35d304de0fbe1274cc5cb 100644 (file)
 #define P_FMOVM                0xf237
 #define P_TRAP         0x4e40
 
+enum
+{
+  E_FP_REGNUM = 14,            /* Contains address of executing stack frame */
+  E_SP_REGNUM = 15,            /* Contains address of top of stack */
+  E_PS_REGNUM = 16,            /* Contains processor status */
+  E_PC_REGNUM = 17,            /* Contains program counter */
+  E_FP0_REGNUM = 18            /* Floating point register 0 */
+};
+
 void m68k_frame_init_saved_regs (struct frame_info *frame_info);
 
 static int
@@ -917,7 +926,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 #if 0
   tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
 #endif
-
   gdbarch = gdbarch_alloc (&info, 0);
 
   set_gdbarch_long_double_format (gdbarch, &floatformat_m68881_ext);
@@ -932,6 +941,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_stack_align (gdbarch, m68k_stack_align);
 
+
+  set_gdbarch_believe_pcc_promotion (gdbarch, 1);
   set_gdbarch_decr_pc_after_break (gdbarch, 2);
 
   set_gdbarch_store_struct_return (gdbarch, m68k_store_struct_return);
@@ -940,10 +951,16 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_store_return_value (gdbarch, m68k_store_return_value);
 
   set_gdbarch_frame_chain (gdbarch, m68k_frame_chain);
+  set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid);
   set_gdbarch_frame_saved_pc (gdbarch, m68k_frame_saved_pc);
   set_gdbarch_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs);
   set_gdbarch_frameless_function_invocation (gdbarch,
                                             m68k_frameless_function_invocation);
+  /* OK to default this value to 'unknown'. */
+  set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
+  set_gdbarch_frame_args_skip (gdbarch, 8);
+  set_gdbarch_frame_args_address (gdbarch, default_frame_address);
+  set_gdbarch_frame_locals_address (gdbarch, default_frame_address);
 
   set_gdbarch_register_raw_size (gdbarch, m68k_register_raw_size);
   set_gdbarch_register_virtual_size (gdbarch, m68k_register_virtual_size);
@@ -956,6 +973,11 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_num_regs (gdbarch, 29);
   set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
   set_gdbarch_register_bytes (gdbarch, (16 * 4 + 8 + 8 * 12 + 3 * 4));
+  set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
+  set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM);
+  set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
+  set_gdbarch_ps_regnum (gdbarch, E_PS_REGNUM);
+  set_gdbarch_fp0_regnum (gdbarch, E_FP0_REGNUM);
 
   set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
index 81340d4be021a50887cb6aa6eef900b41fb1bed0..44c8e8f1e869c15a497633120e30e8591ed33271 100644 (file)
@@ -1183,7 +1183,10 @@ monitor_fetch_register (int regno)
   zerobuf = alloca (MAX_REGISTER_RAW_SIZE);
   memset (zerobuf, 0, MAX_REGISTER_RAW_SIZE);
 
-  name = current_monitor->regnames[regno];
+  if (current_monitor->regname != NULL)
+    name = current_monitor->regname (regno);
+  else
+    name = current_monitor->regnames[regno];
   monitor_debug ("MON fetchreg %d '%s'\n", regno, name ? name : "(null name)");
 
   if (!name || (*name == '\0'))
@@ -1335,8 +1338,12 @@ monitor_store_register (int regno)
 {
   char *name;
   ULONGEST val;
-
-  name = current_monitor->regnames[regno];
+  
+  if (current_monitor->regname != NULL)
+    name = current_monitor->regname (regno);
+  else
+    name = current_monitor->regnames[regno];
+  
   if (!name || (*name == '\0'))
     {
       monitor_debug ("MON Cannot store unknown register\n");
index 85a44ff7e71fbe4200cb1d563e96276cdce312ce..5d6138c4398a9444b7fd540cd2c63a18ff551070 100644 (file)
@@ -116,6 +116,9 @@ struct monitor_ops
     struct target_ops *target; /* target operations */
     int stopbits;              /* number of stop bits */
     char **regnames;           /* array of register names in ascii */
+                                /* deprecated: use regname instead */
+    const char *(*regname) (int index); 
+                                /* function for dynamic regname array */
     int num_breakpoints;       /* If set_break != NULL, number of supported
                                   breakpoints */
     int magic;                 /* Check value */
index f8adb498b248ebbb016b03fee5bd378854bcd647..b04abc1056c4c28abed0832f7c06433aacc77fcf 100644 (file)
@@ -22,6 +22,8 @@
 #if !defined (OBJFILES_H)
 #define OBJFILES_H
 
+#include "bcache.h"
+
 /* This structure maintains information on a per-objfile basis about the
    "entry point" of the objfile, and the scope within which the entry point
    exists.  It is possible that gdb will see more than one objfile that is
index 44d86825872c0dde66fcf631d4fd3366cca17815..6fabab7c5b4ce869eddfef7c4ec37a30e2bd288d 100644 (file)
@@ -200,6 +200,8 @@ static void
 ppcnbsd_init_abi (struct gdbarch_info info,
                   struct gdbarch *gdbarch)
 {
+  /* Stop at main.  */
+  set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid);
 
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                 nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
index ba6f547573f922fec2cd56d9b6e69ff949b97380..70a75b5ed77c108301a542398b578731eff06ab7 100644 (file)
@@ -1003,7 +1003,8 @@ supply_register (int regnum, char *val)
      values. */
 
 #ifdef DEPRECATED_CLEAN_UP_REGISTER_VALUE
-  DEPRECATED_CLEAN_UP_REGISTER_VALUE (regnum, register_buffer (regnum));
+  DEPRECATED_CLEAN_UP_REGISTER_VALUE \
+    (regnum, register_buffer (current_regcache, regnum));
 #endif
 }
 
index e045a8951cda5ab51e10044bb3a9f4629c180b4b..0a1d7af60c222e6cdbc7a0f17a1dab33e44b79e8 100644 (file)
@@ -76,12 +76,24 @@ est_supply_register (char *regname, int regnamelen, char *val, int vallen)
  * registers either. So, typing "info reg sp" becomes a "r30".
  */
 
-static char *est_regnames[NUM_REGS] =
+static const char *
+est_regname (int index) 
 {
-  "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
-  "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
-  "SR", "PC",
-};
+  
+  static char *regnames[] =
+  {
+    "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
+    "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
+    "SR", "PC",
+  };
+  
+
+  if ((index >= (sizeof (regnames) /  sizeof (regnames[0]))) 
+       || (index < 0) || (index >= NUM_REGS))
+    return NULL;
+  else
+    return regnames[index];
+}
 
 /*
  * Define the monitor command strings. Since these are passed directly
@@ -143,7 +155,8 @@ init_est_cmds (void)
   est_cmds.cmd_end = NULL;     /* optional command terminator */
   est_cmds.target = &est_ops;  /* target operations */
   est_cmds.stopbits = SERIAL_1_STOPBITS;       /* number of stop bits */
-  est_cmds.regnames = est_regnames;    /* registers names */
+  est_cmds.regnames = NULL;
+  est_cmds.regname = est_regname; /*register names*/
   est_cmds.magic = MONITOR_OPS_MAGIC;  /* magic */
 }                              /* init_est_cmds */
 
index ec49f5d7177c581a6b80ed5ecb082c3ea206994b..cc0586f8ed50108e85b72d061e465dbc2229b7fe 100644 (file)
@@ -157,11 +157,24 @@ rom68k_supply_register (char *regname, int regnamelen, char *val, int vallen)
    than does GDB, and don't necessarily support all the registers
    either. So, typing "info reg sp" becomes a "r30".  */
 
-static char *rom68k_regnames[NUM_REGS] =
+static const char *
+rom68k_regname (int index) 
 {
-  "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
-  "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
-  "SR", "PC"};
+
+  static char *regnames[] =
+  {
+    "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
+    "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
+    "SR", "PC"
+  };
+  
+  if ((index >= (sizeof (regnames) / sizeof(regnames[0]))) 
+       || (index < 0) || (index >= NUM_REGS))
+    return NULL;
+  else
+    return regnames[index];
+
+}
 
 /* Define the monitor command strings. Since these are passed directly
    through to a printf style function, we may include formatting
@@ -220,7 +233,8 @@ init_rom68k_cmds (void)
   rom68k_cmds.cmd_end = ".\r";
   rom68k_cmds.target = &rom68k_ops;
   rom68k_cmds.stopbits = SERIAL_1_STOPBITS;
-  rom68k_cmds.regnames = rom68k_regnames;
+  rom68k_cmds.regnames = NULL;
+  rom68k_cmds.regname = rom68k_regname;
   rom68k_cmds.magic = MONITOR_OPS_MAGIC;
 }                              /* init_rom68k_cmds */
 
index 5a09361a53e0496b6fca86a6258202ed00b279cf..2372d25a33a06dd894ef1d297a99f1f4963d9bca 100644 (file)
@@ -46,8 +46,6 @@
 #include "solib-svr4.h"
 #include "ppc-tdep.h"
 
-#include "regcache.h"          /* For grub_around_regcache_for_registers.  */
-
 /* If the kernel has to deliver a signal, it pushes a sigcontext
    structure on the stack and then calls the signal handler, passing
    the address of the sigcontext in an argument register. Usually
@@ -1145,12 +1143,10 @@ ppc_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
    REGBUF, and copy that return value into VALBUF in virtual format. */
 
 static void
-rs6000_extract_return_value (struct type *valtype, struct regcache *regs,
-                            char *valbuf)
+rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
 {
   int offset = 0;
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-  char *regbuf = deprecated_grub_regcache_for_registers (regs);
 
   if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
     {
@@ -1948,9 +1944,8 @@ rs6000_store_return_value (struct type *type, char *valbuf)
    as a CORE_ADDR (or an expression that can be used as one).  */
 
 static CORE_ADDR
-rs6000_extract_struct_value_address (struct regcache *regs)
+rs6000_extract_struct_value_address (char *regbuf)
 {
-  /* FIXME: cagney/2002-05-11: This global variable is just a hack!  */
   return rs6000_struct_return_address;
 }
 
@@ -2611,7 +2606,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+  set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register);
   set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
   set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
index cb3b81de05ae14d42425661b98f84c1cf99f4431..b1055eddcd2a0ebf4560eb1827eb237d6ce9121a 100644 (file)
@@ -955,7 +955,7 @@ s390_frame_saved_pc_nofix (struct frame_info *fi)
   if (fi->extra_info && fi->extra_info->saved_pc_valid)
     return fi->extra_info->saved_pc;
 
-  if (generic_find_dummy_frame (fi->pc, fi->frame))
+  if (deprecated_generic_find_dummy_frame (fi->pc, fi->frame))
     return generic_read_register_dummy (fi->pc, fi->frame, S390_PC_REGNUM);
 
   s390_frame_init_saved_regs (fi);
@@ -1009,7 +1009,7 @@ s390_frame_chain (struct frame_info *thisframe)
 {
   CORE_ADDR prev_fp = 0;
 
-  if (generic_find_dummy_frame (thisframe->pc, thisframe->frame))
+  if (deprecated_generic_find_dummy_frame (thisframe->pc, thisframe->frame))
     return generic_read_register_dummy (thisframe->pc, thisframe->frame,
                                         S390_SP_REGNUM);
   else
index 2ef89faadf1dc4cf626ab45e7a8e4125f4c7dbfd..d6bedd70f00fdb152bee777ffb4f4cc00ccd2d19 100644 (file)
@@ -1046,7 +1046,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi)
   int opc;
   int insn;
   int r3_val = 0;
-  char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+  char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame);
   
   if (fi->saved_regs == NULL)
     frame_saved_regs_zalloc (fi);
@@ -1385,7 +1385,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi)
   int insn_size;
   int gdb_register_number;
   int register_number;
-  char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+  char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
   
   if (fi->saved_regs == NULL)
@@ -1586,7 +1586,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi)
   int opc;
   int insn;
   int r3_val = 0;
-  char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+  char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
   
   if (fi->saved_regs == NULL)
@@ -1814,8 +1814,8 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
            *lval = not_lval;
          if (raw_buffer)
            memcpy (raw_buffer,
-                   generic_find_dummy_frame (frame->pc, frame->frame) +
-                   REGISTER_BYTE (regnum),
+                   (deprecated_generic_find_dummy_frame (frame->pc, frame->frame)
+                    + REGISTER_BYTE (regnum)),
                    REGISTER_RAW_SIZE (regnum));
          return;
        }
index bb22d0d4eaadbd7d33a2071590eaf7a1e33739bf..bf0fb1a4ef540c0de1433b7055e358c5f99a8037 100644 (file)
@@ -28,7 +28,6 @@
 #include "obstack.h"
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free xfree
-#include "bcache.h"
 
 /* Don't do this; it means that if some .o's are compiled with GNU C
    and some are not (easy to do accidentally the way we configure
index a723a6d0306fc02cad3306aeadc57984eae44127..46dce5a6cd4c38b07bddcc9093581a88c9dfd592 100644 (file)
@@ -186,7 +186,7 @@ vax_frame_init_saved_regs (struct frame_info *frame)
 
   /* regmask's low bit is for register 0, which is the first one
      what would be pushed.  */
-  for (regnum = 0; regnum < AP_REGNUM; regnum++)
+  for (regnum = 0; regnum < VAX_AP_REGNUM; regnum++)
     {
       if (regmask & (1 << regnum))
         frame->saved_regs[regnum] = next_addr += 4;
@@ -199,7 +199,7 @@ vax_frame_init_saved_regs (struct frame_info *frame)
 
   frame->saved_regs[PC_REGNUM] = frame->frame + 16;
   frame->saved_regs[FP_REGNUM] = frame->frame + 12;
-  frame->saved_regs[AP_REGNUM] = frame->frame + 8;
+  frame->saved_regs[VAX_AP_REGNUM] = frame->frame + 8;
   frame->saved_regs[PS_REGNUM] = frame->frame + 4;
 }
 
@@ -239,7 +239,7 @@ vax_frame_args_address (struct frame_info *frame)
   if (frame->next)
     return (read_memory_integer (frame->next->frame + 8, 4));
 
-  return (read_register (AP_REGNUM));
+  return (read_register (VAX_AP_REGNUM));
 }
 
 static CORE_ADDR
@@ -276,12 +276,12 @@ vax_push_dummy_frame (void)
     sp = push_word (sp, read_register (regnum));
   sp = push_word (sp, read_register (PC_REGNUM));
   sp = push_word (sp, read_register (FP_REGNUM));
-  sp = push_word (sp, read_register (AP_REGNUM));
+  sp = push_word (sp, read_register (VAX_AP_REGNUM));
   sp = push_word (sp, (read_register (PS_REGNUM) & 0xffef) + 0x2fff0000);
   sp = push_word (sp, 0);
   write_register (SP_REGNUM, sp);
   write_register (FP_REGNUM, sp);
-  write_register (AP_REGNUM, sp + (17 * 4));
+  write_register (VAX_AP_REGNUM, sp + (17 * 4));
 }
 
 static void
@@ -296,7 +296,7 @@ vax_pop_frame (void)
                  | (read_register (PS_REGNUM) & 0xffff0000));
   write_register (PC_REGNUM, read_memory_integer (fp + 16, 4));
   write_register (FP_REGNUM, read_memory_integer (fp + 12, 4));
-  write_register (AP_REGNUM, read_memory_integer (fp + 8, 4));
+  write_register (VAX_AP_REGNUM, read_memory_integer (fp + 8, 4));
   fp += 16;
   for (regnum = 0; regnum < 12; regnum++)
     if (regmask & (0x10000 << regnum))
@@ -353,6 +353,15 @@ vax_extract_struct_value_address (char *regbuf)
   return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
 }
 \f
+static const unsigned char *
+vax_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
+{
+  static const unsigned char vax_breakpoint[] = { 3 };
+
+  *lenptr = sizeof(vax_breakpoint);
+  return (vax_breakpoint);
+}
+\f
 /* Advance PC across any function entry prologue instructions
    to reach some "real" code.  */
 
@@ -620,13 +629,30 @@ print_insn_arg (char *d, register char *p, CORE_ADDR addr,
 static struct gdbarch *
 vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
+  struct gdbarch_tdep *tdep;
   struct gdbarch *gdbarch;
+  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
+
+  /* Try to determine the ABI of the object we are loading.  */
+
+  if (info.abfd != NULL)
+    osabi = gdbarch_lookup_osabi (info.abfd);
+
+  /* Find a candidate among extant architectures.  */
+  for (arches = gdbarch_list_lookup_by_info (arches, &info);
+       arches != NULL;
+       arches = gdbarch_list_lookup_by_info (arches->next, &info))
+    {
+      /* Make sure the ABI selection matches.  */
+      tdep = gdbarch_tdep (arches->gdbarch);
+      if (tdep && tdep->osabi == osabi)
+       return arches->gdbarch;
+    }
 
-  /* Right now there is only one VAX architecture variant.  */
-  if (arches != NULL)
-    return (arches->gdbarch);
+  tdep = xmalloc (sizeof (struct gdbarch_tdep));
+  gdbarch = gdbarch_alloc (&info, tdep);
 
-  gdbarch = gdbarch_alloc (&info, NULL);
+  tdep->osabi = osabi;
 
   /* Register info */
   set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS);
@@ -691,18 +717,35 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
 
   /* Breakpoint info */
+  set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc);
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
 
   /* Misc info */
   set_gdbarch_function_start_offset (gdbarch, 2);
+  set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+
+  /* Hook in ABI-specific overrides, if they have been registered.  */
+  gdbarch_init_osabi (info, gdbarch, osabi);
 
   return (gdbarch);
 }
 
+static void
+vax_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+  if (tdep == NULL)
+    return;
+
+  fprintf_unfiltered (file, "vax_dump_tdep: OS ABI = %s\n",
+                     gdbarch_osabi_name (tdep->osabi));
+}
+
 void
 _initialize_vax_tdep (void)
 {
-  gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL);
+  gdbarch_register (bfd_arch_vax, vax_gdbarch_init, vax_dump_tdep);
 
   tm_print_insn = vax_print_insn;
 }
index 95324bcc036d2b2953e9e494402e74b93da8dce7..ccabdd53557697fcb10af835381bebc65b2ee100 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef VAX_TDEP_H
 #define VAX_TDEP_H
 
+#include "osabi.h"
+
 /* Say how long (ordinary) registers are.  This is a piece of bogosity
    used in push_word and a few other places;  REGISTER_RAW_SIZE is the
    real way to know how big a register is.  */
 #define VAX_PC_REGNUM     15  /* Contains program counter */
 #define VAX_PS_REGNUM     16  /* Contains processor status */
 
+/* Target-dependent structure in gdbarch.  */ 
+struct gdbarch_tdep
+{  
+  enum gdb_osabi osabi;                /* OS/ABI of inferior.  */
+};
+
 #endif /* VAX_TDEP_H */
index d1495fb303ccdce7a650447083b8b2092b5283f6..b6055426719c6afa2d35be50aaf181c803ad0294 100644 (file)
@@ -1 +1 @@
-2002-06-25-cvs
+2002-06-28-cvs