Introduce assign_operation
[deliverable/binutils-gdb.git] / gdb / printcmd.c
index de083a2a7681585bf9f1647660d89e70afc0f330..58e39c7365f98f531afd6c27503bb2a589c6f923 100644 (file)
@@ -1,6 +1,6 @@
 /* Print values for GNU debugger GDB.
 
-   Copyright (C) 1986-2020 Free Software Foundation, Inc.
+   Copyright (C) 1986-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -304,7 +304,7 @@ print_formatted (struct value *val, int size,
          /* We often wrap here if there are long symbolic names.  */
          wrap_here ("    ");
          next_address = (value_address (val)
-                         + gdb_print_insn (get_type_arch (type),
+                         + gdb_print_insn (type->arch (),
                                            value_address (val), stream,
                                            &branch_delay_insns));
          return;
@@ -331,7 +331,7 @@ print_formatted (struct value *val, int size,
 static struct type *
 float_type_from_length (struct type *type)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   const struct builtin_type *builtin = builtin_type (gdbarch);
 
   if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_float))
@@ -353,7 +353,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
                        const struct value_print_options *options,
                        int size, struct ui_file *stream)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   unsigned int len = TYPE_LENGTH (type);
   enum bfd_endian byte_order = type_byte_order (type);
 
@@ -1206,7 +1206,7 @@ print_value (value *val, const value_print_options &opts)
 /* Implementation of the "print" and "call" commands.  */
 
 static void
-print_command_1 (const char *args, int voidprint)
+print_command_1 (const char *args, bool voidprint)
 {
   struct value *val;
   value_print_options print_opts;
@@ -1223,7 +1223,9 @@ print_command_1 (const char *args, int voidprint)
 
   if (exp != nullptr && *exp)
     {
-      expression_up expr = parse_expression (exp);
+      /* VOIDPRINT is true to indicate that we do want to print a void
+        value, so invert it for parse_expression.  */
+      expression_up expr = parse_expression (exp, nullptr, !voidprint);
       val = evaluate_expression (expr.get ());
     }
   else
@@ -1321,14 +1323,14 @@ print_command_completer (struct cmd_list_element *ignore,
 static void
 print_command (const char *exp, int from_tty)
 {
-  print_command_1 (exp, 1);
+  print_command_1 (exp, true);
 }
 
 /* Same as print, except it doesn't print void results.  */
 static void
 call_command (const char *exp, int from_tty)
 {
-  print_command_1 (exp, 0);
+  print_command_1 (exp, false);
 }
 
 /* Implementation of the "output" command.  */
@@ -1532,7 +1534,7 @@ info_address_command (const char *exp, int from_tty)
          fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
                        gdb_stdout);
          printf_filtered (" in a file compiled without debugging");
-         section = MSYMBOL_OBJ_SECTION (objfile, msymbol.minsym);
+         section = msymbol.minsym->obj_section (objfile);
          if (section_is_overlay (section))
            {
              load_addr = overlay_unmapped_address (load_addr, section);
@@ -1556,7 +1558,7 @@ info_address_command (const char *exp, int from_tty)
   printf_filtered ("\" is ");
   val = SYMBOL_VALUE (sym);
   if (SYMBOL_OBJFILE_OWNED (sym))
-    section = SYMBOL_OBJ_SECTION (symbol_objfile (sym), sym);
+    section = sym->obj_section (symbol_objfile (sym));
   else
     section = NULL;
   gdbarch = symbol_arch (sym);
@@ -1676,7 +1678,7 @@ info_address_command (const char *exp, int from_tty)
          printf_filtered ("unresolved");
        else
          {
-           section = MSYMBOL_OBJ_SECTION (msym.objfile, msym.minsym);
+           section = msym.obj_section ();
 
            if (section
                && (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
@@ -2368,7 +2370,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
 {
   const gdb_byte *str;
   size_t len;
-  struct gdbarch *gdbarch = get_type_arch (value_type (value));
+  struct gdbarch *gdbarch = value_type (value)->arch ();
   struct type *wctype = lookup_typename (current_language,
                                         "wchar_t", NULL, 0);
   int wcwidth = TYPE_LENGTH (wctype);
@@ -2436,7 +2438,7 @@ printf_floating (struct ui_file *stream, const char *format,
 {
   /* Parameter data.  */
   struct type *param_type = value_type (value);
-  struct gdbarch *gdbarch = get_type_arch (param_type);
+  struct gdbarch *gdbarch = param_type->arch ();
 
   /* Determine target type corresponding to the format string.  */
   struct type *fmt_type;
@@ -2642,8 +2644,7 @@ ui_printf (const char *arg, struct ui_file *stream)
            break;
          case wide_char_arg:
            {
-             struct gdbarch *gdbarch
-               = get_type_arch (value_type (val_args[i]));
+             struct gdbarch *gdbarch = value_type (val_args[i])->arch ();
              struct type *wctype = lookup_typename (current_language,
                                                     "wchar_t", NULL, 0);
              struct type *valtype;
This page took 0.025025 seconds and 4 git commands to generate.