Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Patch to fix "reverse-step" command error
@ 2009-03-02  6:10 teawater
  2009-05-06  5:31 ` Hui Zhu
  0 siblings, 1 reply; 10+ messages in thread
From: teawater @ 2009-03-02  6:10 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches, Marc Khouzam

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

Hi Michael,

This patch is for bug in
http://sourceware.org/ml/gdb-patches/2009-02/msg00246.html.

The reason of bug is when inferior reverse exection into dynsym
resolve code, gdb doesn't insert breakpoint in right address.
It just happen in some distributions for example SLED.

This patch make gdb insert breakpoint in right address or step in that case.

2008-03-02  Hui Zhu  <teawater@gmail.com>

       * infrun.c (handle_inferior_event): Make inferior insert
       breakpoint at right address or step in reverse and it stepped
       into dynsym resolve code.

Thanks,
Hui

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

---
 infrun.c |   31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

--- a/infrun.c
+++ b/infrun.c
@@ -3412,13 +3412,34 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 
       if (pc_after_resolver)
 	{
-	  /* Set up a step-resume breakpoint at the address
-	     indicated by SKIP_SOLIB_RESOLVER.  */
 	  struct symtab_and_line sr_sal;
-	  init_sal (&sr_sal);
-	  sr_sal.pc = pc_after_resolver;
+	  if (execution_direction == EXEC_REVERSE)
+	    {
+	      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
+	    {
+	      /* Set up a step-resume breakpoint at the address
+	         indicated by SKIP_SOLIB_RESOLVER.  */
+	      init_sal (&sr_sal);
+	      sr_sal.pc = pc_after_resolver;
 
-	  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	      insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	    }
 	}
 
       keep_going (ecs);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFA] Patch to fix "reverse-step" command error
  2009-03-02  6:10 [RFA] Patch to fix "reverse-step" command error teawater
@ 2009-05-06  5:31 ` Hui Zhu
  2009-05-06  8:13   ` Hui Zhu
  0 siblings, 1 reply; 10+ messages in thread
From: Hui Zhu @ 2009-05-06  5:31 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: gdb-patches, Michael Snyder

Hi Marc,

I cannot reproduce this issue with cvs-head.
Could you please help me test with this issue?
If both of us cannot reproduce this issue,  I think I can give up this patch.

Thanks,
Hui


On Mon, Mar 2, 2009 at 14:10, teawater <teawater@gmail.com> wrote:
> Hi Michael,
>
> This patch is for bug in
> http://sourceware.org/ml/gdb-patches/2009-02/msg00246.html.
>
> The reason of bug is when inferior reverse exection into dynsym
> resolve code, gdb doesn't insert breakpoint in right address.
> It just happen in some distributions for example SLED.
>
> This patch make gdb insert breakpoint in right address or step in that case.
>
> 2008-03-02  Hui Zhu  <teawater@gmail.com>
>
>       * infrun.c (handle_inferior_event): Make inferior insert
>       breakpoint at right address or step in reverse and it stepped
>       into dynsym resolve code.
>
> Thanks,
> Hui
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFA] Patch to fix "reverse-step" command error
  2009-05-06  5:31 ` Hui Zhu
@ 2009-05-06  8:13   ` Hui Zhu
  2009-05-11  7:07     ` Hui Zhu
  0 siblings, 1 reply; 10+ messages in thread
From: Hui Zhu @ 2009-05-06  8:13 UTC (permalink / raw)
  To: Marc Khouzam, Michael Snyder; +Cc: gdb-patches

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

Hi Marc and Michael,

Sorry I forget this issue just reproduce in SLED 10.

I reproduced it with cvs-head and patch can fix it.  Michael, 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 insert
       breakpoint at right address or step in reverse and it stepped
       into dynsym resolve code.

Thanks,
Hui

