]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/stack.c
Move [PAC] into a new MI field addr_flags
[thirdparty/binutils-gdb.git] / gdb / stack.c
index c68b3876d35428a81137034edb3f51bce04fd6f0..06431ea3543e786a89e6194a023f66b949bacb8b 100644 (file)
@@ -390,7 +390,7 @@ print_frame_arg (const frame_print_options &fp_opts,
   else
     {
       if (arg->error)
-       stb.printf (_("<error reading variable: %s>"), arg->error);
+       stb.printf (_("<error reading variable: %s>"), arg->error.get ());
       else
        {
          try
@@ -452,13 +452,12 @@ read_frame_local (struct symbol *sym, struct frame_info *frame,
     }
   catch (const gdb_exception_error &except)
     {
-      argp->error = xstrdup (except.what ());
+      argp->error.reset (xstrdup (except.what ()));
     }
 }
 
-/* Read in inferior function parameter SYM at FRAME into ARGP.  Caller is
-   responsible for xfree of ARGP->ERROR.  This function never throws an
-   exception.  */
+/* Read in inferior function parameter SYM at FRAME into ARGP.  This
+   function never throws an exception.  */
 
 void
 read_frame_arg (const frame_print_options &fp_opts,
@@ -626,7 +625,7 @@ read_frame_arg (const frame_print_options &fp_opts,
 
   argp->sym = sym;
   argp->val = val;
-  argp->error = val_error ? xstrdup (val_error) : NULL;
+  argp->error.reset (val_error ? xstrdup (val_error) : NULL);
   if (!val && !val_error)
     argp->entry_kind = print_entry_values_only;
   else if ((fp_opts.print_entry_values == print_entry_values_compact
@@ -641,7 +640,7 @@ read_frame_arg (const frame_print_options &fp_opts,
 
   entryargp->sym = sym;
   entryargp->val = entryval;
-  entryargp->error = entryval_error ? xstrdup (entryval_error) : NULL;
+  entryargp->error.reset (entryval_error ? xstrdup (entryval_error) : NULL);
   if (!entryval && !entryval_error)
     entryargp->entry_kind = print_entry_values_no;
   else
@@ -810,10 +809,8 @@ print_frame_args (const frame_print_options &fp_opts,
 
          if (!print_args)
            {
-             memset (&arg, 0, sizeof (arg));
              arg.sym = sym;
              arg.entry_kind = print_entry_values_no;
-             memset (&entryarg, 0, sizeof (entryarg));
              entryarg.sym = sym;
              entryarg.entry_kind = print_entry_values_no;
            }
@@ -834,9 +831,6 @@ print_frame_args (const frame_print_options &fp_opts,
              print_frame_arg (fp_opts, &entryarg);
            }
 
-         xfree (arg.error);
-         xfree (entryarg.error);
-
          first = 0;
        }
     }
@@ -929,6 +923,23 @@ print_frame_info_to_print_what (const char *print_frame_info)
                  print_frame_info);
 }
 
+/* Print the PC from FRAME, plus any flags, to UIOUT.  */
+
+static void
+print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, frame_info *frame,
+         CORE_ADDR pc)
+{
+  uiout->field_core_addr ("addr", gdbarch, pc);
+
+  std::string flags = gdbarch_get_pc_address_flags (gdbarch, frame, pc);
+  if (!flags.empty ())
+  {
+    uiout->text (" [");
+    uiout->field_string ("addr_flags", flags);
+    uiout->text ("]");
+  }
+}
+
 /* See stack.h.  */
 
 void
@@ -986,8 +997,7 @@ print_frame_info (const frame_print_options &fp_opts,
       if (uiout->is_mi_like_p ())
         {
           annotate_frame_address ();
-          uiout->field_core_addr ("addr",
-                                 gdbarch, get_frame_pc (frame));
+         print_pc (uiout, gdbarch, frame, get_frame_pc (frame));
           annotate_frame_address_end ();
         }
 
@@ -1071,8 +1081,7 @@ print_frame_info (const frame_print_options &fp_opts,
             ability to decide for themselves if it is desired.  */
          if (opts.addressprint && mid_statement)
            {
-             uiout->field_core_addr ("addr",
-                                     gdbarch, get_frame_pc (frame));
+             print_pc (uiout, gdbarch, frame, get_frame_pc (frame));
              uiout->text ("\t");
            }
 
@@ -1298,7 +1307,7 @@ print_frame (const frame_print_options &fp_opts,
        {
          annotate_frame_address ();
          if (pc_p)
-           uiout->field_core_addr ("addr", gdbarch, pc);
+           print_pc (uiout, gdbarch, frame, pc);
          else
            uiout->field_string ("addr", "<unavailable>",
                                 ui_out_style_kind::ADDRESS);