From 78cab901b0926948ddb520df9f10b96cfa0faef1 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Fri, 15 Oct 1993 19:37:29 +0000 Subject: * Move comments on bypassing call dummy breakpoint from stack.c to breakpoint.h. --- gdb/ChangeLog | 5 +++++ gdb/breakpoint.h | 6 ++++++ gdb/stack.c | 54 ++++++++++++++++++++++++------------------------------ 3 files changed, 35 insertions(+), 30 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4be0531..933d81d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +Fri Oct 15 14:30:30 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * Move comments on bypassing call dummy breakpoint from stack.c + to breakpoint.h. + Fri Oct 15 11:52:56 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * symtab.c (lookup_partial_symtab): If filename is not found and diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 589915d..2bebe3e 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -50,6 +50,12 @@ enum bptype { bp_step_resume, /* The breakpoint at the end of a call dummy. */ + /* FIXME: What if the function we are calling longjmp()s out of the + call, or the user gets out with the "return" command? We currently + have no way of cleaning up the breakpoint in these (obscure) situations. + (Probably can solve this by noticing longjmp, "return", etc., it's + similar to noticing when a watchpoint on a local variable goes out + of scope (with hardware support for watchpoints)). */ bp_call_dummy }; diff --git a/gdb/stack.c b/gdb/stack.c index d16bbd6..dc14c38 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -170,18 +170,8 @@ print_frame_info (fi, level, source, args) /* This is not a perfect test, because if a function alloca's some memory, puts some code there, and then jumps into it, then the test - will succeed even though there is no call dummy. A better - solution would be to keep track of where the call dummies are. - Probably the best way to do that is by setting a breakpoint.c - breakpoint at the end of the call dummy (wanted anyway, to clean - up wait_for_inferior). Then we know that the sizeof (CALL_DUMMY) - (or some such) bytes before that breakpoint are a call dummy. - Only problem I see with this approach is figuring out to get rid - of the breakpoint whenever the call dummy vanishes (e.g. - return_command, or longjmp out of the called function), which we - probably can solve (it's very similar to figuring out when a - watchpoint on a local variable goes out of scope if it is being - watched via something like a 386 debug register). */ + will succeed even though there is no call dummy. Probably best is + to check for a bp_call_dummy breakpoint. */ if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame)) { /* Do this regardless of SOURCE because we don't have any source @@ -266,7 +256,7 @@ print_frame_info (fi, level, source, args) printf_filtered ("#%-2d ", level); if (addressprint) if (fi->pc != sal.pc || !sal.symtab) - printf_filtered ("%s in ", local_hex_string(fi->pc)); + printf_filtered ("%s in ", local_hex_string((unsigned long) fi->pc)); fprintf_symbol_filtered (stdout, funname ? funname : "??", funlang, DMGL_NO_OPTS); wrap_here (" "); @@ -307,7 +297,7 @@ print_frame_info (fi, level, source, args) if (!done) { if (addressprint && mid_statement) - printf_filtered ("%s\t", local_hex_string(fi->pc)); + printf_filtered ("%s\t", local_hex_string((unsigned long) fi->pc)); print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); } current_source_line = max (sal.line - lines_to_list/2, 1); @@ -329,7 +319,7 @@ parse_frame_specification (frame_exp) { int numargs = 0; #define MAXARGS 4 - int args[MAXARGS]; + CORE_ADDR args[MAXARGS]; if (frame_exp) { @@ -470,14 +460,14 @@ frame_info (addr_exp, from_tty) if (!addr_exp && selected_frame_level >= 0) { printf_filtered ("Stack level %d, frame at %s:\n", selected_frame_level, - local_hex_string(FRAME_FP(frame))); + local_hex_string((unsigned long) FRAME_FP(frame))); } else { printf_filtered ("Stack frame at %s:\n", - local_hex_string(FRAME_FP(frame))); + local_hex_string((unsigned long) FRAME_FP(frame))); } printf_filtered (" %s = %s", reg_names[PC_REGNUM], - local_hex_string(fi->pc)); + local_hex_string((unsigned long) fi->pc)); wrap_here (" "); if (funname) @@ -492,7 +482,7 @@ frame_info (addr_exp, from_tty) puts_filtered ("; "); wrap_here (" "); printf_filtered ("saved %s %s\n", reg_names[PC_REGNUM], - local_hex_string(FRAME_SAVED_PC (frame))); + local_hex_string((unsigned long) FRAME_SAVED_PC (frame))); { int frameless = 0; @@ -505,13 +495,13 @@ frame_info (addr_exp, from_tty) if (calling_frame) printf_filtered (" called by frame at %s", - local_hex_string(FRAME_FP (calling_frame))); + local_hex_string((unsigned long) FRAME_FP (calling_frame))); if (fi->next && calling_frame) puts_filtered (","); wrap_here (" "); if (fi->next) printf_filtered (" caller of frame at %s", - local_hex_string (fi->next->frame)); + local_hex_string ((unsigned long) fi->next->frame)); if (fi->next || calling_frame) puts_filtered ("\n"); if (s) @@ -531,7 +521,8 @@ frame_info (addr_exp, from_tty) printf_filtered (" Arglist at unknown address.\n"); else { - printf_filtered (" Arglist at %s,", local_hex_string(arg_list)); + printf_filtered (" Arglist at %s,", + local_hex_string((unsigned long) arg_list)); FRAME_NUM_ARGS (numargs, fi); if (numargs < 0) @@ -553,7 +544,8 @@ frame_info (addr_exp, from_tty) if (arg_list == 0) printf_filtered (" Locals at unknown address,"); else - printf_filtered (" Locals at %s,", local_hex_string(arg_list)); + printf_filtered (" Locals at %s,", + local_hex_string((unsigned long) arg_list)); } #if defined (FRAME_FIND_SAVED_REGS) @@ -561,7 +553,7 @@ frame_info (addr_exp, from_tty) /* The sp is special; what's returned isn't the save address, but actually the value of the previous frame's sp. */ printf_filtered (" Previous frame's sp is %s\n", - local_hex_string(fsr.regs[SP_REGNUM])); + local_hex_string((unsigned long) fsr.regs[SP_REGNUM])); count = 0; for (i = 0; i < NUM_REGS; i++) if (fsr.regs[i] && i != SP_REGNUM) @@ -572,7 +564,7 @@ frame_info (addr_exp, from_tty) puts_filtered (","); wrap_here (" "); printf_filtered (" %s at %s", reg_names[i], - local_hex_string(fsr.regs[i])); + local_hex_string((unsigned long) fsr.regs[i])); count++; } if (count) @@ -767,7 +759,7 @@ print_block_frame_labels (b, have_default, stream) fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream); if (addressprint) fprintf_filtered (stream, " %s", - local_hex_string(SYMBOL_VALUE_ADDRESS (sym))); + local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym))); fprintf_filtered (stream, " in file %s, line %d\n", sal.symtab->filename, sal.line); } @@ -1211,14 +1203,16 @@ return_command (retval_exp, from_tty) selected_frame_addr = FRAME_FP (selected_frame); selected_frame_pc = (get_frame_info (selected_frame))->pc; - /* Compute the return value (if any -- possibly getting errors here). - Call VALUE_CONTENTS to make sure we have fully evaluated it, since - it might live in the stack frame we're about to pop. */ + /* Compute the return value (if any -- possibly getting errors here). */ if (retval_exp) { return_value = parse_and_eval (retval_exp); - VALUE_CONTENTS (return_value); + + /* Make sure we have fully evaluated it, since + it might live in the stack frame we're about to pop. */ + if (VALUE_LAZY (return_value)) + value_fetch_lazy (return_value); } /* If interactive, require confirmation. */ -- cgit v1.1