On Wed, May 6, 2009 at 13:31, Hui Zhu <teawater@gmail.com> wrote:
> Hi Marc,
>
> I cannot reproduce this issue with cvs-head.
> Could you please help me test with this issue?
> If both of us cannot reproduce this issue,  I think I can give up this patch.
>
> Thanks,
> Hui
>
>
> On Mon, Mar 2, 2009 at 14:10, teawater <teawater@gmail.com> wrote:
>> Hi Michael,
>>
>> This patch is for bug in
>> http://sourceware.org/ml/gdb-patches/2009-02/msg00246.html.
>>
>> The reason of bug is when inferior reverse exection into dynsym
>> resolve code, gdb doesn't insert breakpoint in right address.
>> It just happen in some distributions for example SLED.
>>
>> This patch make gdb insert breakpoint in right address or step in that case.
>>
>> 2008-03-02  Hui Zhu  <teawater@gmail.com>
>>
>>       * infrun.c (handle_inferior_event): Make inferior insert
>>       breakpoint at right address or step in reverse and it stepped
>>       into dynsym resolve code.
>>
>> Thanks,
>> Hui
>>
>

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

---
 infrun.c |   31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

--- a/infrun.c
+++ b/infrun.c
@@ -3465,13 +3465,34 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 
       if (pc_after_resolver)
 	{
-	  /* Set up a step-resume breakpoint at the address
-	     indicated by SKIP_SOLIB_RESOLVER.  */
 	  struct symtab_and_line sr_sal;
-	  init_sal (&sr_sal);
-	  sr_sal.pc = pc_after_resolver;
+	  if (execution_direction == EXEC_REVERSE)
+	    {
+	      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
+	    {
+	      /* Set up a step-resume breakpoint at the address
+	         indicated by SKIP_SOLIB_RESOLVER.  */
+	      init_sal (&sr_sal);
+	      sr_sal.pc = pc_after_resolver;
 
-	  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	      insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	    }
 	}
 
       keep_going (ecs);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFA] Patch to fix "reverse-step" command error
  2009-05-06  8:13   ` Hui Zhu
@ 2009-05-11  7:07     ` Hui Zhu
  2009-06-09  2:18       ` Hui Zhu
  0 siblings, 1 reply; 10+ messages in thread
From: Hui Zhu @ 2009-05-11  7:07 UTC (permalink / raw)
  To: Marc Khouzam, Michael Snyder; +Cc: gdb-patches

PING

On Wed, May 6, 2009 at 16:13, Hui Zhu <teawater@gmail.com> wrote:
> Hi Marc and Michael,
>
> Sorry I forget this issue just reproduce in SLED 10.
>
> I reproduced it with cvs-head and patch can fix it.  Michael, 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 insert
>       breakpoint at right address or step in reverse and it stepped
>       into dynsym resolve code.
>
> Thanks,
> Hui
>
> On Wed, May 6, 2009 at 13:31, Hui Zhu <teawater@gmail.com> wrote:
>> Hi Marc,
>>
>> I cannot reproduce this issue with cvs-head.
>> Could you please help me test with this issue?
>> If both of us cannot reproduce this issue,  I think I can give up this patch.
>>
>> Thanks,
>> Hui
>>
>>
>> On Mon, Mar 2, 2009 at 14:10, teawater <teawater@gmail.com> wrote:
>>> Hi Michael,
>>>
>>> This patch is for bug in
>>> http://sourceware.org/ml/gdb-patches/2009-02/msg00246.html.
>>>
>>> The reason of bug is when inferior reverse exection into dynsym
>>> resolve code, gdb doesn't insert breakpoint in right address.
>>> It just happen in some distributions for example SLED.
>>>
>>> This patch make gdb insert breakpoint in right address or step in that case.
>>>
>>> 2008-03-02  Hui Zhu  <teawater@gmail.com>
>>>
>>>       * infrun.c (handle_inferior_event): Make inferior insert
>>>       breakpoint at right address or step in reverse and it stepped
>>>       into dynsym resolve code.
>>>
>>> Thanks,
>>> Hui
>>>
>>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFA] Patch to fix "reverse-step" command error
  2009-05-11  7:07     ` Hui Zhu
@ 2009-06-09  2:18       ` Hui Zhu
  2009-06-21 23:12         ` Michael Snyder
  0 siblings, 1 reply; 10+ messages in thread
