From: Jan Kratochvil Date: Mon, 17 Sep 2012 07:14:56 +0000 (+0000) Subject: gdb/ X-Git-Tag: gdb_7_5_1-2012-11-29-release~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0204109285182a53576ab4d19272651b3791613;p=thirdparty%2Fbinutils-gdb.git gdb/ PR 14548 * infrun.c (handle_inferior_event): Do not reverse-continue back to the function start if we are already at function start. Both for reverse-next and for reverse-step into function without line number info. gdb/testsuite/ PR 14548 * gdb.reverse/singlejmp-reverse-nodebug.S: New file. * gdb.reverse/singlejmp-reverse-nodebug.c: New file. * gdb.reverse/singlejmp-reverse.S: New file. * gdb.reverse/singlejmp-reverse.c: New file. * gdb.reverse/singlejmp-reverse.exp: New file. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 75f71fbb354..d59d2428215 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2012-09-17 Jan Kratochvil + Pedro Alves + + PR 14548 + * infrun.c (handle_inferior_event): Do not reverse-continue back to the + function start if we are already at function start. Both for + reverse-next and for reverse-step into function without line number + info. + 2012-08-29 Doug Evans * main.c (print_gdb_help): Remove reference to diff --git a/gdb/infrun.c b/gdb/infrun.c index 11f981f9f2f..d443ae7e0bf 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4896,14 +4896,22 @@ process_event_stop_test: if (execution_direction == EXEC_REVERSE) { - struct symtab_and_line sr_sal; - - /* Normal function call return (static or dynamic). */ - init_sal (&sr_sal); - sr_sal.pc = ecs->stop_func_start; - sr_sal.pspace = get_frame_program_space (frame); - insert_step_resume_breakpoint_at_sal (gdbarch, - sr_sal, null_frame_id); + /* If we're already at the start of the function, we've either + just stepped backward into a single instruction function, + or stepped back out of a signal handler to the first instruction + of the function. Just keep going, which will single-step back + to the caller. */ + if (ecs->stop_func_start != stop_pc) + { + struct symtab_and_line sr_sal; + + /* Normal function call return (static or dynamic). */ + init_sal (&sr_sal); + sr_sal.pc = ecs->stop_func_start; + sr_sal.pspace = get_frame_program_space (frame); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); + } } else insert_step_resume_breakpoint_at_caller (frame); @@ -4973,15 +4981,23 @@ process_event_stop_test: if (execution_direction == EXEC_REVERSE) { - /* Set a breakpoint at callee's start address. - From there we can step once and be back in the caller. */ - struct symtab_and_line sr_sal; + /* If we're already at the start of the function, we've either just + stepped backward into a single instruction function without line + number info, or stepped back out of a signal handler to the first + instruction of the function without line number info. Just keep + going, which will single-step back to the caller. */ + if (ecs->stop_func_start != stop_pc) + { + /* Set a breakpoint at callee's start address. + From there we can step once and be back in the caller. */ + struct symtab_and_line sr_sal; - init_sal (&sr_sal); - sr_sal.pc = ecs->stop_func_start; - sr_sal.pspace = get_frame_program_space (frame); - insert_step_resume_breakpoint_at_sal (gdbarch, - sr_sal, null_frame_id); + init_sal (&sr_sal); + sr_sal.pc = ecs->stop_func_start; + sr_sal.pspace = get_frame_program_space (frame); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); + } } else /* Set a breakpoint at callee's return address (the address diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index de5e3af86e5..6e193af8ade 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2012-09-17 Jan Kratochvil + + PR 14548 + * gdb.reverse/singlejmp-reverse-nodebug.S: New file. + * gdb.reverse/singlejmp-reverse-nodebug.c: New file. + * gdb.reverse/singlejmp-reverse.S: New file. + * gdb.reverse/singlejmp-reverse.c: New file. + * gdb.reverse/singlejmp-reverse.exp: New file. + 2012-09-13 Jan Kratochvil * gdb.base/valgrind-infcall.exp: Remove comment about Ubuntu.