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] Make "info float|vector" error out when there are no registers


No one objected to doing this, so I checked this in.  I will submit a
patch for the testsuite shortly.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* infcmd.c (print_vector_info, print_float_info): Move code that
	checks whether the target has any registers and whether there is a
	selected frame up, such that it is also used if a target provides
	multi-arch definitions of these functions.

Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.61
diff -u -p -r1.61 infcmd.c
--- infcmd.c 7 Nov 2002 01:55:16 -0000 1.61
+++ infcmd.c 9 Nov 2002 12:43:16 -0000
@@ -1791,6 +1791,11 @@ static void
 print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
 		   struct frame_info *frame, const char *args)
 {
+  if (!target_has_registers)
+    error ("The program has no registers now.");
+  if (selected_frame == NULL)
+    error ("No selected frame.");
+
   if (gdbarch_print_vector_info_p (gdbarch))
     gdbarch_print_vector_info (gdbarch, file, frame, args);
   else
@@ -1798,11 +1803,6 @@ print_vector_info (struct gdbarch *gdbar
       int regnum;
       int printed_something = 0;
 
-      if (!target_has_registers)
-	error ("The program has no registers now.");
-      if (selected_frame == NULL)
-	error ("No selected frame.");
-
       for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
 	{
 	  if (gdbarch_register_reggroup_p (gdbarch, regnum, vector_reggroup))
@@ -1958,6 +1958,11 @@ static void
 print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
 		  struct frame_info *frame, const char *args)
 {
+  if (!target_has_registers)
+    error ("The program has no registers now.");
+  if (selected_frame == NULL)
+    error ("No selected frame.");
+
   if (gdbarch_print_float_info_p (gdbarch))
     gdbarch_print_float_info (gdbarch, file, frame, args);
   else
@@ -1970,11 +1975,6 @@ print_float_info (struct gdbarch *gdbarc
 #else
       int regnum;
       int printed_something = 0;
-
-      if (!target_has_registers)
-	error ("The program has no registers now.");
-      if (selected_frame == NULL)
-	error ("No selected frame.");
 
       for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
 	{


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