From: Hui Zhu @ 2009-06-09  2:18 UTC (permalink / raw)
  To: Marc Khouzam, Michael Snyder; +Cc: gdb-patches

PING

On Mon, May 11, 2009 at 15:07, Hui Zhu<teawater@gmail.com> wrote:
> PING
>
> On Wed, May 6, 2009 at 16:13, Hui Zhu <teawater@gmail.com> wrote:
>> Hi Marc and Michael,
>>
>> Sorry I forget this issue just reproduce in SLED 10.
>>
>> I reproduced it with cvs-head and patch can fix it.  Michael, 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 insert
>>       breakpoint at right address or step in reverse and it stepped
>>       into dynsym resolve code.
>>
>> Thanks,
>> Hui
>>
>> On Wed, May 6, 2009 at 13:31, Hui Zhu <teawater@gmail.com> wrote:
>>> Hi Marc,
>>>
>>> I cannot reproduce this issue with cvs-head.
>>> Could you please help me test with this issue?
>>> If both of us cannot reproduce this issue,  I think I can give up this patch.
>>>
>>> Thanks,
>>> Hui
>>>
>>>
>>> On Mon, Mar 2, 2009 at 14:10, teawater <teawater@gmail.com> wrote:
>>>> Hi Michael,
>>>>
>>>> This patch is for bug in
>>>> http://sourceware.org/ml/gdb-patches/2009-02/msg00246.html.
>>>>
>>>> The reason of bug is when inferior reverse exection into dynsym
>>>> resolve code, gdb doesn't insert breakpoint in right address.
>>>> It just happen in some distributions for example SLED.
>>>>
>>>> This patch make gdb insert breakpoint in right address or step in that case.
>>>>
>>>> 2008-03-02  Hui Zhu  <teawater@gmail.com>
>>>>
>>>>       * infrun.c (handle_inferior_event): Make inferior insert
>>>>       breakpoint at right address or step in reverse and it stepped
>>>>       into dynsym resolve code.
>>>>
>>>> Thanks,
>>>> Hui
>>>>
>>>
>>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFA] Patch to fix "reverse-step" command error
  2009-06-09  2:18       ` Hui Zhu
@ 2009-06-21 23:12         ` Michael Snyder
  2009-06-22  1:52           ` Marc Khouzam
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Snyder @ 2009-06-21 23:12 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Marc Khouzam, gdb-patches

Hui Zhu wrote:
> PING

Hui, Marc, I just posted a new patch that should replace this one.
Please review http://sourceware.org/ml/gdb-patches/2009-06/msg00551.html

Thanks,
Michael


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [RFA] Patch to fix "reverse-step" command error
  2009-06-21 23:12         ` Michael Snyder
@ 2009-06-22  1:52           ` Marc Khouzam
  2009-06-22  2:18             ` Hui Zhu
  2009-06-22  3:46             ` Michael Snyder
  0 siblings, 2 replies; 10+ messages in thread
From: Marc Khouzam @ 2009-06-22  1:52 UTC (permalink / raw)
  To: Michael Snyder, Hui Zhu; +Cc: gdb-patches

> -----Original Message-----
> From: Michael Snyder [mailto:msnyder@vmware.com] 
> Sent: June-21-09 7:12 PM
> To: Hui Zhu
> Cc: Marc Khouzam; gdb-patches@sourceware.org
> Subject: Re: [RFA] Patch to fix "reverse-step" command error
> 
> Hui Zhu wrote:
> > PING
> 
> Hui, Marc, I just posted a new patch that should replace this one.
> Please review 
> http://sourceware.org/ml/gdb-patches/2009-06/msg00551.html

Thanks for that.

I don't have my SLED right now, which is where I could see the
problem.  I may be able to get my hands on one the week after next.
If Hui hasn't been able to test this until that time, then 
I will give it a try myself.

Thanks again.


> 
> Thanks,
> Michael
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFA] Patch to fix "reverse-step" command error
  2009-06-22  1:52           ` Marc Khouzam
