daily update
[deliverable/binutils-gdb.git] / gdb / printcmd.c
index 68c2a54e55072ec90cfbea86e5e9a7aa66141312..ad9401866817399c7d2cc76a4fc283a5b8a115f1 100644 (file)
 #include "tui/tui.h"           /* For tui_active et.al.   */
 #endif
 
+#if defined(__MINGW32__)
+# define USE_PRINTF_I64 1
+# define PRINTF_HAS_LONG_LONG
+#else
+# define USE_PRINTF_I64 0
+#endif
+
 extern int asm_demangle;       /* Whether to demangle syms in asm printouts */
 extern int addressprint;       /* Whether to print hex addresses in HLL " */
 
@@ -285,6 +292,7 @@ print_formatted (struct value *val, int format, int size,
     }
 
   if (format == 0 || format == 's'
+      || TYPE_CODE (type) == TYPE_CODE_REF
       || TYPE_CODE (type) == TYPE_CODE_ARRAY
       || TYPE_CODE (type) == TYPE_CODE_STRING
       || TYPE_CODE (type) == TYPE_CODE_STRUCT
@@ -314,13 +322,15 @@ print_scalar_formatted (const void *valaddr, struct type *type,
 {
   LONGEST val_long = 0;
   unsigned int len = TYPE_LENGTH (type);
+  enum bfd_endian byte_order = gdbarch_byte_order (current_gdbarch);
 
   /* If we get here with a string format, try again without it.  Go
      all the way back to the language printers, which may call us
      again.  */
   if (format == 's')
     {
-      val_print (type, valaddr, 0, 0, stream, 0, 0, 0, Val_pretty_default);
+      val_print (type, valaddr, 0, 0, stream, 0, 0, 0, Val_pretty_default,
+                current_language);
       return;
     }
 
@@ -331,20 +341,20 @@ print_scalar_formatted (const void *valaddr, struct type *type,
       switch (format)
        {
        case 'o':
-         print_octal_chars (stream, valaddr, len);
+         print_octal_chars (stream, valaddr, len, byte_order);
          return;
        case 'u':
        case 'd':
-         print_decimal_chars (stream, valaddr, len);
+         print_decimal_chars (stream, valaddr, len, byte_order);
          return;
        case 't':
-         print_binary_chars (stream, valaddr, len);
+         print_binary_chars (stream, valaddr, len, byte_order);
          return;
        case 'x':
-         print_hex_chars (stream, valaddr, len);
+         print_hex_chars (stream, valaddr, len, byte_order);
          return;
        case 'c':
-         print_char_chars (stream, valaddr, len);
+         print_char_chars (stream, valaddr, len, byte_order);
          return;
        default:
          break;
@@ -666,23 +676,6 @@ build_address_symbolic (CORE_ADDR addr,  /* IN */
   return 0;
 }
 
-/* Print address ADDR on STREAM.  USE_LOCAL means the same thing as for
-   print_longest.  */
-void
-deprecated_print_address_numeric (CORE_ADDR addr, int use_local,
-                                 struct ui_file *stream)
-{
-  if (use_local)
-    fputs_filtered (paddress (addr), stream);
-  else
-    {
-      int addr_bit = gdbarch_addr_bit (current_gdbarch);
-
-      if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-       addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
-      print_longest (stream, 'x', 0, (ULONGEST) addr);
-    }
-}
 
 /* Print address ADDR symbolically on STREAM.
    First print it as a number.  Then perhaps print
@@ -1032,7 +1025,6 @@ address_info (char *exp, int from_tty)
   struct symbol *sym;
   struct minimal_symbol *msymbol;
   long val;
-  long basereg;
   asection *section;
   CORE_ADDR load_addr;
   int is_a_field_of_this;      /* C++: lookup_symbol sets this to nonzero
@@ -1042,7 +1034,7 @@ address_info (char *exp, int from_tty)
     error (_("Argument required."));
 
   sym = lookup_symbol (exp, get_selected_block (0), VAR_DOMAIN,
-                      &is_a_field_of_this, (struct symtab **) NULL);
+                      &is_a_field_of_this);
   if (sym == NULL)
     {
       if (is_a_field_of_this)
@@ -1090,7 +1082,6 @@ address_info (char *exp, int from_tty)
                           current_language->la_language, DMGL_ANSI);
   printf_filtered ("\" is ");
   val = SYMBOL_VALUE (sym);
-  basereg = SYMBOL_BASEREG (sym);
   section = SYMBOL_BFD_SECTION (sym);
 
   switch (SYMBOL_CLASS (sym))
@@ -1141,20 +1132,6 @@ address_info (char *exp, int from_tty)
        }
       break;
 
-    case LOC_INDIRECT:
-      printf_filtered (_("external global (indirect addressing), at address *("));
-      fputs_filtered (paddress (load_addr = SYMBOL_VALUE_ADDRESS (sym)),
-                     gdb_stdout);
-      printf_filtered (")");
-      if (section_is_overlay (section))
-       {
-         load_addr = overlay_unmapped_address (load_addr, section);
-         printf_filtered (_(",\n -- loaded at "));
-         fputs_filtered (paddress (load_addr), gdb_stdout);
-         printf_filtered (_(" in overlay section %s"), section->name);
-       }
-      break;
-
     case LOC_REGPARM:
       printf_filtered (_("an argument in register %s"),
                         gdbarch_register_name (current_gdbarch, val));
@@ -1169,10 +1146,6 @@ address_info (char *exp, int from_tty)
       printf_filtered (_("an argument at offset %ld"), val);
       break;
 
-    case LOC_LOCAL_ARG:
-      printf_filtered (_("an argument at frame offset %ld"), val);
-      break;
-
     case LOC_LOCAL:
       printf_filtered (_("a local variable at frame offset %ld"), val);
       break;
@@ -1181,16 +1154,6 @@ address_info (char *exp, int from_tty)
       printf_filtered (_("a reference argument at offset %ld"), val);
       break;
 
-    case LOC_BASEREG:
-      printf_filtered (_("a variable at offset %ld from register %s"),
-                      val, gdbarch_register_name (current_gdbarch, basereg));
-      break;
-
-    case LOC_BASEREG_ARG:
-      printf_filtered (_("an argument at offset %ld from register %s"),
-                      val, gdbarch_register_name (current_gdbarch, basereg));
-      break;
-
     case LOC_TYPEDEF:
       printf_filtered (_("a typedef"));
       break;
@@ -1232,12 +1195,6 @@ address_info (char *exp, int from_tty)
       }
       break;
 
-    case LOC_HP_THREAD_LOCAL_STATIC:
-      printf_filtered (_("\
-a thread-local variable at offset %ld from the thread base register %s"),
-                      val, gdbarch_register_name (current_gdbarch, basereg));
-      break;
-
     case LOC_OPTIMIZED_OUT:
       printf_filtered (_("optimized out"));
       break;
@@ -2008,8 +1965,23 @@ printf_command (char *arg, int from_tty)
                   *f);
 
          f++;
-         strncpy (current_substring, last_arg, f - last_arg);
-         current_substring += f - last_arg;
+
+         if (lcount > 1 && USE_PRINTF_I64)
+           {
+             /* Windows' printf does support long long, but not the usual way.
+                Convert %lld to %I64d.  */
+             int length_before_ll = f - last_arg - 1 - lcount;
+             strncpy (current_substring, last_arg, length_before_ll);
+             strcpy (current_substring + length_before_ll, "I64");
+             current_substring[length_before_ll + 3] =
+               last_arg[length_before_ll + lcount];
+             current_substring += length_before_ll + 4;
+           }
+         else
+           {
+             strncpy (current_substring, last_arg, f - last_arg);
+             current_substring += f - last_arg;
+           }
          *current_substring++ = '\0';
          last_arg = f;
          argclass[nargs_wanted++] = this_argclass;
This page took 0.029074 seconds and 4 git commands to generate.