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]

[RFA]infcmd.c: add checks to 'info float'&'info vector'


'info registers' double checks that asking for registers from the
inferior is a meaningful operation at the time at which it is invoked.
I added similar checks for 'info float' and 'info vector'.


With this, I can get rid of more duplicate code in rs6000-tdep.c, used
to print the altivec registers.

Elena
2002-08-18  Elena Zannoni  <ezannoni@redhat.com>

	* infcmd.c (print_vector_info): Check that printing registers
	makes sense.
	(print_float_info): Ditto.

Index: infcmd.c
===================================================================
RCS file: /cvs/uberbaum/gdb/infcmd.c,v
retrieving revision 1.52
diff -u -p -r1.52 infcmd.c
--- infcmd.c    16 Aug 2002 00:27:45 -0000      1.52
+++ infcmd.c    19 Aug 2002 03:29:26 -0000
@@ -1721,6 +1725,12 @@ 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 (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (regnum)))
@@ -1899,6 +1909,12 @@ 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++)
        {
          if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)


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