Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [PRecord] Memory gets set even if users responds 'n' to query
       [not found] <6D19CA8D71C89C43A057926FE0D4ADAA07C00000@ecamlmw720.eamcs.ericsson.se>
@ 2009-07-21  3:38 ` Hui Zhu
  2009-07-21  8:23   ` Marc Khouzam
  0 siblings, 1 reply; 3+ messages in thread
From: Hui Zhu @ 2009-07-21  3:38 UTC (permalink / raw)
  To: Marc Khouzam, Michael Snyder; +Cc: gdb-patches ml

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

On Tue, Jul 21, 2009 at 10:15, Marc Khouzam<marc.khouzam@ericsson.com> wrote:
> Hi,
>
> while looking into the query stuff we have been discussing I ran into
> the weird behavior where PRecord sets memory even if I answer 'n' to the
> query.  I've done a little troubleshooting and it seems that the query
> code is not the problem.  So, I thought that maybe even though PRecord
> returns
> from its method right away when I say 'n' to the query, the memory
> has already been changed.  Could that be?  I didn't investigate further.
>
> Also, I didn't try it with changing registers.
>
> I'm pretty sure it used to work properly.
>
> Thanks
>
> Marc
>
> Here is the session:
>
> GNU gdb (GDB) 6.8.50.20090720-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       int main() {
> 2           int a = 1;
> 3           int b = 10;
> 4
> 5           a++;
> 6           b++;
> 7
> 8           return a;
> 9       }
> 10
> (gdb) start
> Temporary breakpoint 1 at 0x80483f5: file b.cc, line 2.
> Starting program: /home/marc/testing/a.out
> re
> Temporary breakpoint 1, main () at b.cc:2
> 2           int a = 1;
> (gdb) record
> (gdb) n
> 3           int b = 10;
> (gdb) n
> 5           a++;
> (gdb) n
> 6           b++;
> (gdb) n
> 8           return a;
> (gdb) rn
> 6           b++;
> (gdb) p a
> $1 = 2
> (gdb) set var a = 8
> Because GDB is in replay mode, writing to memory will make the execution
> log unusable from this point onward.  Write memory at address
> 0xbffff6b0?(y or [n]) n
> (gdb) p a
> $2 = 8
> (gdb)
>
>

Thanks Marc.

This issue is because when user answer n, function record_xfer_partial
return -1 will not really cancel the memory change operation.
I make a patch to change it to error.

And I have check the code about register, it works OK.  Because it
already use error.

Please help me review it.

Thanks,
Hui

2009-07-21  Hui Zhu  <teawater@gmail.com>
	* record.c (record_xfer_partial): Call error When nquery
	return "n".
---
 record.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/record.c
+++ b/record.c
@@ -997,7 +997,7 @@ record_xfer_partial (struct target_ops *
 		         "will make the execution log unusable from this "
 		         "point onward.  Write memory at address %s?"),
 		       paddress (target_gdbarch, offset)))
-	    return -1;
+	    error (_("Process record canceled the operation."));

 	  /* Destroy the record from here forward.  */
 	  record_list_release_next ();

[-- Attachment #2: reverse-fix-change-memory.txt --]
[-- Type: text/plain, Size: 490 bytes --]

---
 record.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/record.c
+++ b/record.c
@@ -997,7 +997,7 @@ record_xfer_partial (struct target_ops *
 		         "will make the execution log unusable from this "
 		         "point onward.  Write memory at address %s?"),
 		       paddress (target_gdbarch, offset)))
-	    return -1;
+	    error (_("Process record canceled the operation."));
 
 	  /* Destroy the record from here forward.  */
 	  record_list_release_next ();

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

* RE: [PRecord] Memory gets set even if users responds 'n' to query
  2009-07-21  3:38 ` [PRecord] Memory gets set even if users responds 'n' to query Hui Zhu
@ 2009-07-21  8:23   ` Marc Khouzam
  2009-07-22  8:55     ` Hui Zhu
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Khouzam @ 2009-07-21  8:23 UTC (permalink / raw)
  To: Hui Zhu, Michael Snyder; +Cc: gdb-patches ml

> -----Original Message-----
> From: Hui Zhu [mailto:teawater@gmail.com] 
> Sent: July-20-09 11:19 PM
> To: Marc Khouzam; Michael Snyder
> Cc: gdb-patches ml
> Subject: Re: [PRecord] Memory gets set even if users responds 
> 'n' to query
> 
> Thanks Marc.
> 
> This issue is because when user answer n, function record_xfer_partial
> return -1 will not really cancel the memory change operation.
> I make a patch to change it to error.
> 
> And I have check the code about register, it works OK.  Because it
> already use error.
> 
> Please help me review it.

Thanks Hui, I have tested your fix and it works for me.

marc


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

* Re: [PRecord] Memory gets set even if users responds 'n' to query
  2009-07-21  8:23   ` Marc Khouzam
@ 2009-07-22  8:55     ` Hui Zhu
  0 siblings, 0 replies; 3+ messages in thread
From: Hui Zhu @ 2009-07-22  8:55 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: Michael Snyder, gdb-patches ml

Checked in.

Thanks,
Hui

On Tue, Jul 21, 2009 at 11:38, Marc Khouzam<marc.khouzam@ericsson.com> wrote:
>> -----Original Message-----
>> From: Hui Zhu [mailto:teawater@gmail.com]
>> Sent: July-20-09 11:19 PM
>> To: Marc Khouzam; Michael Snyder
>> Cc: gdb-patches ml
>> Subject: Re: [PRecord] Memory gets set even if users responds
>> 'n' to query
>>
>> Thanks Marc.
>>
>> This issue is because when user answer n, function record_xfer_partial
>> return -1 will not really cancel the memory change operation.
>> I make a patch to change it to error.
>>
>> And I have check the code about register, it works OK.  Because it
>> already use error.
>>
>> Please help me review it.
>
> Thanks Hui, I have tested your fix and it works for me.
>
> marc
>


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

end of thread, other threads:[~2009-07-22  5:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <6D19CA8D71C89C43A057926FE0D4ADAA07C00000@ecamlmw720.eamcs.ericsson.se>
2009-07-21  3:38 ` [PRecord] Memory gets set even if users responds 'n' to query Hui Zhu
2009-07-21  8:23   ` Marc Khouzam
2009-07-22  8:55     ` Hui Zhu

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