1999-01-19 Fernando Nasser <fnasser@totem.to.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / printcmd.c
index 7d0f3a517f825a2e4bc1393e6b32112dd8da82c4..bbc4ba00c0e0286815c6c547462520e6133c1035 100644 (file)
@@ -1,5 +1,5 @@
 /* Print values for GNU debugger GDB.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1995
+   Copyright 1986, 87, 88, 89, 90, 91, 93, 94, 95, 1998
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -121,12 +121,13 @@ static int display_number;
 int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info *));
 disassemble_info tm_print_insn_info;
 
-/* Functions exported for general use: */
+/* Prototypes for exported functions. */
 
 void output_command PARAMS ((char *, int));
 
+void _initialize_printcmd PARAMS ((void));
 
-/* Prototypes for local functions.  */
+/* Prototypes for local functions. */
 
 static void delete_display PARAMS ((int));
 
@@ -175,6 +176,8 @@ static struct format_data decode_format PARAMS ((char **, int, int));
 
 static int print_insn PARAMS ((CORE_ADDR, GDB_FILE *));
 
+static void sym_info PARAMS ((char *, int));
+
 \f
 /* Decode a format specification.  *STRING_PTR should point to it.
    OFORMAT and OSIZE are used as defaults for the format and size
@@ -830,7 +833,8 @@ print_command_1 (exp, inspect, voidprint)
       extern int objectprint;
       struct type *type;
       expr = parse_expression (exp);
-      old_chain = make_cleanup (free_current_contents, &expr);
+      old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                &expr);
       cleanup = 1;
       val = evaluate_expression (expr);
 
@@ -943,7 +947,7 @@ output_command (exp, from_tty)
     }
 
   expr = parse_expression (exp);
-  old_chain = make_cleanup (free_current_contents, &expr);
+  old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
 
   val = evaluate_expression (expr);
 
@@ -964,7 +968,7 @@ set_command (exp, from_tty)
 {
   struct expression *expr = parse_expression (exp);
   register struct cleanup *old_chain
-    = make_cleanup (free_current_contents, &expr);
+    = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
   evaluate_expression (expr);
   do_cleanups (old_chain);
 }
@@ -1103,7 +1107,7 @@ address_info (exp, from_tty)
       break;
 
     case LOC_REGISTER:
-      printf_filtered ("a variable in register %s", reg_names[val]);
+      printf_filtered ("a variable in register %s", REGISTER_NAME (val));
       break;
 
     case LOC_STATIC:
@@ -1120,11 +1124,11 @@ address_info (exp, from_tty)
       break;
 
     case LOC_REGPARM:
-      printf_filtered ("an argument in register %s", reg_names[val]);
+      printf_filtered ("an argument in register %s", REGISTER_NAME (val));
       break;
 
     case LOC_REGPARM_ADDR:
-      printf_filtered ("address of an argument in register %s", reg_names[val]);
+      printf_filtered ("address of an argument in register %s", REGISTER_NAME (val));
       break;
 
     case LOC_ARG:
@@ -1145,12 +1149,12 @@ address_info (exp, from_tty)
 
     case LOC_BASEREG:
       printf_filtered ("a variable at offset %ld from register %s",
-             val, reg_names[basereg]);
+             val, REGISTER_NAME (basereg));
       break;
 
     case LOC_BASEREG_ARG:
       printf_filtered ("an argument at offset %ld from register %s",
-             val, reg_names[basereg]);
+             val, REGISTER_NAME (basereg));
       break;
 
     case LOC_TYPEDEF:
@@ -1241,7 +1245,8 @@ x_command (exp, from_tty)
         But don't clobber a user-defined command's definition.  */
       if (from_tty)
        *exp = 0;
-      old_chain = make_cleanup (free_current_contents, &expr);
+      old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                &expr);
       val = evaluate_expression (expr);
       if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
        val = value_ind (val);
@@ -1917,9 +1922,9 @@ printf_command (arg, from_tty)
      char *arg;
      int from_tty;
 {
-  register char *f;
+  register char *f = NULL;
   register char *s = arg;
-  char *string;
+  char *string = NULL;
   value_ptr *val_args;
   char *substrings;
   char *current_substring;
@@ -1928,7 +1933,8 @@ printf_command (arg, from_tty)
   struct cleanup *old_cleanups;
 
   val_args = (value_ptr *) xmalloc (allocated_args * sizeof (value_ptr));
-  old_cleanups = make_cleanup (free_current_contents, &val_args);
+  old_cleanups = make_cleanup ((make_cleanup_func) free_current_contents, 
+                               &val_args);
 
   if (s == 0)
     error_no_arg ("format-control string and values to print");
@@ -2198,7 +2204,6 @@ disassemble_command (arg, from_tty)
   char *name;
   CORE_ADDR pc, pc_masked;
   char *space_index;
-  asection *section;
 
   name = NULL;
   if (!arg)
@@ -2278,20 +2283,16 @@ print_insn (memaddr, stream)
      CORE_ADDR memaddr;
      GDB_FILE *stream;
 {
-  /* If there's no disassembler, something is very wrong.  */
-  if (tm_print_insn == NULL)
-    abort ();
-
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
-    tm_print_insn_info.endian = BFD_ENDIAN_BIG;
+    TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG;
   else
-    tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
+    TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_LITTLE;
 
-  if (target_architecture != NULL)
-    tm_print_insn_info.mach = target_architecture->mach;
+  if (TARGET_ARCHITECTURE != NULL)
+    TARGET_PRINT_INSN_INFO->mach = TARGET_ARCHITECTURE->mach;
   /* else: should set .mach=0 but some disassemblers don't grok this */
 
-  return (*tm_print_insn) (memaddr, &tm_print_insn_info);
+  return TARGET_PRINT_INSN (memaddr, TARGET_PRINT_INSN_INFO);
 }
 
 \f
This page took 0.027481 seconds and 4 git commands to generate.