2002-08-14 Michael Snyder <msnyder@redhat.com>
[deliverable/binutils-gdb.git] / gdb / infcmd.c
index d5e18eccafd6ef89687014e7d55b370471ae1919..95ee3e6195de000f264bf851ba942074e8c09ee3 100644 (file)
@@ -40,6 +40,7 @@
 #include "ui-out.h"
 #include "event-top.h"
 #include "parser-defs.h"
+#include "regcache.h"
 
 /* Functions exported for general use: */
 
@@ -248,7 +249,7 @@ notice_args_set (char *args, int from_tty, struct cmd_list_element *c)
 
 /* Notice when `show args' is run.  */
 static void
-notice_args_read (struct cmd_list_element *c)
+notice_args_read (char *args, int from_tty, struct cmd_list_element *c)
 {
   /* Might compute the value.  */
   get_inferior_args ();
@@ -969,7 +970,7 @@ breakpoint_auto_delete_contents (PTR arg)
    will eventually be popped when we do hit the dummy end breakpoint).  */
 
 int
-run_stack_dummy (CORE_ADDR addr, char *buffer)
+run_stack_dummy (CORE_ADDR addr, struct regcache *buffer)
 {
   struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
   int saved_async = 0;
@@ -1042,8 +1043,7 @@ run_stack_dummy (CORE_ADDR addr, char *buffer)
     return 2;
 
   /* On normal return, the stack dummy has been popped already.  */
-
-  memcpy (buffer, stop_registers, REGISTER_BYTES);
+  regcache_cpy_no_passthrough (buffer, stop_registers);
   return 0;
 }
 \f
@@ -1289,7 +1289,8 @@ finish_command (char *arg, int from_tty)
   if (from_tty)
     {
       printf_filtered ("Run till exit from ");
-      print_stack_frame (selected_frame, selected_frame_level, 0);
+      print_stack_frame (selected_frame,
+                        frame_relative_level (selected_frame), 0);
     }
 
   /* If running asynchronously and the target support asynchronous
@@ -1548,9 +1549,9 @@ path_command (char *dirname, int from_tty)
 #ifdef REGISTER_NAMES
 char *gdb_register_names[] = REGISTER_NAMES;
 #endif
-/* Print out the machine register regnum. If regnum is -1,
-   print all registers (fpregs == 1) or all non-float registers
-   (fpregs == 0).
+/* Print out the machine register regnum. If regnum is -1, print all
+   registers (all == 1) or all non-float and non-vector registers (all
+   == 0).
 
    For most machines, having all_registers_info() print the
    register(s) one per line is good enough. If a different format
@@ -1560,7 +1561,7 @@ char *gdb_register_names[] = REGISTER_NAMES;
    to provide that format.  */
 
 void
-do_registers_info (int regnum, int fpregs)
+do_registers_info (int regnum, int print_all)
 {
   register int i;
   int numregs = NUM_REGS + NUM_PSEUDO_REGS;
@@ -1569,11 +1570,17 @@ do_registers_info (int regnum, int fpregs)
 
   for (i = 0; i < numregs; i++)
     {
-      /* Decide between printing all regs, nonfloat regs, or specific reg.  */
+      /* Decide between printing all regs, non-float / vector regs, or
+         specific reg.  */
       if (regnum == -1)
        {
-         if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT && !fpregs)
-           continue;
+         if (!print_all)
+           {
+             if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+               continue;
+             if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)))
+               continue;
+           }
        }
       else
        {
@@ -1590,7 +1597,7 @@ do_registers_info (int regnum, int fpregs)
       print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
 
       /* Get the data in raw format.  */
-      if (read_relative_register_raw_bytes (i, raw_buffer))
+      if (! frame_register_read (selected_frame, i, raw_buffer))
        {
          printf_filtered ("*value not available*\n");
          continue;
@@ -1680,7 +1687,7 @@ registers_info (char *addr_exp, int fpregs)
       if (*addr_exp >= '0' && *addr_exp <= '9')
        regnum = atoi (addr_exp);       /* Take a number */
       if (regnum >= numregs)   /* Bad name, or bad number */
-       error ("%.*s: invalid register", end - addr_exp, addr_exp);
+       error ("%.*s: invalid register", (int) (end - addr_exp), addr_exp);
 
     found:
       DO_REGISTERS_INFO (regnum, fpregs);
@@ -1703,6 +1710,39 @@ nofp_registers_info (char *addr_exp, int from_tty)
 {
   registers_info (addr_exp, 0);
 }
+
+static void
+print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
+                  struct frame_info *frame, const char *args)
+{
+  if (gdbarch_print_vector_info_p (gdbarch))
+    gdbarch_print_vector_info (gdbarch, file, frame, args);
+  else
+    {
+      int regnum;
+      int printed_something = 0;
+      for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
+       {
+         if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (regnum)))
+           {
+             printed_something = 1;
+#if 0
+             gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
+#else
+             do_registers_info (regnum, 1);
+#endif
+           }
+       }
+      if (!printed_something)
+       fprintf_filtered (file, "No vector information\n");
+    }
+}
+
+static void
+vector_info (char *args, int from_tty)
+{
+  print_vector_info (current_gdbarch, gdb_stdout, selected_frame, args);
+}
 \f
 
 /*
@@ -1844,13 +1884,44 @@ interrupt_target_command (char *args, int from_tty)
 
 /* ARGSUSED */
 static void
