[gdb/testsuite] Fix gdb.base/style.exp with stub-termcap
[binutils-gdb.git] / gdb / stack.c
index 516e4d45696f4b7c85ab679e29d03b3c9de331b7..66517cf18600e55c53997973a6267ec2dbd5cb1f 100644 (file)
@@ -1716,8 +1716,8 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p)
                enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
                int sp_size = register_size (gdbarch, sp_regnum);
 
-               sp = extract_unsigned_integer (value_contents_all (value),
-                                              sp_size, byte_order);
+               sp = extract_unsigned_integer
+                 (value_contents_all (value).data (), sp_size, byte_order);
 
                printf_filtered (" Previous frame's sp is ");
                fputs_filtered (paddress (gdbarch, sp), gdb_stdout);
@@ -2322,6 +2322,8 @@ do_print_variable_and_value (const char *print_name,
   if (p->treg.has_value ()
       && !treg_matches_sym_type_name (*p->treg, sym))
     return;
+  if (language_def (sym->language ())->symbol_printing_suppressed (sym))
+    return;
 
   frame = frame_find_by_id (p->frame_id);
   if (frame == NULL)
@@ -2424,12 +2426,7 @@ print_frame_local_vars (struct frame_info *frame,
 struct info_print_options
 {
   bool quiet = false;
-  char *type_regexp = nullptr;
-
-  ~info_print_options ()
-  {
-    xfree (type_regexp);
-  }
+  std::string type_regexp;
 };
 
 /* The options used by the 'info locals' and 'info args' commands.  */
@@ -2488,9 +2485,11 @@ info_locals_command (const char *args, int from_tty)
   if (args != nullptr && *args == '\0')
     args = nullptr;
 
-  print_frame_local_vars (get_selected_frame (_("No frame selected.")),
-                         opts.quiet, args, opts.type_regexp,
-                         0, gdb_stdout);
+  print_frame_local_vars
+    (get_selected_frame (_("No frame selected.")),
+     opts.quiet, args,
+     opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
+     0, gdb_stdout);
 }
 
 /* Iterate over all the argument variables in block B.  */
@@ -2599,8 +2598,11 @@ info_args_command (const char *args, int from_tty)
   if (args != nullptr && *args == '\0')
     args = nullptr;
 
-  print_frame_arg_vars (get_selected_frame (_("No frame selected.")),
-                       opts.quiet, args, opts.type_regexp, gdb_stdout);
+  print_frame_arg_vars
+    (get_selected_frame (_("No frame selected.")),
+     opts.quiet, args,
+     opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
+     gdb_stdout);
 }
 \f
 /* Return the symbol-block in which the selected frame is executing.
@@ -2840,7 +2842,7 @@ return_command (const char *retval_exp, int from_tty)
                  && rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
       gdbarch_return_value (cache_arch, function, return_type,
                            get_current_regcache (), NULL /*read*/,
-                           value_contents (return_value) /*write*/);
+                           value_contents (return_value).data () /*write*/);
     }
 
   /* If we are at the end of a call dummy now, pop the dummy frame
@@ -3026,8 +3028,8 @@ frame_apply_command_count (const char *which_command,
               set to the selected frame.  */
            scoped_restore_current_thread restore_fi_current_frame;
 
-           cmd_result = execute_command_to_string
-             (cmd, from_tty, gdb_stdout->term_out ());
+           execute_command_to_string
+             (cmd_result, cmd, from_tty, gdb_stdout->term_out ());
          }
          fi = get_selected_frame (_("frame apply "
                                     "unable to get selected frame."));