Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Set stop_pc when TARGET_WAITKIND_NO_HISTORY
@ 2008-10-19 14:21 teawater
  2008-10-19 22:29 ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: teawater @ 2008-10-19 14:21 UTC (permalink / raw)
  To: gdb-patches, Michael Snyder

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

Hi Michael,

I try the 20080930 branch and got:
(gdb) start
Temporary breakpoint 1 at 0x80483c1: file 1.c, line 20.
Starting program: /home/teawater/rec/a.out

Temporary breakpoint 1, main () at 1.c:20
20	       int     b = 0;
(gdb) record
(gdb) n
21	       int     c = 1;
(gdb)
24		printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
a = 0 b = 0 c = 1
25	       b = cool ();
(gdb) rn

No more reverse-execution history.
main () at 1.c:20
20	       int     b = 0;
(gdb) n
Cannot find bounds of current function

This is because:
    case TARGET_WAITKIND_NO_HISTORY:
      /* Reverse execution: target ran out of history info.  */
      print_stop_reason (NO_HISTORY, 0);
      stop_stepping (ecs);
      return;

This place doesn't set stop_pc but in step_1:
		  if (find_pc_partial_function (stop_pc, &name,
						&tp->step_range_start,
						&tp->step_range_end) == 0)
		    error (_("Cannot find bounds of current function"));

So I add code to set stop_pc. I think this bug will affect main tree
too. So this patch is for both 20080930 branch and main tree.

2008-10-19  Hui Zhu  <teawater@gmail.com>

	* infrun.c (handle_inferior_event): Set "stop_pc" when
	TARGET_WAITKIND_NO_HISTORY.

Thanks,
Hui