@ 2009-06-22  2:18             ` Hui Zhu
  2009-06-22  3:46             ` Michael Snyder
  1 sibling, 0 replies; 10+ messages in thread
From: Hui Zhu @ 2009-06-22  2:18 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Michael Snyder, gdb-patches

On Mon, Jun 22, 2009 at 09:51, Marc Khouzam<marc.khouzam@ericsson.com> wrote:
>> -----Original Message-----
>> From: Michael Snyder [mailto:msnyder@vmware.com]
>> Sent: June-21-09 7:12 PM
>> To: Hui Zhu
>> Cc: Marc Khouzam; gdb-patches@sourceware.org
>> Subject: Re: [RFA] Patch to fix "reverse-step" command error
>>
>> Hui Zhu wrote:
>> > PING
>>
>> Hui, Marc, I just posted a new patch that should replace this one.
>> Please review
>> http://sourceware.org/ml/gdb-patches/2009-06/msg00551.html
>
> Thanks for that.
>
> I don't have my SLED right now, which is where I could see the
> problem.  I may be able to get my hands on one the week after next.
> If Hui hasn't been able to test this until that time, then
> I will give it a try myself.
>
> Thanks again.
>
Don't warry about it, Marc.  I keep SLED 10 in virtualbox.
I will try this patch in SLED 10.

Thanks,
Hui


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFA] Patch to fix "reverse-step" command error
  2009-06-22  1:52           ` Marc Khouzam
  2009-06-22  2:18             ` Hui Zhu
@ 2009-06-22  3:46             ` Michael Snyder
  1 sibling, 0 replies; 10+ messages in thread
From: Michael Snyder @ 2009-06-22  3:46 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Hui Zhu, gdb-patches

Marc Khouzam wrote:
>> -----Original Message-----
>> From: Michael Snyder [mailto:msnyder@vmware.com] 
>> Sent: June-21-09 7:12 PM
>> To: Hui Zhu
>> Cc: Marc Khouzam; gdb-patches@sourceware.org
>> Subject: Re: [RFA] Patch to fix "reverse-step" command error
>>
>> Hui Zhu wrote:
>>> PING
>> Hui, Marc, I just posted a new patch that should replace this one.
>> Please review 
>> http://sourceware.org/ml/gdb-patches/2009-06/msg00551.html
> 
> Thanks for that.
> 
> I don't have my SLED right now, which is where I could see the
> problem.  I may be able to get my hands on one the week after next.
> If Hui hasn't been able to test this until that time, then 
> I will give it a try myself.

By the way, I was able to see the mis-behavior on RHEL4.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RFA] Patch to fix "reverse-step" command error
@ 2009-03-02  6:06 teawater
  0 siblings, 0 replies; 10+ messages in thread
From: teawater @ 2009-03-02  6:06 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Marc Khouzam, gdb-patches

Hi Michael,

This patch is for bug in
http://sourceware.org/ml/gdb-patches/2009-02/msg00246.html.

The reason of bug is when inferior reverse exection into dynsym
resolve code, gdb doesn't insert breakpoint in right address.
It just happen in some distributions for example SLED.

This patch make gdb insert breakpoint in right address or step in that case.

2008-03-02  Hui Zhu  <teawater@gmail.com>

	* infrun.c (handle_inferior_event): Make inferior insert
	breakpoint at right address or step in reverse and it stepped
	into dynsym resolve code.

Thanks,
Hui


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-06-22  3:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-02  6:10 [RFA] Patch to fix "reverse-step" command error teawater
2009-05-06  5:31 ` Hui Zhu
2009-05-06  8:13   ` Hui Zhu
2009-05-11  7:07     ` Hui Zhu
2009-06-09  2:18       ` Hui Zhu
2009-06-21 23:12         ` Michael Snyder
2009-06-22  1:52           ` Marc Khouzam
2009-06-22  2:18             ` Hui Zhu
2009-06-22  3:46             ` Michael Snyder
  -- strict thread matches above, loose matches on Subject: below --
2009-03-02  6:06 teawater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox