* gdbserver/{remote-gutils.c remote-server.c Makefile.in
[deliverable/binutils-gdb.git] / gdb / printcmd.c
index 298de93f838d9bcac34c35ab2c647061e6d769cb..b5bf3d8d06da6dba88befafc3d5519807a82e7fd 100644 (file)
@@ -218,7 +218,7 @@ decode_format (string_ptr, oformat, osize)
     {
       if (*p == 'b' || *p == 'h' || *p == 'w' || *p == 'g')
        val.size = *p++;
-#ifdef LONG_LONG
+#ifdef CC_HAS_LONG_LONG
       else if (*p == 'l')
        {
          val.size = 'g';
@@ -231,7 +231,7 @@ decode_format (string_ptr, oformat, osize)
        break;
     }
 
-#ifndef LONG_LONG
+#ifndef CC_HAS_LONG_LONG
   /* Make sure 'g' size is not used on integer types.
      Well, actually, we can handle hex.  */
   if (val.size == 'g' && val.format != 'f' && val.format != 'x')
@@ -309,7 +309,12 @@ print_formatted (val, format, size)
       break;
 
     case 'i':
-      wrap_here ("");  /* Force output out, print_insn not using _filtered */
+      /* The old comment says
+        "Force output out, print_insn not using _filtered".
+        I'm not completely sure what that means, I suspect most print_insn
+        now do use _filtered, so I guess it's obsolete.  */
+      /* We often wrap here if there are long symbolic names.  */
+      wrap_here ("\t");
       next_address = VALUE_ADDRESS (val)
        + print_insn (VALUE_ADDRESS (val), stdout);
       break;
@@ -398,75 +403,33 @@ print_scalar_formatted (valaddr, type, format, size, stream)
       if (!size)
        {
          /* no size specified, like in print.  Print varying # of digits. */
-#if defined (LONG_LONG)
-         fprintf_filtered (stream, local_hex_format_custom("ll"), val_long);
-#else /* not LONG_LONG.  */
-         fprintf_filtered (stream, local_hex_format_custom("l"), val_long);
-#endif /* not LONG_LONG.  */
+         print_longest (stream, 'x', 1, val_long);
        }
       else
-#if defined (LONG_LONG)
-      switch (size)
-       {
-       case 'b':
-         fprintf_filtered (stream, local_hex_format_custom("02ll"), val_long);
-         break;
-       case 'h':
-         fprintf_filtered (stream, local_hex_format_custom("04ll"), val_long);
-         break;
-       case 'w':
-         fprintf_filtered (stream, local_hex_format_custom("08ll"), val_long);
-         break;
-       case 'g':
-         fprintf_filtered (stream, local_hex_format_custom("016ll"), val_long);
-         break;
-       default:
-         error ("Undefined output size \"%c\".", size);
-       }
-#else /* not LONG_LONG.  */
-      switch (size)
-       {
-       case 'b':
-         fprintf_filtered (stream, local_hex_format_custom("02"), val_long);
-         break;
-       case 'h':
-         fprintf_filtered (stream, local_hex_format_custom("04"), val_long);
-         break;
-       case 'w':
-         fprintf_filtered (stream, local_hex_format_custom("08"), val_long);
-         break;
-       case 'g':
-         fprintf_filtered (stream, local_hex_format_custom("016"), val_long);
-         break;
-       default:
-         error ("Undefined output size \"%c\".", size);
-       }
-#endif /* not LONG_LONG */
+       switch (size)
+         {
+         case 'b':
+         case 'h':
+         case 'w':
+         case 'g':
+           print_longest (stream, size, 1, val_long);
+           break;
+         default:
+           error ("Undefined output size \"%c\".", size);
+         }
       break;
 
     case 'd':
-#ifdef LONG_LONG
-      fprintf_filtered (stream, local_decimal_format_custom("ll"), val_long);
-#else
-      fprintf_filtered (stream, local_decimal_format(), val_long);
-#endif
+      print_longest (stream, 'd', 1, val_long);
       break;
 
     case 'u':
-#ifdef LONG_LONG
-      fprintf_filtered (stream, "%llu", val_long);
-#else
-      fprintf_filtered (stream, "%u", val_long);
-#endif
+      print_longest (stream, 'u', 0, val_long);
       break;
 
     case 'o':
       if (val_long)
-#ifdef LONG_LONG
-       fprintf_filtered (stream, local_octal_format_custom("ll"), val_long);
-#else
-       fprintf_filtered (stream, local_octal_format(), val_long);
-#endif
+       print_longest (stream, 'o', 1, val_long);
       else
        fprintf_filtered (stream, "0");
       break;
@@ -573,16 +536,38 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
      char *leadin;
 {
   CORE_ADDR name_location;
-  register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (addr);
+  register struct symbol *symbol;
+  char *name;
 
-  /* If nothing comes out, don't print anything symbolic.  */
+  /* First try to find the address in the symbol tables to find
+     static functions. If that doesn't succeed we try the minimal symbol
+     vector for symbols in non-text space.
+     FIXME: Should find a way to get at the static non-text symbols too.  */
   
-  if (msymbol == NULL)
-    return;
+  symbol = find_pc_function (addr);
+  if (symbol)
+    {
+    name_location = BLOCK_START (SYMBOL_BLOCK_VALUE (symbol));
+    if (do_demangle)
+      name = SYMBOL_SOURCE_NAME (symbol);
+    else
+      name = SYMBOL_LINKAGE_NAME (symbol);
+    }
+  else
+    {
+    register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (addr);
 
-  /* If the nearest symbol is too far away, ditto.  */
+    /* If nothing comes out, don't print anything symbolic.  */
+    if (msymbol == NULL)
+      return;
+    name_location = SYMBOL_VALUE_ADDRESS (msymbol);
+    if (do_demangle)
+      name = SYMBOL_SOURCE_NAME (msymbol);
+    else
+      name = SYMBOL_LINKAGE_NAME (msymbol);
+    }
 
-  name_location = SYMBOL_VALUE_ADDRESS (msymbol);
+  /* If the nearest symbol is too far away, don't print anything symbolic.  */
 
   /* For when CORE_ADDR is larger than unsigned int, we do math in
      CORE_ADDR.  But when we detect unsigned wraparound in the
@@ -595,12 +580,9 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
 
   fputs_filtered (leadin, stream);
   fputs_filtered ("<", stream);
-  if (do_demangle)
-    fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
-  else
-    fputs_filtered (SYMBOL_LINKAGE_NAME (msymbol), stream);
+  fputs_filtered (name, stream);
   if (addr != name_location)
-    fprintf_filtered (stream, "+%d>", (int)(addr - name_location));
+    fprintf_filtered (stream, "+%u>", (unsigned int)(addr - name_location));
   else
     fputs_filtered (">", stream);
 }
@@ -676,7 +658,7 @@ do_examine (fmt, addr)
   else if (size == 'w')
     val_type = builtin_type_long;
   else if (size == 'g')
-#ifndef LONG_LONG
+#ifndef CC_HAS_LONG_LONG
     val_type = builtin_type_double;
 #else
     val_type = builtin_type_long_long;
@@ -951,6 +933,10 @@ address_info (exp, from_tty)
     case LOC_REGPARM:
       printf ("an argument in register %s", reg_names[val]);
       break;
+
+   case LOC_REGPARM_ADDR:
+     printf ("address of an argument in register %s", reg_names[val]);
+     break;
       
     case LOC_ARG:
       if (SYMBOL_BASEREG_VALID (sym))
@@ -1513,6 +1499,7 @@ print_frame_args (func, fi, num, stream)
       /* We care about types of symbols, but don't need to keep track of
         stack offsets in them.  */
       case LOC_REGPARM:
+      case LOC_REGPARM_ADDR:
       case LOC_LOCAL_ARG:
        break;
 
@@ -1529,8 +1516,8 @@ print_frame_args (func, fi, num, stream)
         and it is passed as a double and converted to float by
         the prologue (in the latter case the type of the LOC_ARG
         symbol is double and the type of the LOC_LOCAL symbol is
-        float).  It's possible this should be dealt with in
-        symbol reading the way it now is for LOC_REGPARM.  */
+        float).  There are also LOC_ARG/LOC_REGISTER pairs which
+        are not combined in symbol-reading.  */
       /* But if the parameter name is null, don't try it.
         Null parameter names occur on the RS/6000, for traceback tables.
         FIXME, should we even print them?  */
@@ -1811,11 +1798,11 @@ printf_command (arg, from_tty)
            argindex += sizeof (double);
          }
        else
-#ifdef LONG_LONG
+#ifdef CC_HAS_LONG_LONG
          if (argclass[i] == long_long_arg)
            {
-             *(long long *) &arg_bytes[argindex] = value_as_long (val_args[i]);
-             argindex += sizeof (long long);
+             *(LONGEST *) &arg_bytes[argindex] = value_as_long (val_args[i]);
+             argindex += sizeof (LONGEST);
            }
          else
 #endif
@@ -2035,7 +2022,7 @@ You can see these environment settings with the \"show\" command.",
 
   /* "call" is the same as "set", but handy for dbx users to call fns. */
   add_com ("call", class_vars, call_command,
-          "Call a function in the inferior process.\n\
+          "Call a function in the program.\n\
 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.");
This page took 0.025481 seconds and 4 git commands to generate.