Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Marc Khouzam <marc.khouzam@ericsson.com>,
	  "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Patch to fix "reverse-next" command error
Date: Mon, 15 Jun 2009 02:45:00 -0000	[thread overview]
Message-ID: <4A35B5CD.1030004@vmware.com> (raw)
In-Reply-To: <daef60380906081918r2eaf63f9l3702055a76bb5b45@mail.gmail.com>

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

Hui Zhu wrote:
> Ping.

Hui, I rewrote your patch a little bit.  I think we can use
gdbarch_skip_trampoline_code to detect the fact that we have
stepped into a trampoline (ie. "plt").  This is more general.

Mark, please tell me if this patch fixes your original problem,
and Hui, please tell me if the patch is OK with you.

Michael


> On Mon, May 11, 2009 at 15:07, Hui Zhu<teawater@gmail.com> wrote:
>> PING
>>
>> On Wed, May 6, 2009 at 14:00, Hui Zhu <teawater@gmail.com> wrote:
>>> Hi Michael,
>>>
>>> I try this issue with cvs-head.  It still affect cvs-head.
>>> And I try the patch, it can fix this issue.  It's time close to 7.0
>>> branch.  So could you please help me review it?
>>>
>>> The attachment is the new patch follow cvs-head.
>>>
>>> 2009-05-06  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.
>>>
>>> Thanks,
>>> Hui
>>>
>>> On Thu, Jan 22, 2009 at 17:00, teawater <teawater@gmail.com> wrote:
>>>> 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: reverse-next.txt --]
[-- Type: text/plain, Size: 2176 bytes --]

2009-06-14  Hui Zhu  <teawater@gmail.com>
	    Michael Snyder  <msnyder@vmware.com>

	* infrun.c (handle_inferior_event): Reverse-next through trampoline.

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.387
diff -u -p -r1.387 infrun.c
--- infrun.c	11 Jun 2009 11:57:46 -0000	1.387
+++ infrun.c	15 Jun 2009 02:39:51 -0000
@@ -3623,9 +3623,17 @@ infrun: not switching back to stepped th
 
      Note that step_range_end is the address of the first instruction
      beyond the step range, and NOT the address of the last instruction
-     within it! */
+     within it!
+
+     Note also that during reverse execution, we may be stepping
+     through a function epilogue and therefore must detect when
+     the current-frame changes in the middle of a line.  */
+
   if (stop_pc >= ecs->event_thread->step_range_start
-      && stop_pc < ecs->event_thread->step_range_end)
+      && stop_pc < ecs->event_thread->step_range_end
+      && (execution_direction != EXEC_REVERSE
+	  || frame_id_eq (get_frame_id (get_current_frame ()),
+			  ecs->event_thread->step_frame_id)))
     {
       if (debug_infrun)
 	fprintf_unfiltered (gdb_stdlog, "infrun: stepping inside range [0x%s-0x%s]\n",
@@ -3762,10 +3770,21 @@ infrun: not switching back to stepped th
 		  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 (gdbarch_skip_trampoline_code(current_gdbarch,
+					       get_current_frame (),
+					       stop_pc))
+		{
+		  /* We are in a function call trampoline.
+		     Keep stepping backward to get to the caller.  */
+		  ecs->event_thread->stepping_over_breakpoint = 1;
+		}
+	      else
+		{
+		  /* Normal function call return (static or dynamic).  */
+		  init_sal (&sr_sal);
+		  sr_sal.pc = ecs->stop_func_start;
+		  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+		}
 	    }
 	  else
 	    insert_step_resume_breakpoint_at_caller (get_current_frame ());

  reply	other threads:[~2009-06-15  2:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-22  9:00 teawater
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 [this message]
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=4A35B5CD.1030004@vmware.com \
    --to=msnyder@vmware.com \
    --cc=gdb-patches@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    --cc=teawater@gmail.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