#include "target.h"
#include "breakpoint.h"
#include "demangle.h"
+#include "inferior.h"
static void
return_command PARAMS ((char *, int));
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;
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);
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)
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)
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)
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);