]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 17 Sep 2012 07:14:56 +0000 (07:14 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 17 Sep 2012 07:14:56 +0000 (07:14 +0000)
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.

gdb/ChangeLog
gdb/infrun.c
gdb/testsuite/ChangeLog

index 75f71fbb35461003602d0e34091bb7cbbaef89d3..d59d2428215b3a953d47b8e3304fcfe8b46db2ef 100644 (file)
@@ -1,3 +1,12 @@
+2012-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
+           Pedro Alves  <palves@redhat.com>
+
+       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  <dje@google.com>
 
        * main.c (print_gdb_help): Remove reference to
index 11f981f9f2f3fe4be1b65ccf61f48cd6af1d0a25..d443ae7e0bff9ce9bf6a3003f43be64181848a8d 100644 (file)
@@ -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
index de5e3af86e5516fea06b09a99441281e790a399b..6e193af8ade4a6fe912984a4edcd1045b965082b 100644 (file)
@@ -1,3 +1,12 @@
+2012-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       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  <jan.kratochvil@redhat.com>
 
        * gdb.base/valgrind-infcall.exp: Remove comment about Ubuntu.