[-- Attachment #2: set_stop_pc.txt --]
[-- Type: text/plain, Size: 612 bytes --]

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-19  Hui Zhu  <teawater@gmail.com>
+
+	* infrun.c (handle_inferior_event): Set "stop_pc" when
+	TARGET_WAITKIND_NO_HISTORY.
+
 2008-10-18  Pedro Alves  <pedro@codesourcery.com>
 
 	* infrun.c (adjust_pc_after_break): Do nothing if executing in
--- a/infrun.c
+++ b/infrun.c
@@ -2237,6 +2237,7 @@ handle_inferior_event (struct execution_
 
     case TARGET_WAITKIND_NO_HISTORY:
       /* Reverse execution: target ran out of history info.  */
+      stop_pc = read_pc ();
       print_stop_reason (NO_HISTORY, 0);
       stop_stepping (ecs);
       return;

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

* Re: [RFA] Set stop_pc when TARGET_WAITKIND_NO_HISTORY
  2008-10-19 14:21 [RFA] Set stop_pc when TARGET_WAITKIND_NO_HISTORY teawater
@ 2008-10-19 22:29 ` Michael Snyder
  2008-10-20  2:57   ` teawater
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2008-10-19 22:29 UTC (permalink / raw)
  To: teawater; +Cc: gdb-patches


Yes, you're right -- good catch!

Please commit to branch and trunk.

teawater wrote:
> Hi Michael,
> 
> I try the 20080930 branch and got:
> (gdb) start
> Temporary breakpoint 1 at 0x80483c1: file 1.c, line 20.
> Starting program: /home/teawater/rec/a.out
> 
> Temporary breakpoint 1, main () at 1.c:20
> 20             int     b = 0;
> (gdb) record
> (gdb) n
> 21             int     c = 1;
> (gdb)
> 24              printf ("a = %d b = %d c = %d\n", a, b, c);
> (gdb)
> a = 0 b = 0 c = 1
> 25             b = cool ();
> (gdb) rn
> 
> No more reverse-execution history.
> main () at 1.c:20
> 20             int     b = 0;
> (gdb) n
> Cannot find bounds of current function
> 
> This is because:
>     case TARGET_WAITKIND_NO_HISTORY:
>       /* Reverse execution: target ran out of history info.  */
>       print_stop_reason (NO_HISTORY, 0);
>       stop_stepping (ecs);
>       return;
> 
> This place doesn't set stop_pc but in step_1:
>                   if (find_pc_partial_function (stop_pc, &name,
>                                                 &tp->step_range_start,
>                                                 &tp->step_range_end) == 0)
>                     error (_("Cannot find bounds of current function"));
> 
> So I add code to set stop_pc. I think this bug will affect main tree
> too. So this patch is for both 20080930 branch and main tree.
> 
> 2008-10-19  Hui Zhu  <teawater@gmail.com>
> 
>         * infrun.c (handle_inferior_event): Set "stop_pc" when
>         TARGET_WAITKIND_NO_HISTORY.
> 
> Thanks,
> Hui
> 
> 
> ------------------------------------------------------------------------
> 
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2008-10-19  Hui Zhu  <teawater@gmail.com>
> +
> +	* infrun.c (handle_inferior_event): Set "stop_pc" when
> +	TARGET_WAITKIND_NO_HISTORY.
> +
>  2008-10-18  Pedro Alves  <pedro@codesourcery.com>
>  
>  	* infrun.c (adjust_pc_after_break): Do nothing if executing in
> --- a/infrun.c
> +++ b/infrun.c
> @@ -2237,6 +2237,7 @@ handle_inferior_event (struct execution_
>  
>      case TARGET_WAITKIND_NO_HISTORY:
>        /* Reverse execution: target ran out of history info.  */
> +      stop_pc = read_pc ();
>        print_stop_reason (NO_HISTORY, 0);
>        stop_stepping (ecs);
>        return;


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

* Re: [RFA] Set stop_pc when TARGET_WAITKIND_NO_HISTORY
  2008-10-19 22:29 ` Michael Snyder
@ 2008-10-20  2:57   ` teawater
  0 siblings, 0 replies; 3+ messages in thread
From: teawater @ 2008-10-20  2:57 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

Thanks!  I've checked it in.

On Mon, Oct 20, 2008 at 06:24, Michael Snyder <msnyder@vmware.com> wrote:
>
> Yes, you're right -- good catch!
>
> Please commit to branch and trunk.
>
> teawater wrote:
>>
>> Hi Michael,
>>
>> I try the 20080930 branch and got:
>> (gdb) start
>> Temporary breakpoint 1 at 0x80483c1: file 1.c, line 20.
>> Starting program: /home/teawater/rec/a.out
>>
>> Temporary breakpoint 1, main () at 1.c:20
>> 20             int     b = 0;
>> (gdb) record
>> (gdb) n
>> 21             int     c = 1;
>> (gdb)
>> 24              printf ("a = %d b = %d c = %d\n", a, b, c);
>> (gdb)
>> a = 0 b = 0 c = 1
>> 25             b = cool ();
>> (gdb) rn
>>
>> No more reverse-execution history.
>> main () at 1.c:20
>> 20             int     b = 0;
>> (gdb) n
>> Cannot find bounds of current function
>>
>> This is because:
>>    case TARGET_WAITKIND_NO_HISTORY:
>>      /* Reverse execution: target ran out of history info.  */
>>      print_stop_reason (NO_HISTORY, 0);
>>      stop_stepping (ecs);
>>      return;
>>
>> This place doesn't set stop_pc but in step_1:
>>                  if (find_pc_partial_function (stop_pc, &name,
>>                                                &tp->step_range_start,
>>                                                &tp->step_range_end) == 0)
>>                    error (_("Cannot find bounds of current function"));
>>
>> So I add code to set stop_pc. I think this bug will affect main tree
>> too. So this patch is for both 20080930 branch and main tree.
>>
>> 2008-10-19  Hui Zhu  <teawater@gmail.com>
>>
>>        * infrun.c (handle_inferior_event): Set "stop_pc" when
>>        TARGET_WAITKIND_NO_HISTORY.
>>
>> Thanks,
>> Hui
>>
>>
>> ------------------------------------------------------------------------
>>
>> --- a/ChangeLog
>> +++ b/ChangeLog
>> @@ -1,3 +1,8 @@
>> +2008-10-19  Hui Zhu  <teawater@gmail.com>
>> +
>> +       * infrun.c (handle_inferior_event): Set "stop_pc" when
>> +       TARGET_WAITKIND_NO_HISTORY.
>> +
>>  2008-10-18  Pedro Alves  <pedro@codesourcery.com>
>>          * infrun.c (adjust_pc_after_break): Do nothing if executing in
>> --- a/infrun.c
>> +++ b/infrun.c
>> @@ -2237,6 +2237,7 @@ handle_inferior_event (struct execution_
>>       case TARGET_WAITKIND_NO_HISTORY:
>>       /* Reverse execution: target ran out of history info.  */
>> +      stop_pc = read_pc ();
>>       print_stop_reason (NO_HISTORY, 0);
>>       stop_stepping (ecs);
>>       return;
>
>


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

end of thread, other threads:[~2008-10-20  2:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-19 14:21 [RFA] Set stop_pc when TARGET_WAITKIND_NO_HISTORY teawater
2008-10-19 22:29 ` Michael Snyder
2008-10-20  2:57   ` teawater

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