-float_info (char *addr_exp, int from_tty)
+print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
+                 struct frame_info *frame, const char *args)
 {
+  if (gdbarch_print_float_info_p (gdbarch))
+    gdbarch_print_float_info (gdbarch, file, frame, args);
+  else
+    {
 #ifdef FLOAT_INFO
-  FLOAT_INFO;
+#if GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL
+#error "FLOAT_INFO defined in multi-arch"
+#endif
+      FLOAT_INFO;
+#else
+      int regnum;
+      int printed_something = 0;
+      for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
+       {
+         if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+           {
+             printed_something = 1;
+#if 0
+             gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
 #else
-  printf_filtered ("No floating point info available for this processor.\n");
+             do_registers_info (regnum, 1);
 #endif
+           }
+       }
+      if (!printed_something)
+       fprintf_filtered (file, "\
+No floating-point info available for this processor.\n");
+#endif
+    }
+}
+
+static void
+float_info (char *args, int from_tty)
+{
+  print_float_info (current_gdbarch, gdb_stdout, selected_frame, args);
 }
 \f
 /* ARGSUSED */
@@ -1869,17 +1940,17 @@ _initialize_infcmd (void)
 
   c = add_com ("tty", class_run, tty_command,
               "Set terminal for future runs of program being debugged.");
-  c->completer = filename_completer;
+  set_cmd_completer (c, filename_completer);
 
   c = add_set_cmd ("args", class_run, var_string_noescape,
                   (char *) &inferior_args,
                   "Set argument list to give program being debugged when it is started.\n\
 Follow this command with any number of args, to be passed to the program.",
                   &setlist);
-  c->completer = filename_completer;
-  c->function.sfunc = notice_args_set;
+  set_cmd_completer (c, filename_completer);
+  set_cmd_sfunc (c, notice_args_set);
   c = add_show_from_set (c, &showlist);
-  c->pre_show_hook = notice_args_read;
+  set_cmd_sfunc (c, notice_args_read);
 
   c = add_cmd
     ("environment", no_class, environment_info,
@@ -1887,17 +1958,17 @@ Follow this command with any number of args, to be passed to the program.",
 With an argument VAR, prints the value of environment variable VAR to\n\
 give the program being debugged.  With no arguments, prints the entire\n\
 environment to be given to the program.", &showlist);
-  c->completer = noop_completer;
+  set_cmd_completer (c, noop_completer);
 
   add_prefix_cmd ("unset", no_class, unset_command,
-                 "Complement to certain \"set\" commands",
+                 "Complement to certain \"set\" commands.",
                  &unsetlist, "unset ", 0, &cmdlist);
 
   c = add_cmd ("environment", class_run, unset_environment_command,
               "Cancel environment variable VAR for the program.\n\
 This does not affect the program until the next \"run\" command.",
               &unsetlist);
-  c->completer = noop_completer;
+  set_cmd_completer (c, noop_completer);
 
   c = add_cmd ("environment", class_run, set_environment_command,
               "Set environment variable value to give the program.\n\
@@ -1905,7 +1976,7 @@ Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
 VALUES of environment variables are uninterpreted strings.\n\
 This does not affect the program until the next \"run\" command.",
               &setlist);
-  c->completer = noop_completer;
+  set_cmd_completer (c, noop_completer);
 
   c = add_com ("path", class_files, path_command,
               "Add directory DIR(s) to beginning of search path for object files.\n\
@@ -1913,7 +1984,7 @@ $cwd in the path means the current working directory.\n\
 This path is equivalent to the $PATH shell variable.  It is a list of\n\
 directories, separated by colons.  These directories are searched to find\n\
 fully linked executable files and separately compiled object files as needed.");
-  c->completer = filename_completer;
+  set_cmd_completer (c, filename_completer);
 
   c = add_cmd ("paths", no_class, path_info,
               "Current search path for finding object files.\n\
@@ -1922,7 +1993,7 @@ This path is equivalent to the $PATH shell variable.  It is a list of\n\
 directories, separated by colons.  These directories are searched to find\n\
 fully linked executable files and separately compiled object files as needed.",
               &showlist);
-  c->completer = noop_completer;
+  set_cmd_completer (c, noop_completer);
 
   add_com ("attach", class_run, attach_command,
           "Attach to a process or file outside of GDB.\n\
@@ -1978,14 +2049,14 @@ Argument N means do this N times (or till program stops for another reason).");
               "Execute until the program reaches a source line greater than the current\n\
 or a specified line or address or function (same args as break command).\n\
 Execution will also stop upon exit from the current stack frame.");
-  c->completer = location_completer;
+  set_cmd_completer (c, location_completer);
   add_com_alias ("u", "until", class_run, 1);
 
   c = add_com ("jump", class_run, jump_command,
               "Continue program being debugged at specified line or address.\n\
 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
 for an address to start at.");
-  c->completer = location_completer;
+  set_cmd_completer (c, location_completer);
 
   if (xdb_commands)
     {
@@ -1996,7 +2067,7 @@ address.\n\
 Give as argument either LINENUM or *ADDR, where ADDR is an \n\
 expression for an address to start at.\n\
 This command is a combination of tbreak and jump.");
-      c->completer = location_completer;
+      set_cmd_completer (c, location_completer);
     }
 
   if (xdb_commands)
@@ -2017,7 +2088,7 @@ Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
 With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
 To cancel previous arguments and run with no arguments,\n\
 use \"set args\" without arguments.");
-  c->completer = filename_completer;
+  set_cmd_completer (c, filename_completer);
   add_com_alias ("r", "run", class_run, 1);
   if (xdb_commands)
     add_com ("R", class_run, run_no_args_command,
@@ -2045,6 +2116,9 @@ Register name as argument means describe only that register.");
   add_info ("float", float_info,
            "Print the status of the floating point unit\n");
 
+  add_info ("vector", vector_info,
+           "Print the status of the vector unit\n");
+
   inferior_environ = make_environ ();
   init_environ (inferior_environ);
 }
This page took 0.027659 seconds and 4 git commands to generate.