* mipsnbsd-tdep.c (mipsnbsd_ilp32_fetch_link_map_offsets): Don't
[deliverable/binutils-gdb.git] / gdb / valprint.c
index 4f834f2cf183dda1f4e890bc74066a9529d2c001..ff6f5d673e365a7a9cc02331bb07e64d1705c24c 100644 (file)
@@ -1,7 +1,7 @@
 /* Print values for GDB, the GNU debugger.
 
-   Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -207,13 +207,12 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
           int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   volatile struct gdb_exception except;
+  volatile enum val_prettyprint real_pretty = pretty;
   int ret = 0;
 
   struct type *real_type = check_typedef (type);
   if (pretty == Val_pretty_default)
-    {
-      pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
-    }
+    real_pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
 
   QUIT;
 
@@ -231,7 +230,7 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
       ret = LA_VAL_PRINT (type, valaddr, embedded_offset, address,
-                         stream, format, deref_ref, recurse, pretty);
+                         stream, format, deref_ref, recurse, real_pretty);
     }
   if (except.reason < 0)
     fprintf_filtered (stream, _("<error reading variable>"));
@@ -347,8 +346,8 @@ val_print_type_code_flags (struct type *type, const gdb_byte *valaddr,
   fputs_filtered ("[ ", stream);
   for (bitpos = 0; bitpos < nfields; bitpos++)
     {
-      if (TYPE_FIELD_BITPOS (type, bitpos) != -1 &&
-         (val & ((ULONGEST)1 << bitpos)))
+      if (TYPE_FIELD_BITPOS (type, bitpos) != -1
+         && (val & ((ULONGEST)1 << bitpos)))
        {
          if (TYPE_FIELD_NAME (type, bitpos))
            fprintf_filtered (stream, "%s ", TYPE_FIELD_NAME (type, bitpos));
@@ -443,19 +442,31 @@ print_floating (const gdb_byte *valaddr, struct type *type,
   int inv;
   const struct floatformat *fmt = NULL;
   unsigned len = TYPE_LENGTH (type);
+  enum float_kind kind;
 
   /* If it is a floating-point, check for obvious problems.  */
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     fmt = floatformat_from_type (type);
-  if (fmt != NULL && floatformat_is_nan (fmt, valaddr))
+  if (fmt != NULL)
     {
-      if (floatformat_is_negative (fmt, valaddr))
-       fprintf_filtered (stream, "-");
-      fprintf_filtered (stream, "nan(");
-      fputs_filtered ("0x", stream);
-      fputs_filtered (floatformat_mantissa (fmt, valaddr), stream);
-      fprintf_filtered (stream, ")");
-      return;
+      kind = floatformat_classify (fmt, valaddr);
+      if (kind == float_nan)
+       {
+         if (floatformat_is_negative (fmt, valaddr))
+           fprintf_filtered (stream, "-");
+         fprintf_filtered (stream, "nan(");
+         fputs_filtered ("0x", stream);
+         fputs_filtered (floatformat_mantissa (fmt, valaddr), stream);
+         fprintf_filtered (stream, ")");
+         return;
+       }
+      else if (kind == float_infinite)
+       {
+         if (floatformat_is_negative (fmt, valaddr))
+           fputs_filtered ("-", stream);
+         fputs_filtered ("inf", stream);
+         return;
+       }
     }
 
   /* NOTE: cagney/2002-01-15: The TYPE passed into print_floating()
This page took 0.026743 seconds and 4 git commands to generate.