2002-05-10 Elena Zannoni <ezannoni@redhat.com>
[deliverable/binutils-gdb.git] / gdb / printcmd.c
index bb02d8d42eeb1b2b537d452ce564de4135c58760..b74f558794463f9100c715a84f462995b5a1d2ce 100644 (file)
@@ -1,7 +1,8 @@
 /* Print values for GNU debugger GDB.
 
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -38,9 +39,7 @@
 #include "symfile.h"           /* for overlay functions */
 #include "objfiles.h"          /* ditto */
 #include "completer.h"         /* for completion functions */
-#ifdef UI_OUT
 #include "ui-out.h"
-#endif
 
 extern int asm_demangle;       /* Whether to demangle syms in asm printouts */
 extern int addressprint;       /* Whether to print hex addresses in HLL " */
@@ -1114,7 +1113,7 @@ address_info (char *exp, int from_tty)
   if (exp == 0)
     error ("Argument required.");
 
-  sym = lookup_symbol (exp, get_selected_block (), VAR_NAMESPACE,
+  sym = lookup_symbol (exp, get_selected_block (0), VAR_NAMESPACE,
                       &is_a_field_of_this, (struct symtab **) NULL);
   if (sym == NULL)
     {
@@ -1550,7 +1549,7 @@ do_one_display (struct display *d)
     return;
 
   if (d->block)
-    within_current_scope = contained_in (get_selected_block (), d->block);
+    within_current_scope = contained_in (get_selected_block (0), d->block);
   else
     within_current_scope = 1;
   if (!within_current_scope)
@@ -1684,7 +1683,7 @@ Num Enb Expression\n");
       else if (d->format.format)
        printf_filtered ("/%c ", d->format.format);
       print_expression (d->exp, gdb_stdout);
-      if (d->block && !contained_in (get_selected_block (), d->block))
+      if (d->block && !contained_in (get_selected_block (0), d->block))
        printf_filtered (" (cannot be evaluated in the current context)");
       printf_filtered ("\n");
       gdb_flush (gdb_stdout);
@@ -1796,13 +1795,11 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
   int arg_size;
   /* Number of ints of arguments that we have printed so far.  */
   int args_printed = 0;
-#ifdef UI_OUT
   struct cleanup *old_chain, *list_chain;
   struct ui_stream *stb;
 
   stb = ui_out_stream_new (uiout);
   old_chain = make_cleanup_ui_out_stream_delete (stb);
-#endif /* UI_OUT */
 
   if (func)
     {
@@ -1903,7 +1900,6 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
                sym = nsym;
            }
 
-#ifdef UI_OUT
          /* Print the current arg.  */
          if (!first)
            ui_out_text (uiout, ", ");
@@ -1917,19 +1913,6 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
          ui_out_field_stream (uiout, "name", stb);
          annotate_arg_name_end ();
          ui_out_text (uiout, "=");
-#else
-         /* Print the current arg.  */
-         if (!first)
-           fprintf_filtered (stream, ", ");
-         wrap_here ("    ");
-
-         annotate_arg_begin ();
-
-         fprintf_symbol_filtered (stream, SYMBOL_SOURCE_NAME (sym),
-                                  SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI);
-         annotate_arg_name_end ();
-         fputs_filtered ("=", stream);
-#endif
 
          /* Avoid value_print because it will deref ref parameters.  We just
             want to print their addresses.  Print ??? for args whose address
@@ -1942,7 +1925,6 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
 
          if (val)
            {
-#ifdef UI_OUT
              val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0,
                         VALUE_ADDRESS (val),
                         stb->stream, 0, 0, 2, Val_no_prettyprint);
@@ -1953,14 +1935,6 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
 
          /* Invoke ui_out_tuple_end.  */
          do_cleanups (list_chain);
-#else
-             val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0,
-                        VALUE_ADDRESS (val),
-                        stream, 0, 0, 2, Val_no_prettyprint);
-           }
-         else
-           fputs_filtered ("???", stream);
-#endif
 
          annotate_arg_end ();
 
