2005-02-02 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / printcmd.c
index c167cc46bc09f88ab3ca5aea43b5270ee0329c24..fb13ecb8c959a4ff3c6a7e974796db1abe2427d3 100644 (file)
@@ -70,10 +70,6 @@ static char last_size = 'w';
 
 static CORE_ADDR next_address;
 
-/* Default section to examine next. */
-
-static asection *next_section;
-
 /* Last address examined.  */
 
 static CORE_ADDR last_examine_address;
@@ -170,9 +166,6 @@ static void print_command_1 (char *, int, int);
 
 static void validate_format (struct format_data, char *);
 
-static void do_examine (struct format_data, CORE_ADDR addr,
-                       asection * section);
-
 static void print_formatted (struct value *, int, int, struct ui_file *);
 
 static struct format_data decode_format (char **, int, int);
@@ -282,13 +275,12 @@ static void
 print_formatted (struct value *val, int format, int size,
                 struct ui_file *stream)
 {
-  struct type *type = check_typedef (VALUE_TYPE (val));
+  struct type *type = check_typedef (value_type (val));
   int len = TYPE_LENGTH (type);
 
   if (VALUE_LVAL (val) == lval_memory)
     {
       next_address = VALUE_ADDRESS (val) + len;
-      next_section = VALUE_BFD_SECTION (val);
     }
 
   switch (format)
@@ -297,7 +289,6 @@ print_formatted (struct value *val, int format, int size,
       /* FIXME: Need to handle wchar_t's here... */
       next_address = VALUE_ADDRESS (val)
        + val_print_string (VALUE_ADDRESS (val), -1, 1, stream);
-      next_section = VALUE_BFD_SECTION (val);
       break;
 
     case 'i':
@@ -311,7 +302,6 @@ print_formatted (struct value *val, int format, int size,
       wrap_here ("    ");
       next_address = VALUE_ADDRESS (val)
        + gdb_print_insn (VALUE_ADDRESS (val), stream);
-      next_section = VALUE_BFD_SECTION (val);
       break;
 
     default:
@@ -344,8 +334,8 @@ print_formatted (struct value *val, int format, int size,
    with a format.  */
 
 void
-print_scalar_formatted (void *valaddr, struct type *type, int format, int size,
-                       struct ui_file *stream)
+print_scalar_formatted (const void *valaddr, struct type *type,
+                       int format, int size, struct ui_file *stream)
 {
   LONGEST val_long = 0;
   unsigned int len = TYPE_LENGTH (type);
@@ -499,9 +489,7 @@ print_scalar_formatted (void *valaddr, struct type *type, int format, int size,
            if (*cp == '\0')
              cp--;
          }
-       strcpy (buf, local_binary_format_prefix ());
-       strcat (buf, cp);
-       strcat (buf, local_binary_format_suffix ());
+       strcpy (buf, cp);
        fputs_filtered (buf, stream);
       }
       break;
@@ -765,7 +753,7 @@ static struct type *examine_g_type;
    Fetch it from memory and print on gdb_stdout.  */
 
 static void
-do_examine (struct format_data fmt, CORE_ADDR addr, asection *sect)
+do_examine (struct format_data fmt, CORE_ADDR addr)
 {
   char format = 0;
   char size;
@@ -778,7 +766,6 @@ do_examine (struct format_data fmt, CORE_ADDR addr, asection *sect)
   size = fmt.size;
   count = fmt.count;
   next_address = addr;
-  next_section = sect;
 
   /* String or instruction format implies fetch single bytes
      regardless of the specified size.  */
@@ -833,7 +820,7 @@ do_examine (struct format_data fmt, CORE_ADDR addr, asection *sect)
             the disassembler be modified so that LAST_EXAMINE_VALUE
             is left with the byte sequence from the last complete
             instruction fetched from memory? */
-         last_examine_value = value_at_lazy (val_type, next_address, sect);
+         last_examine_value = value_at_lazy (val_type, next_address);
 
          if (last_examine_value)
            release_value (last_examine_value);
@@ -901,15 +888,15 @@ print_command_1 (char *exp, int inspect, int voidprint)
   else
     val = access_value_history (0);
 
-  if (voidprint || (val && VALUE_TYPE (val) &&
-                   TYPE_CODE (VALUE_TYPE (val)) != TYPE_CODE_VOID))
+  if (voidprint || (val && value_type (val) &&
+                   TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
     {
       int histindex = record_latest_value (val);
 
       if (histindex >= 0)
-       annotate_value_history_begin (histindex, VALUE_TYPE (val));
+       annotate_value_history_begin (histindex, value_type (val));
       else
-       annotate_value_begin (VALUE_TYPE (val));
+       annotate_value_begin (value_type (val));
 
       if (inspect)
        printf_unfiltered ("\031(gdb-makebuffer \"%s\"  %d '(\"", exp, histindex);
@@ -980,7 +967,7 @@ output_command (char *exp, int from_tty)
 
   val = evaluate_expression (expr);
 
-  annotate_value_begin (VALUE_TYPE (val));
+  annotate_value_begin (value_type (val));
 
   print_formatted (val, format, fmt.size, gdb_stdout);
 
@@ -1296,22 +1283,20 @@ x_command (char *exp, int from_tty)
        *exp = 0;
       old_chain = make_cleanup (free_current_contents, &expr);
       val = evaluate_expression (expr);
-      if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
+      if (TYPE_CODE (value_type (val)) == TYPE_CODE_REF)
        val = value_ind (val);
       /* In rvalue contexts, such as this, functions are coerced into
          pointers to functions.  This makes "x/i main" work.  */
       if (/* last_format == 'i'  && */ 
-         TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC
+         TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
           && VALUE_LVAL (val) == lval_memory)
        next_address = VALUE_ADDRESS (val);
       else
        next_address = value_as_address (val);
-      if (VALUE_BFD_SECTION (val))
-       next_section = VALUE_BFD_SECTION (val);
       do_cleanups (old_chain);
     }
 
-  do_examine (fmt, next_address, next_section);
+  do_examine (fmt, next_address);
 
   /* If the examine succeeds, we remember its size and format for next time.  */
   last_size = fmt.size;
@@ -1323,7 +1308,7 @@ x_command (char *exp, int from_tty)
       /* Make last address examined available to the user as $_.  Use
          the correct pointer type.  */
       struct type *pointer_type
-       = lookup_pointer_type (VALUE_TYPE (last_examine_value));
+       = lookup_pointer_type (value_type (last_examine_value));
       set_internalvar (lookup_internalvar ("_"),
                       value_from_pointer (pointer_type,
                                           last_examine_address));
@@ -1551,7 +1536,7 @@ do_one_display (struct display *d)
 
       annotate_display_value ();
 
-      do_examine (d->format, addr, VALUE_BFD_SECTION (val));
+      do_examine (d->format, addr);
     }
   else
     {
@@ -1917,11 +1902,11 @@ printf_command (char *arg, int from_tty)
 
        if (argclass[nargs] == double_arg)
          {
-           struct type *type = VALUE_TYPE (val_args[nargs]);
+           struct type *type = value_type (val_args[nargs]);
            if (TYPE_LENGTH (type) == sizeof (float))
-               VALUE_TYPE (val_args[nargs]) = builtin_type_float;
+             val_args[nargs]->type = builtin_type_float;
            if (TYPE_LENGTH (type) == sizeof (double))
-               VALUE_TYPE (val_args[nargs]) = builtin_type_double;
+             val_args[nargs]->type = builtin_type_double;
          }
        nargs++;
        s = s1;
This page took 0.028504 seconds and 4 git commands to generate.