Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Patch to fix "reverse-next" command error
@ 2009-01-22  9:00 teawater
  2009-01-27 17:15 ` Marc Khouzam
  2009-05-06  6:01 ` Hui Zhu
  0 siblings, 2 replies; 20+ messages in thread
From: teawater @ 2009-01-22  9:00 UTC (permalink / raw)
  To: Michael Snyder, Pedro Alves; +Cc: Marc Khouzam, gdb-patches

[-- 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 ());

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

* RE: [RFA] Patch to fix "reverse-next" command error
  2009-01-22  9:00 [RFA] Patch to fix "reverse-next" command error teawater
@ 2009-01-27 17:15 ` Marc Khouzam
  2009-01-27 23:31   ` Marc Khouzam
  2009-05-06  6:01 ` Hui Zhu
  1 sibling, 1 reply; 20+ messages in thread
From: Marc Khouzam @ 2009-01-27 17:15 UTC (permalink / raw)
  To: teawater, Michael Snyder, Pedro Alves; +Cc: gdb-patches

Hi,
 
just to confirm that this fixes the problem for me.
 
Thanks teawater
 
Marc

________________________________

From: teawater [mailto:teawater@gmail.com]
Sent: Thu 1/22/2009 4:00 AM
To: Michael Snyder; Pedro Alves
Cc: Marc Khouzam; gdb-patches@sourceware.org
Subject: [RFA] Patch to fix "reverse-next" command error



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



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

* RE: [RFA] Patch to fix "reverse-next" command error
  2009-01-27 17:15 ` Marc Khouzam
@ 2009-01-27 23:31   ` Marc Khouzam
  2009-01-30 16:25     ` teawater
  0 siblings, 1 reply; 20+ messages in thread
From: Marc Khouzam @ 2009-01-27 23:31 UTC (permalink / raw)
  To: Marc Khouzam, teawater, Michael Snyder, Pedro Alves; +Cc: gdb-patches

Hi again,

I just noticed I still have the problem of jumping library functions
when using reverse-step.  Seems ok for reverse-next.

Thanks

