Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: teawater <teawater@gmail.com>
To: Michael Snyder <msnyder@vmware.com>,
	Pedro Alves <pedro@codesourcery.com>
Cc: Marc Khouzam <marc.khouzam@ericsson.com>,
	 	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [RFA] Patch to fix "reverse-next" command error
Date: Thu, 22 Jan 2009 09:00:00 -0000	[thread overview]
Message-ID: <daef60380901220100v55cd8a28u76dae725f85eca8f@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

Hi guys,

This patch is for bug in http://sourceware.org/ml/gdb/2009-01/msg00146.html

This issue is because sometime the inferior is already in function
start address (i.e. plt), set a breakpoint and continue will make
"reverse-next" work error.

This patch make inferior step if it reverse step and stop at the
function start address.
It tested OK with process record patch and testsuite gdb.twreverse in
branch reverse-20081226-branch.

2009-01-22  Hui Zhu  <teawater@gmail.com>

	* infrun.c (handle_inferior_event): Make inferior step if it
	stepping over a function call in reverse , and stop at the
	start address of the function.

OK for mainline?

Thanks,
Hui

[-- Attachment #2: fix-reverse-plt-error.txt --]
[-- Type: text/plain, Size: 1105 bytes --]

Index: gdb/infrun.c
===================================================================
--- gdb.orig/infrun.c	2009-01-22 14:58:31.000000000 +0800
+++ gdb/infrun.c	2009-01-22 16:26:46.000000000 +0800
@@ -3488,10 +3488,21 @@
 		  keep_going (ecs);
 		  return;
 		}
-	      /* Normal (staticly linked) function call return.  */
-	      init_sal (&sr_sal);
-	      sr_sal.pc = ecs->stop_func_start;
-	      insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	      if (ecs->stop_func_start != stop_pc)
+		{
+		  /* Normal (staticly linked) function call return.  */
+		  init_sal (&sr_sal);
+		  sr_sal.pc = ecs->stop_func_start;
+		  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+		}
+	      else
+		{
+		  /* We are stepping over a function call in reverse, and
+	             stop at the start address of the function.  Go back to
+	             single-stepping, which should take us back to the
+	             function call.  */
+		  ecs->event_thread->stepping_over_breakpoint = 1;
+		}
 	    }
 	  else
 	    insert_step_resume_breakpoint_at_caller (get_current_frame ());

             reply	other threads:[~2009-01-22  9:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-22  9:00 teawater [this message]
2009-01-27 17:15 ` Marc Khouzam
2009-01-27 23:31   ` Marc Khouzam
2009-01-30 16:25     ` teawater
2009-02-11 19:55       ` Marc Khouzam
2009-02-12  2:59         ` teawater
2009-02-13 16:07           ` Marc Khouzam
2009-02-16 10:26             ` teawater
2009-02-16 19:10               ` Marc Khouzam
2009-02-17  3:58                 ` teawater
2009-02-17 13:10                 ` teawater
2009-03-02  6:11         ` teawater
2009-05-06  6:01 ` Hui Zhu
2009-05-11  7:07   ` Hui Zhu
2009-06-09  2:18     ` Hui Zhu
2009-06-15  2:45       ` Michael Snyder
2009-06-15  6:47         ` Hui Zhu
2009-06-15 15:37           ` Marc Khouzam
2009-06-15 18:04             ` Michael Snyder
2009-06-18 23:56               ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=daef60380901220100v55cd8a28u76dae725f85eca8f@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    --cc=msnyder@vmware.com \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox