Add macros to handle NOP insertion.
[deliverable/binutils-gdb.git] / gdb / c-valprint.c
index f4abf7fe848b8d1f6b39a21d0b6bbc9bd3e98da1..ee620dca856d238091dfcf7cb7c36088149f843f 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing C values for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995
+   Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997
              Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -152,6 +152,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
        {
          addr = unpack_pointer (type, valaddr);
        print_unpacked_pointer:
+          elttype = check_typedef (TYPE_TARGET_TYPE (type));
 
          if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
            {
@@ -210,7 +211,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
                    {
                      wtype = TYPE_TARGET_TYPE(type);
                    }
-                 vt_val = value_at (wtype, vt_address);
+                 vt_val = value_at (wtype, vt_address, NULL);
                  val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val),
                             VALUE_ADDRESS (vt_val), stream, format,
                             deref_ref, recurse + 1, pretty);
@@ -260,7 +261,8 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
                value_at
                  (TYPE_TARGET_TYPE (type),
                   unpack_pointer (lookup_pointer_type (builtin_type_void),
-                                  valaddr));
+                                  valaddr),
+                  NULL);
              val_print (VALUE_TYPE (deref_val),
                         VALUE_CONTENTS (deref_val),
                         VALUE_ADDRESS (deref_val), stream, format,
@@ -284,9 +286,10 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
           /* Print the unmangled name if desired.  */
          /* Print vtable entry - we only get here if NOT using
             -fvtable_thunks.  (Otherwise, look under TYPE_CODE_PTR.) */
-         print_address_demangle(*((int *) (valaddr +   /* FIXME bytesex */
-             TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8)),
-             stream, demangle);
+          print_address_demangle (extract_address (
+               valaddr + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+               TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
+              stream, demangle);
        }
       else
        cp_print_value_fields (type, valaddr, address, stream, format,
@@ -335,8 +338,20 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
       break;
 
     case TYPE_CODE_BOOL:
-      /* Do something at least vaguely reasonable, for example if the
-        language is set wrong.  */
+      format = format ? format : output_format;
+      if (format)
+       print_scalar_formatted (valaddr, type, format, 0, stream);
+      else
+       {
+         val = unpack_long (type, valaddr);
+         if (val == 0)
+           fputs_filtered ("false", stream);
+         else if (val == 1)
+           fputs_filtered ("true", stream);
+         else
+           print_longest (stream, 'd', 0, val);
+       }
+      break;
 
     case TYPE_CODE_RANGE:
       /* FIXME: create_range_type does not set the unsigned bit in a
@@ -452,6 +467,7 @@ c_value_print (val, stream, format, pretty)
          fprintf_filtered (stream, ") ");
        }
     }
-  return (val_print (type, VALUE_CONTENTS (val),
-                    VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
+  return val_print (type, VALUE_CONTENTS (val),
+                   VALUE_ADDRESS (val) + VALUE_OFFSET (val),
+                   stream, format, 1, 0, pretty);
 }
This page took 0.024418 seconds and 4 git commands to generate.