ppc: Fix record support of Store String Word instructions
[deliverable/binutils-gdb.git] / gdb / stack.c
index 89879f38adbf66db738fed1d34caa04eb8c626fb..417e887b28ad5f18396b7f91f7a53d2612dac63d 100644 (file)
@@ -310,8 +310,6 @@ void
 read_frame_local (struct symbol *sym, struct frame_info *frame,
                  struct frame_arg *argp)
 {
-  struct value *val = NULL;
-
   argp->sym = sym;
   argp->val = NULL;
   argp->error = NULL;
@@ -1103,7 +1101,8 @@ find_frame_funname (struct frame_info *frame, char **funname,
        }
       else
        {
-         *funname = xstrdup (SYMBOL_PRINT_NAME (func));
+         const char *print_name = SYMBOL_PRINT_NAME (func);
+
          *funlang = SYMBOL_LANGUAGE (func);
          if (funcp)
            *funcp = func;
@@ -1114,14 +1113,17 @@ find_frame_funname (struct frame_info *frame, char **funname,
                 stored in the symbol table, but we stored a version
                 with DMGL_PARAMS turned on, and here we don't want to
                 display parameters.  So remove the parameters.  */
-             char *func_only = cp_remove_params (*funname);
+             char *func_only = cp_remove_params (print_name);
 
              if (func_only)
-               {
-                 xfree (*funname);
-                 *funname = func_only;
-               }
+               *funname = func_only;
            }
+
+         /* If we didn't hit the C++ case above, set *funname here.
+            This approach is taken to avoid having to install a
+            cleanup in case cp_remove_params can throw.  */
+         if (*funname == NULL)
+           *funname = xstrdup (print_name);
        }
     }
   else
@@ -1275,8 +1277,8 @@ print_frame (struct frame_info *frame, int print_level,
 
 /* Read a frame specification in whatever the appropriate format is from
    FRAME_EXP.  Call error() if the specification is in any way invalid (so
-   this function never returns NULL).  When SEPECTED_P is non-NULL set its
-   target to indicate that the default selected frame was used.  */
+   this function never returns NULL).  When SELECTED_FRAME_P is non-NULL
+   set its target to indicate that the default selected frame was used.  */
 
 static struct frame_info *
 parse_frame_specification (const char *frame_exp, int *selected_frame_p)
@@ -1509,27 +1511,32 @@ frame_info (char *addr_exp, int from_tty)
   wrap_here ("    ");
   printf_filtered ("saved %s = ", pc_regname);
 
-  TRY
-    {
-      caller_pc = frame_unwind_caller_pc (fi);
-      caller_pc_p = 1;
-    }
-  CATCH (ex, RETURN_MASK_ERROR)
+  if (!frame_id_p (frame_unwind_caller_id (fi)))
+    val_print_unavailable (gdb_stdout);
+  else
     {
-      switch (ex.error)
+      TRY
        {
-       case NOT_AVAILABLE_ERROR:
-         val_print_unavailable (gdb_stdout);
-         break;
-       case OPTIMIZED_OUT_ERROR:
-         val_print_not_saved (gdb_stdout);
-         break;
-       default:
-         fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
-         break;
+         caller_pc = frame_unwind_caller_pc (fi);
+         caller_pc_p = 1;
+       }
+      CATCH (ex, RETURN_MASK_ERROR)
+       {
+         switch (ex.error)
+           {
+           case NOT_AVAILABLE_ERROR:
+             val_print_unavailable (gdb_stdout);
+             break;
+           case OPTIMIZED_OUT_ERROR:
+             val_print_not_saved (gdb_stdout);
+             break;
+           default:
+             fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+             break;
+           }
        }
+      END_CATCH
     }
-  END_CATCH
 
   if (caller_pc_p)
     fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);
This page took 0.025852 seconds and 4 git commands to generate.