@@ -1982,9 +1956,7 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
       print_frame_nameless_args (fi, start, num - args_printed,
                                 first, stream);
     }
-#ifdef UI_OUT
   do_cleanups (old_chain);
-#endif /* no UI_OUT */
 }
 
 /* Print nameless args on STREAM.
@@ -2045,7 +2017,8 @@ printf_command (char *arg, int from_tty)
   int allocated_args = 20;
   struct cleanup *old_cleanups;
 
-  val_args = (value_ptr *) xmalloc (allocated_args * sizeof (value_ptr));
+  val_args = (struct value **) xmalloc (allocated_args
+                                       * sizeof (struct value *));
   old_cleanups = make_cleanup (free_current_contents, &val_args);
 
   if (s == 0)
@@ -2209,9 +2182,9 @@ printf_command (char *arg, int from_tty)
       {
        char *s1;
        if (nargs == allocated_args)
-         val_args = (value_ptr *) xrealloc ((char *) val_args,
-                                            (allocated_args *= 2)
-                                            * sizeof (value_ptr));
+         val_args = (struct value **) xrealloc ((char *) val_args,
+                                                (allocated_args *= 2)
+                                                * sizeof (struct value *));
        s1 = s;
        val_args[nargs] = parse_to_comma_and_eval (&s1);
 
@@ -2345,20 +2318,6 @@ disassemble_command (char *arg, int from_tty)
 #if defined(TUI)
       else if (tui_version)
        low = tuiGetLowDisassemblyAddress (low, pc);
-#endif
-#if 0
-      if (overlay_debugging)
-       {
-         section = find_pc_overlay (pc);
-         if (pc_in_unmapped_range (pc, section))
-           {
-             /* find_pc_partial_function will have returned low and high
-                relative to the symbolic (mapped) address range.  Need to
-                translate them back to the unmapped range where PC is.  */
-             low = overlay_unmapped_address (low, section);
-             high = overlay_unmapped_address (high, section);
-           }
-       }
 #endif
       low += FUNCTION_START_OFFSET;
     }
@@ -2430,7 +2389,7 @@ disassemble_command (char *arg, int from_tty)
 static int
 print_insn (CORE_ADDR memaddr, struct ui_file *stream)
 {
-  if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG;
   else
     TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_LITTLE;
@@ -2477,7 +2436,7 @@ with this command or \"print\".", NULL));
 Default is the function surrounding the pc of the selected frame.\n\
 With a single argument, the function surrounding that address is dumped.\n\
 Two arguments are taken as a range of memory to dump.");
-  c->completer = location_completer;
+  set_cmd_completer (c, location_completer);
   if (xdb_commands)
     add_com_alias ("va", "disassemble", class_xdb, 0);
 
@@ -2560,7 +2519,7 @@ You can see these environment settings with the \"show\" command.", NULL));
 The argument is the function name and arguments, in the notation of the\n\
 current working language.  The result is printed and saved in the value\n\
 history, if it is not void.");
-  c->completer = location_completer;
+  set_cmd_completer (c, location_completer);
 
   add_cmd ("variable", class_vars, set_command,
           "Evaluate expression EXP and assign result to variable VAR, using assignment\n\
@@ -2593,13 +2552,13 @@ resides in memory.\n",
                   "\n\
 EXP may be preceded with /FMT, where FMT is a format letter\n\
 but no count or size letter (see \"x\" command).", NULL));
-  c->completer = location_completer;
+  set_cmd_completer (c, location_completer);
   add_com_alias ("p", "print", class_vars, 1);
 
   c = add_com ("inspect", class_vars, inspect_command,
           "Same as \"print\" command, except that if you are running in the epoch\n\
 environment, the value is printed in its own window.");
-  c->completer = location_completer;
+  set_cmd_completer (c, location_completer);
 
   add_show_from_set (
                 add_set_cmd ("max-symbolic-offset", no_class, var_uinteger,
This page took 0.026947 seconds and 4 git commands to generate.