]> Git Repo - binutils.git/blobdiff - gdb/stack.c
* config/alpha/xm-alpha.h: Add MAKEVA_END.
[binutils.git] / gdb / stack.c
index 31d7b2846071fca01db91c6c34fd0778d30cdfd3..0e005862a132bdcfff268303959d80476d997e58 100644 (file)
@@ -29,6 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "target.h"
 #include "breakpoint.h"
 #include "demangle.h"
+#include "inferior.h"
 
 static void
 return_command PARAMS ((char *, int));
@@ -129,6 +130,25 @@ print_stack_frame (frame, level, source)
   print_frame_info (fi, level, source, 1);
 }
 
+struct print_args_args {
+  struct symbol *func;
+  struct frame_info *fi;
+};
+
+static int print_args_stub PARAMS ((char *));
+
+/* Pass the args the way catch_errors wants them.  */
+static int
+print_args_stub (args)
+     char *args;
+{
+  int numargs;
+  struct print_args_args *p = (struct print_args_args *)args;
+  FRAME_NUM_ARGS (numargs, (p->fi));
+  print_frame_args (p->func, p->fi, numargs, stdout);
+  return 0;
+}
+
 void
 print_frame_info (fi, level, source, args)
      struct frame_info *fi;
@@ -142,9 +162,24 @@ print_frame_info (fi, level, source, args)
   enum language funlang = language_unknown;
   int numargs;
 
-#ifdef CORE_NEEDS_RELOCATION
-  CORE_NEEDS_RELOCATION(fi->pc);
-#endif
+  if (PC_IN_CALL_DUMMY (fi->pc, read_register (SP_REGNUM), fi->frame))
+    {
+      /* Do this regardless of SOURCE because we don't have any source
+        to list for this frame.  */
+      if (level >= 0)
+       printf_filtered ("#%-2d ", level);
+      printf_filtered ("<function called from gdb>\n");
+      return;
+    }
+  if (fi->signal_handler_caller)
+    {
+      /* Do this regardless of SOURCE because we don't have any source
+        to list for this frame.  */
+      if (level >= 0)
+       printf_filtered ("#%-2d ", level);
+      printf_filtered ("<signal handler called>\n");
+      return;
+    }
 
   sal = find_pc_line (fi->pc, fi->next_frame);
   func = find_pc_function (fi->pc);
@@ -207,8 +242,10 @@ print_frame_info (fi, level, source, args)
       fputs_filtered (" (", stdout);
       if (args)
        {
-         FRAME_NUM_ARGS (numargs, fi);
-         print_frame_args (func, fi, numargs, stdout);
+         struct print_args_args args;
+         args.fi = fi;
+         args.func = func;
+         catch_errors (print_args_stub, (char *)&args, "");
        }
       printf_filtered (")");
       if (sal.symtab && sal.symtab->filename)
@@ -234,7 +271,8 @@ print_frame_info (fi, level, source, args)
       int done = 0;
       int mid_statement = source < 0 && fi->pc != sal.pc;
       if (frame_file_full_name)
-       done = identify_source_line (sal.symtab, sal.line, mid_statement);
+       done = identify_source_line (sal.symtab, sal.line, mid_statement,
+                                    fi->pc);
       if (!done)
        {
          if (addressprint && mid_statement)
@@ -372,7 +410,7 @@ frame_info (addr_exp, from_tty)
   enum language funlang = language_unknown;
 
   if (!target_has_stack)
-    error ("No inferior or core file.");
+    error ("No stack.");
 
   frame = parse_frame_specification (addr_exp);
   if (!frame)
@@ -866,15 +904,24 @@ print_frame_arg_vars (frame, stream)
       if (SYMBOL_CLASS (sym) == LOC_ARG
          || SYMBOL_CLASS (sym) == LOC_LOCAL_ARG
          || SYMBOL_CLASS (sym) == LOC_REF_ARG
-         || SYMBOL_CLASS (sym) == LOC_REGPARM)
+         || SYMBOL_CLASS (sym) == LOC_REGPARM
+         || SYMBOL_CLASS (sym) == LOC_REGPARM_ADDR)
        {
          values_printed = 1;
          fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
          fputs_filtered (" = ", stream);
-         /* We have to look up the symbol because arguments often have
-            two entries (one a parameter, one a register) and the one
-            we want is the register, which lookup_symbol will find for
-            us.  */
+
+         /* We have to look up the symbol because arguments can have
+            two entries (one a parameter, one a local) and the one we
+            want is the local, which lookup_symbol will find for us.
+            This includes gcc1 (not gcc2) on the sparc when passing a
+            small structure and gcc2 when the argument type is float
+            and it is passed as a double and converted to float by
+            the prologue (in the latter case the type of the LOC_ARG
+            symbol is double and the type of the LOC_LOCAL symbol is
+            float).  There are also LOC_ARG/LOC_REGISTER pairs which
+            are not combined in symbol-reading.  */
+
          sym2 = lookup_symbol (SYMBOL_NAME (sym),
                        b, VAR_NAMESPACE, (int *)NULL, (struct symtab **)NULL);
          print_variable_value (sym2, frame, stream);
This page took 0.027539 seconds and 4 git commands to generate.