Marc

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org 
> [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Marc Khouzam
> Sent: Tuesday, January 27, 2009 5:38 AM
> To: teawater; Michael Snyder; Pedro Alves
> Cc: gdb-patches@sourceware.org
> Subject: RE: [RFA] Patch to fix "reverse-next" command error
> 
> Hi,
>  
> just to confirm that this fixes the problem for me.
>  
> Thanks teawater
>  
> Marc
> 
> ________________________________
> 
> From: teawater [mailto:teawater@gmail.com]
> Sent: Thu 1/22/2009 4:00 AM
> To: Michael Snyder; Pedro Alves
> Cc: Marc Khouzam; gdb-patches@sourceware.org
> Subject: [RFA] Patch to fix "reverse-next" command error
> 
> 
> 
> 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
> 
> 
> 


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-01-27 23:31   ` Marc Khouzam
@ 2009-01-30 16:25     ` teawater
  2009-02-11 19:55       ` Marc Khouzam
  0 siblings, 1 reply; 20+ messages in thread
From: teawater @ 2009-01-30 16:25 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Michael Snyder, Pedro Alves, gdb-patches

Hi Marc,

Could you please send more message about your issue?

Thanks,
Hui

On Wed, Jan 28, 2009 at 04:27, Marc Khouzam <marc.khouzam@ericsson.com> wrote:
> Hi again,
>
> I just noticed I still have the problem of jumping library functions
> when using reverse-step.  Seems ok for reverse-next.
>
> Thanks
>
> Marc
>
>> -----Original Message-----
>> From: gdb-patches-owner@sourceware.org
>> [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Marc Khouzam
>> Sent: Tuesday, January 27, 2009 5:38 AM
>> To: teawater; Michael Snyder; Pedro Alves
>> Cc: gdb-patches@sourceware.org
>> Subject: RE: [RFA] Patch to fix "reverse-next" command error
>>
>> Hi,
>>
>> just to confirm that this fixes the problem for me.
>>
>> Thanks teawater
>>
>> Marc
>>
>> ________________________________
>>
>> From: teawater [mailto:teawater@gmail.com]
>> Sent: Thu 1/22/2009 4:00 AM
>> To: Michael Snyder; Pedro Alves
>> Cc: Marc Khouzam; gdb-patches@sourceware.org
>> Subject: [RFA] Patch to fix "reverse-next" command error
>>
>>
>>
>> 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
>>
>>
>>
>


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

* RE: [RFA] Patch to fix "reverse-next" command error
  2009-01-30 16:25     ` teawater
@ 2009-02-11 19:55       ` Marc Khouzam
  2009-02-12  2:59         ` teawater
  2009-03-02  6:11         ` teawater
  0 siblings, 2 replies; 20+ messages in thread
From: Marc Khouzam @ 2009-02-11 19:55 UTC (permalink / raw)
  To: teawater; +Cc: Michael Snyder, Pedro Alves, gdb-patches

> From: teawater [mailto:teawater@gmail.com] 
> Sent: Thursday, January 29, 2009 11:12 PM
> To: Marc Khouzam
> Cc: Michael Snyder; Pedro Alves; gdb-patches@sourceware.org
> Subject: Re: [RFA] Patch to fix "reverse-next" command error
> 
> Hi Marc,
> 
> Could you please send more message about your issue?
> >
> > I just noticed I still have the problem of jumping library functions
> > when using reverse-step.  Seems ok for reverse-next.
> >

Was this still in my court?  Sorry about that.
Here is how I reproduced the problem:


GNU gdb (GDB) 6.8.50.20090113-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) l
1       #include <stdio.h>
2       int main()
3       {
4           char* cptr = "Thread 1";
5           int b[2] = {5,8};
6           b[0] = 6;   b[1] = 9;
7           printf("Thread 1, loop \n");
8           printf("Thread 2, loop \n");
9           printf("Thread 3, loop \n");
10          return 1;
(gdb) b main
Breakpoint 1 at 0x8048485: file a.cc, line 4.
(gdb) r
Starting program: /local/home/lmckhou/testing/a.out 

Breakpoint 1, main () at a.cc:4
4           char* cptr = "Thread 1";
(gdb) record
(gdb) n
5           int b[2] = {5,8};
(gdb) 
6           b[0] = 6;   b[1] = 9;
(gdb) 
7           printf("Thread 1, loop \n");
(gdb) 
Thread 1, loop 
8           printf("Thread 2, loop \n");
(gdb) 
Thread 2, loop 
9           printf("Thread 3, loop \n");
(gdb) 
Thread 3, loop 
10          return 1;
(gdb) rs
9           printf("Thread 3, loop \n");
(gdb) 
8           printf("Thread 2, loop \n");
(gdb) 

No more reverse-execution history.     <===== What about lines 7, 6, 5?
main () at a.cc:4
4           char* cptr = "Thread 1";


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-02-11 19:55       ` Marc Khouzam
@ 2009-02-12  2:59         ` teawater
  2009-02-13 16:07           ` Marc Khouzam
  2009-03-02  6:11         ` teawater
  1 sibling, 1 reply; 20+ messages in thread
From: teawater @ 2009-02-12  2:59 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Michael Snyder, Pedro Alves, gdb-patches

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

Hi Marc,

I can't reproduce this issue with or without "fix-reverse-plt-error.txt".

(gdb) start
During symbol reading, DW_AT_name missing from DW_TAG_base_type.
Temporary breakpoint 1 at 0x8048385: file 2.c, line 4.
Starting program: /home/teawater/gdb/a.out

Temporary breakpoint 1, main () at 2.c:4
4	char* cptr = "Thread 1";
(gdb) record
(gdb) n
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x8048382.
5	int b[2] = {5,8};
(gdb)
6	b[0] = 6;   b[1] = 9;
(gdb)
7	printf("Thread 1, loop \n");
(gdb)
Thread 1, loop
8	printf("Thread 2, loop \n");
(gdb)
Thread 2, loop
9	printf("Thread 3, loop \n");
(gdb)
Thread 3, loop
10	return 1;
(gdb)
11	}
(gdb) rs
10	return 1;
(gdb)
9	printf("Thread 3, loop \n");
(gdb)
8	printf("Thread 2, loop \n");
(gdb)
7	printf("Thread 1, loop \n");
(gdb)
6	b[0] = 6;   b[1] = 9;
(gdb)
5	int b[2] = {5,8};
(gdb)

No more reverse-execution history.
main () at 2.c:4
4	char* cptr = "Thread 1";
(gdb)

No more reverse-execution history.
main () at 2.c:4
4	char* cptr = "Thread 1";
(gdb)

Could you try it with CVS-head version and new Precord patch in attachment?

Thanks,
Hui



On Thu, Feb 12, 2009 at 03:55, Marc Khouzam <marc.khouzam@ericsson.com> wrote:
>> From: teawater [mailto:teawater@gmail.com]
>> Sent: Thursday, January 29, 2009 11:12 PM
>> To: Marc Khouzam
>> Cc: Michael Snyder; Pedro Alves; gdb-patches@sourceware.org
>> Subject: Re: [RFA] Patch to fix "reverse-next" command error
>>
>> Hi Marc,
>>
>> Could you please send more message about your issue?
>> >
>> > I just noticed I still have the problem of jumping library functions
>> > when using reverse-step.  Seems ok for reverse-next.
>> >
>
> Was this still in my court?  Sorry about that.
> Here is how I reproduced the problem:
>
>
> GNU gdb (GDB) 6.8.50.20090113-cvs
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> (gdb) l
> 1       #include <stdio.h>
> 2       int main()
> 3       {
> 4           char* cptr = "Thread 1";
> 5           int b[2] = {5,8};
> 6           b[0] = 6;   b[1] = 9;
> 7           printf("Thread 1, loop \n");
> 8           printf("Thread 2, loop \n");
> 9           printf("Thread 3, loop \n");
> 10          return 1;
> (gdb) b main
> Breakpoint 1 at 0x8048485: file a.cc, line 4.
> (gdb) r
> Starting program: /local/home/lmckhou/testing/a.out
>
> Breakpoint 1, main () at a.cc:4
> 4           char* cptr = "Thread 1";
> (gdb) record
> (gdb) n
> 5           int b[2] = {5,8};
> (gdb)
> 6           b[0] = 6;   b[1] = 9;
> (gdb)
> 7           printf("Thread 1, loop \n");
> (gdb)
> Thread 1, loop
> 8           printf("Thread 2, loop \n");
> (gdb)
> Thread 2, loop
> 9           printf("Thread 3, loop \n");
> (gdb)
> Thread 3, loop
> 10          return 1;
> (gdb) rs
> 9           printf("Thread 3, loop \n");
> (gdb)
> 8           printf("Thread 2, loop \n");
> (gdb)
>
> No more reverse-execution history.     <===== What about lines 7, 6, 5?
> main () at a.cc:4
> 4           char* cptr = "Thread 1";
>
>

[-- Attachment #2: prec.tar.bz2 --]
[-- Type: application/x-bzip2, Size: 24862 bytes --]

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

* RE: [RFA] Patch to fix "reverse-next" command error
  2009-02-12  2:59         ` teawater
@ 2009-02-13 16:07           ` Marc Khouzam
  2009-02-16 10:26             ` teawater
  0 siblings, 1 reply; 20+ messages in thread
From: Marc Khouzam @ 2009-02-13 16:07 UTC (permalink / raw)
  To: teawater; +Cc: Michael Snyder, Pedro Alves, gdb-patches

> -----Original Message-----
> From: teawater [mailto:teawater@gmail.com] 
> Sent: Wednesday, February 11, 2009 9:59 PM
> To: Marc Khouzam
> Cc: Michael Snyder; Pedro Alves; gdb-patches@sourceware.org
> Subject: Re: [RFA] Patch to fix "reverse-next" command error
> 
> Hi Marc,
> 
> I can't reproduce this issue with or without 
> "fix-reverse-plt-error.txt".
 
> Could you try it with CVS-head version and new Precord patch 
> in attachment?
> 
> Thanks,
> Hui

Thanks for putting all the patches in a single attachement, it was
much easier like that. (there was no patch 4.  Is it not needed
anymore?)

I'm still getting the bug.
I have HEAD from Feb 12th.
 + the Precord patches you sent.
 + fix-reverse-plt-error.txt
 + stopped.diff from Volodya (although it is not needed for this test)

I compile with
g++ (GCC) 4.1.2 20070115 (prerelease) (SUSE Linux)

My linux is (uname -a)
Linux camoc0002 2.6.16.53-0.16-smp #1 SMP Tue Oct 2 16:57:49 UTC 2007
i686 i686 i386 GNU/Linux

Again, here is the output.
Could it be related to my printf library?


GNU gdb (GDB) 6.8.50.20090212-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) l
1       #include <stdio.h>
2       int main()
3       {
4           char* cptr = "Thread 1";
5           int b[2] = {5,8};
6           b[0] = 6;   b[1] = 9;
7           printf("Thread 1, loop \n");
8           printf("Thread 2, loop \n");
9           printf("Thread 3, loop \n");
10          return 1;
(gdb) b main
Breakpoint 1 at 0x8048485: file a.cc, line 4.
(gdb) r
Starting program: /local/home/lmckhou/testing/a.out 

Breakpoint 1, main () at a.cc:4
4           char* cptr = "Thread 1";
(gdb) rec
(gdb) b 10
Breakpoint 2 at 0x80484cc: file a.cc, line 10.
(gdb) c
Continuing.
Thread 1, loop 
Thread 2, loop 
Thread 3, loop 

Breakpoint 2, main () at a.cc:10
10          return 1;
(gdb) rs
9           printf("Thread 3, loop \n");
(gdb) 
8           printf("Thread 2, loop \n");
(gdb) 

No more reverse-execution history.
main () at a.cc:4
4           char* cptr = "Thread 1";


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-02-13 16:07           ` Marc Khouzam
@ 2009-02-16 10:26             ` teawater
  2009-02-16 19:10               ` Marc Khouzam
  0 siblings, 1 reply; 20+ messages in thread
From: teawater @ 2009-02-16 10:26 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Michael Snyder, Pedro Alves, gdb-patches

Hi Marc,

I try it again.  This test is still OK with me.  Could remove
stopped.diff patch and try it again?
Or send me a stopped.diff patch?

Thanks,
Hui

On Fri, Feb 13, 2009 at 23:23, Marc Khouzam <marc.khouzam@ericsson.com> wrote:
>> -----Original Message-----
>> From: teawater [mailto:teawater@gmail.com]
>> Sent: Wednesday, February 11, 2009 9:59 PM
>> To: Marc Khouzam
>> Cc: Michael Snyder; Pedro Alves; gdb-patches@sourceware.org
>> Subject: Re: [RFA] Patch to fix "reverse-next" command error
>>
>> Hi Marc,
>>
>> I can't reproduce this issue with or without
>> "fix-reverse-plt-error.txt".
>
>> Could you try it with CVS-head version and new Precord patch
>> in attachment?
>>
>> Thanks,
>> Hui
>
> Thanks for putting all the patches in a single attachement, it was
> much easier like that. (there was no patch 4.  Is it not needed
> anymore?)
>
> I'm still getting the bug.
> I have HEAD from Feb 12th.
>  + the Precord patches you sent.
>  + fix-reverse-plt-error.txt
>  + stopped.diff from Volodya (although it is not needed for this test)
>
> I compile with
> g++ (GCC) 4.1.2 20070115 (prerelease) (SUSE Linux)
>
> My linux is (uname -a)
> Linux camoc0002 2.6.16.53-0.16-smp #1 SMP Tue Oct 2 16:57:49 UTC 2007
> i686 i686 i386 GNU/Linux
>
> Again, here is the output.
> Could it be related to my printf library?
>
>
> GNU gdb (GDB) 6.8.50.20090212-cvs
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> (gdb) l
> 1       #include <stdio.h>
> 2       int main()
> 3       {
> 4           char* cptr = "Thread 1";
> 5           int b[2] = {5,8};
> 6           b[0] = 6;   b[1] = 9;
> 7           printf("Thread 1, loop \n");
> 8           printf("Thread 2, loop \n");
> 9           printf("Thread 3, loop \n");
> 10          return 1;
> (gdb) b main
> Breakpoint 1 at 0x8048485: file a.cc, line 4.
> (gdb) r
> Starting program: /local/home/lmckhou/testing/a.out
>
> Breakpoint 1, main () at a.cc:4
> 4           char* cptr = "Thread 1";
> (gdb) rec
> (gdb) b 10
> Breakpoint 2 at 0x80484cc: file a.cc, line 10.
> (gdb) c
> Continuing.
> Thread 1, loop
> Thread 2, loop
> Thread 3, loop
>
> Breakpoint 2, main () at a.cc:10
> 10          return 1;
> (gdb) rs
> 9           printf("Thread 3, loop \n");
> (gdb)
> 8           printf("Thread 2, loop \n");
> (gdb)
>
> No more reverse-execution history.
> main () at a.cc:4
> 4           char* cptr = "Thread 1";
>


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

* RE: [RFA] Patch to fix "reverse-next" command error
  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
  0 siblings, 2 replies; 20+ messages in thread
From: Marc Khouzam @ 2009-02-16 19:10 UTC (permalink / raw)
  To: teawater; +Cc: Michael Snyder, Pedro Alves, gdb-patches

 

> -----Original Message-----
> From: teawater [mailto:teawater@gmail.com] 
> Sent: Monday, February 16, 2009 3:57 AM
> To: Marc Khouzam
> Cc: Michael Snyder; Pedro Alves; gdb-patches@sourceware.org
> Subject: Re: [RFA] Patch to fix "reverse-next" command error
> 
> Hi Marc,
> 
> I try it again.  This test is still OK with me.  Could remove
> stopped.diff patch and try it again?
> Or send me a stopped.diff patch?

The stopped.diff patch was just checked in.
You will actually have to update record.c as it no longer
compiles with those new changes (small fix needed.)
 
I updated to today's HEAD and I still get the problem.
How did you turn on those traces to debug the problem?

Thanks

Marc


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-02-16 19:10               ` Marc Khouzam
@ 2009-02-17  3:58                 ` teawater
  2009-02-17 13:10                 ` teawater
  1 sibling, 0 replies; 20+ messages in thread
From: teawater @ 2009-02-17  3:58 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Michael Snyder, Pedro Alves, gdb-patches

The following is what I got:

teawater@pek-hzhu:~/tmp/gdb-6.8.50.20090217/gdb$ quilt applied
patches
1-gdbarch.txt
2-target_record_stratum.txt
3-record_target.txt
5-linux-record.txt
6-infrun.txt
7-i386-tdep.txt
8-i386-linux-tdep.txt
9-precord-doc.txt

teawater@pek-hzhu:~/tmp/gdb-6.8.50.20090217/gdb$ ./gdb ~/gdb/a.out
GNU gdb (GDB) 6.8.50.20090217
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Setting up the environment for debugging gdb.
Function "internal_error" not defined.
Make breakpoint pending on future shared library load? (y or [n])
[answered N; input not from terminal]
Function "info_command" not defined.
Make breakpoint pending on future shared library load? (y or [n])
[answered N; input not from terminal]
/home/teawater/tmp/gdb-6.8.50.20090217/gdb/.gdbinit:8: Error in
sourced command file:
No breakpoint number 0.
(gdb) start
During symbol reading, DW_AT_name missing from DW_TAG_base_type.
Temporary breakpoint 1 at 0x8048465: file 2.c, line 4.
Starting program: /home/teawater/gdb/a.out

Temporary breakpoint 1, main () at 2.c:4
4	char* cptr = "Thread 1";
Current language:  auto; currently c++
(gdb) list
1	#include <stdio.h>
2	int main()
3	{
4	char* cptr = "Thread 1";
5	int b[2] = {5,8};
6	b[0] = 6;   b[1] = 9;
7	printf("Thread 1, loop \n");
8	printf("Thread 2, loop \n");
9	printf("Thread 3, loop \n");
10	return 1;
(gdb) b 10
Breakpoint 2 at 0x80484ac: file 2.c, line 10.
(gdb) record
(gdb) c
Continuing.
Thread 1, loop
Thread 2, loop
Thread 3, loop

Breakpoint 2, main () at 2.c:10
10	return 1;
(gdb) rs
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x8048462.
9	printf("Thread 3, loop \n");
(gdb)
8	printf("Thread 2, loop \n");
(gdb)
7	printf("Thread 1, loop \n");
(gdb)
6	b[0] = 6;   b[1] = 9;
(gdb)
5	int b[2] = {5,8};
(gdb)

No more reverse-execution history.
main () at 2.c:4
4	char* cptr = "Thread 1";
(gdb) quit
The program is running.  Quit anyway (and kill it)? (y or n) y


teawater@pek-hzhu:~/tmp/gdb-6.8.50.20090217/gdb$ quilt applied
patches
1-gdbarch.txt
2-target_record_stratum.txt
3-record_target.txt
5-linux-record.txt
6-infrun.txt
7-i386-tdep.txt
8-i386-linux-tdep.txt
9-precord-doc.txt
fix-reverse-plt-error.txt


teawater@pek-hzhu:~/tmp/gdb-6.8.50.20090217/gdb$ ./gdb ~/gdb/a.out
GNU gdb (GDB) 6.8.50.20090217
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Setting up the environment for debugging gdb.
Function "internal_error" not defined.
Make breakpoint pending on future shared library load? (y or [n])
[answered N; input not from terminal]
Function "info_command" not defined.
Make breakpoint pending on future shared library load? (y or [n])
[answered N; input not from terminal]
/home/teawater/tmp/gdb-6.8.50.20090217/gdb/.gdbinit:8: Error in
sourced command file:
No breakpoint number 0.
(gdb) start
During symbol reading, DW_AT_name missing from DW_TAG_base_type.
Temporary breakpoint 1 at 0x8048465: file 2.c, line 4.
Starting program: /home/teawater/gdb/a.out

Temporary breakpoint 1, main () at 2.c:4
4	char* cptr = "Thread 1";
Current language:  auto; currently c++
(gdb) record
(gdb) b 10
Breakpoint 2 at 0x80484ac: file 2.c, line 10.
(gdb) c
Continuing.
Thread 1, loop
Thread 2, loop
Thread 3, loop

Breakpoint 2, main () at 2.c:10
10	return 1;
(gdb) rs
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x8048462.
9	printf("Thread 3, loop \n");
(gdb)
8	printf("Thread 2, loop \n");
(gdb)
7	printf("Thread 1, loop \n");
(gdb)
6	b[0] = 6;   b[1] = 9;
(gdb)
5	int b[2] = {5,8};
(gdb)

No more reverse-execution history.
main () at 2.c:4
4	char* cptr = "Thread 1";
(gdb) quit
The program is running.  Quit anyway (and kill it)? (y or n) y



On Mon, Feb 16, 2009 at 23:16, Marc Khouzam <marc.khouzam@ericsson.com> wrote:
>
>
>> -----Original Message-----
>> From: teawater [mailto:teawater@gmail.com]
>> Sent: Monday, February 16, 2009 3:57 AM
>> To: Marc Khouzam
>> Cc: Michael Snyder; Pedro Alves; gdb-patches@sourceware.org
>> Subject: Re: [RFA] Patch to fix "reverse-next" command error
>>
>> Hi Marc,
>>
>> I try it again.  This test is still OK with me.  Could remove
>> stopped.diff patch and try it again?
>> Or send me a stopped.diff patch?
>
> The stopped.diff patch was just checked in.
> You will actually have to update record.c as it no longer
> compiles with those new changes (small fix needed.)
>
> I updated to today's HEAD and I still get the problem.
> How did you turn on those traces to debug the problem?
>
> Thanks
>
> Marc
>
>


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-02-16 19:10               ` Marc Khouzam
  2009-02-17  3:58                 ` teawater
@ 2009-02-17 13:10                 ` teawater
  1 sibling, 0 replies; 20+ messages in thread
From: teawater @ 2009-02-17 13:10 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Michael Snyder, Pedro Alves, gdb-patches

Hi Marc,

Could you "wget
ftp://sourceware.org/pub/gdb/snapshots/current/gdb.tar.bz2" and patch
the patch in http://sourceware.org/ml/gdb-patches/2009-02/msg00344.html.


If you still get this issue.
Breakpoint 2, main () at a.cc:10
10          return 1;
(gdb) rs
9           printf("Thread 3, loop \n");
(gdb)
8           printf("Thread 2, loop \n");

#Before the last rs command call command "set debug infrun 1"

(gdb)

No more reverse-execution history.

And post all output to me.  It will help me a lot.  :)


Thanks,
Hui




On Mon, Feb 16, 2009 at 23:16, Marc Khouzam <marc.khouzam@ericsson.com> wrote:
>
>
>> -----Original Message-----
>> From: teawater [mailto:teawater@gmail.com]
>> Sent: Monday, February 16, 2009 3:57 AM
>> To: Marc Khouzam
>> Cc: Michael Snyder; Pedro Alves; gdb-patches@sourceware.org
>> Subject: Re: [RFA] Patch to fix "reverse-next" command error
>>
>> Hi Marc,
>>
>> I try it again.  This test is still OK with me.  Could remove
>> stopped.diff patch and try it again?
>> Or send me a stopped.diff patch?
>
> The stopped.diff patch was just checked in.
> You will actually have to update record.c as it no longer
> compiles with those new changes (small fix needed.)
>
> I updated to today's HEAD and I still get the problem.
> How did you turn on those traces to debug the problem?
>
> Thanks
>
> Marc
>
>


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-02-11 19:55       ` Marc Khouzam
  2009-02-12  2:59         ` teawater
@ 2009-03-02  6:11         ` teawater
  1 sibling, 0 replies; 20+ messages in thread
From: teawater @ 2009-03-02  6:11 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Michael Snyder, Pedro Alves, gdb-patches

http://sourceware.org/ml/gdb-patches/2009-03/msg00005.html

This is the patch for this bug.

Thanks,
Hui

On Thu, Feb 12, 2009 at 03:55, Marc Khouzam <marc.khouzam@ericsson.com> wrote:
>> From: teawater [mailto:teawater@gmail.com]
>> Sent: Thursday, January 29, 2009 11:12 PM
>> To: Marc Khouzam
>> Cc: Michael Snyder; Pedro Alves; gdb-patches@sourceware.org
>> Subject: Re: [RFA] Patch to fix "reverse-next" command error
>>
>> Hi Marc,
>>
>> Could you please send more message about your issue?
>> >
>> > I just noticed I still have the problem of jumping library functions
>> > when using reverse-step.  Seems ok for reverse-next.
>> >
>
> Was this still in my court?  Sorry about that.
> Here is how I reproduced the problem:
>
>
> GNU gdb (GDB) 6.8.50.20090113-cvs
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> (gdb) l
> 1       #include <stdio.h>
> 2       int main()
> 3       {
> 4           char* cptr = "Thread 1";
> 5           int b[2] = {5,8};
> 6           b[0] = 6;   b[1] = 9;
> 7           printf("Thread 1, loop \n");
> 8           printf("Thread 2, loop \n");
> 9           printf("Thread 3, loop \n");
> 10          return 1;
> (gdb) b main
> Breakpoint 1 at 0x8048485: file a.cc, line 4.
> (gdb) r
> Starting program: /local/home/lmckhou/testing/a.out
>
> Breakpoint 1, main () at a.cc:4
> 4           char* cptr = "Thread 1";
> (gdb) record
> (gdb) n
> 5           int b[2] = {5,8};
> (gdb)
> 6           b[0] = 6;   b[1] = 9;
> (gdb)
> 7           printf("Thread 1, loop \n");
> (gdb)
> Thread 1, loop
> 8           printf("Thread 2, loop \n");
> (gdb)
> Thread 2, loop
> 9           printf("Thread 3, loop \n");
> (gdb)
> Thread 3, loop
> 10          return 1;
> (gdb) rs
> 9           printf("Thread 3, loop \n");
> (gdb)
> 8           printf("Thread 2, loop \n");
> (gdb)
>
> No more reverse-execution history.     <===== What about lines 7, 6, 5?
> main () at a.cc:4
> 4           char* cptr = "Thread 1";
>
>


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-01-22  9:00 [RFA] Patch to fix "reverse-next" command error teawater
  2009-01-27 17:15 ` Marc Khouzam
@ 2009-05-06  6:01 ` Hui Zhu
  2009-05-11  7:07   ` Hui Zhu
  1 sibling, 1 reply; 20+ messages in thread
From: Hui Zhu @ 2009-05-06  6:01 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Marc Khouzam, gdb-patches

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

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: fix-reverse-plt-error.txt --]
[-- Type: text/plain, Size: 1069 bytes --]

---
 infrun.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

--- a/infrun.c
+++ b/infrun.c
@@ -3558,10 +3558,21 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 		  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 ());

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

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

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
>>
>


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

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

Ping.

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
>>>
>>
>


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-06-09  2:18     ` Hui Zhu
@ 2009-06-15  2:45       ` Michael Snyder
  2009-06-15  6:47         ` Hui Zhu
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Snyder @ 2009-06-15  2:45 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Marc Khouzam, gdb-patches

[-- 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 ());

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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-06-15  2:45       ` Michael Snyder
@ 2009-06-15  6:47         ` Hui Zhu
  2009-06-15 15:37           ` Marc Khouzam
  0 siblings, 1 reply; 20+ messages in thread
From: Hui Zhu @ 2009-06-15  6:47 UTC (permalink / raw)
  To: Michael Snyder, Marc Khouzam; +Cc: gdb-patches

On Mon, Jun 15, 2009 at 10:45, Michael Snyder<msnyder@vmware.com> wrote:
> 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.
>

This patch is OK with me.

BTW, the patch that you sent include the prev one.


Thanks,
Hui

>> 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
>>>>>
>>
>
>
> 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 ());
>
>


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

* RE: [RFA] Patch to fix "reverse-next" command error
  2009-06-15  6:47         ` Hui Zhu
@ 2009-06-15 15:37           ` Marc Khouzam
  2009-06-15 18:04             ` Michael Snyder
  0 siblings, 1 reply; 20+ messages in thread
From: Marc Khouzam @ 2009-06-15 15:37 UTC (permalink / raw)
  To: Hui Zhu, Michael Snyder; +Cc: gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org 
> [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Hui Zhu
> Sent: June-15-09 2:47 AM
> To: Michael Snyder; Marc Khouzam
> Cc: gdb-patches@sourceware.org
> Subject: Re: [RFA] Patch to fix "reverse-next" command error
> 
> On Mon, Jun 15, 2009 at 10:45, Michael 
> Snyder<msnyder@vmware.com> wrote:
> > 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.
> >
> 
> This patch is OK with me.

I also tested this one and it works great for me as well.

Thanks

> 
> BTW, the patch that you sent include the prev one.
> 
> 
> Thanks,
> Hui
> 
> >> 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
> >>>>>
> >>
> >
> >
> > 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 ());
> >
> >
> 


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-06-15 15:37           ` Marc Khouzam
@ 2009-06-15 18:04             ` Michael Snyder
  2009-06-18 23:56               ` Michael Snyder
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Snyder @ 2009-06-15 18:04 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Hui Zhu, gdb-patches

Marc Khouzam wrote:
>> -----Original Message-----
>> From: gdb-patches-owner@sourceware.org 
>> [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Hui Zhu
>> Sent: June-15-09 2:47 AM
>> To: Michael Snyder; Marc Khouzam
>> Cc: gdb-patches@sourceware.org
>> Subject: Re: [RFA] Patch to fix "reverse-next" command error
>>
>> On Mon, Jun 15, 2009 at 10:45, Michael 
>> Snyder<msnyder@vmware.com> wrote:
>>> 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.
>>>
>> This patch is OK with me.
> 
> I also tested this one and it works great for me as well.
> 
> Thanks

OK, so sounds like this one can go in as well.

Michael


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

* Re: [RFA] Patch to fix "reverse-next" command error
  2009-06-15 18:04             ` Michael Snyder
@ 2009-06-18 23:56               ` Michael Snyder
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Snyder @ 2009-06-18 23:56 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Marc Khouzam, Hui Zhu, gdb-patches

Michael Snyder wrote:
> Marc Khouzam wrote:
>>> -----Original Message-----
>>> From: gdb-patches-owner@sourceware.org 
>>> [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Hui Zhu
>>> Sent: June-15-09 2:47 AM
>>> To: Michael Snyder; Marc Khouzam
>>> Cc: gdb-patches@sourceware.org
>>> Subject: Re: [RFA] Patch to fix "reverse-next" command error
>>>
>>> On Mon, Jun 15, 2009 at 10:45, Michael 
>>> Snyder<msnyder@vmware.com> wrote:
>>>> 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.
>>>>
>>> This patch is OK with me.
>> I also tested this one and it works great for me as well.
>>
>> Thanks
> 
> OK, so sounds like this one can go in as well.

... committed.


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

end of thread, other threads:[~2009-06-18 23:56 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-22  9:00 [RFA] Patch to fix "reverse-next" command error 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
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

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