From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Hui Zhu <teawater@gmail.com>, Michael Snyder <msnyder@vmware.com>
Subject: Re: [RFA] Fix hw watchpoints in process record.
Date: Tue, 24 Nov 2009 01:58:00 -0000 [thread overview]
Message-ID: <200911240158.17986.pedro@codesourcery.com> (raw)
In-Reply-To: <200911221544.30010.pedro@codesourcery.com>
On Sunday 22 November 2009 15:44:29, Pedro Alves wrote:
> We were missing a target_stopped_data_address method in precord
...
> * record.c (record_beneath_to_stopped_by_watchpoint)
> (record_beneath_to_stopped_data_address, record_hw_watchpoint):
> New globals.
...
> (record_stopped_by_watchpoint): New.
> (record_stopped_data_address): New.
> (init_record_ops): Install them.
> (init_record_core_ops): Ditto.
"Them", yeah right... I actually managed to forget to
install record_stopped_data_address in the version I committed.
> @@ -1594,6 +1657,7 @@ init_record_ops (void)
> record_ops.to_xfer_partial = record_xfer_partial;
> record_ops.to_insert_breakpoint = record_insert_breakpoint;
> record_ops.to_remove_breakpoint = record_remove_breakpoint;
> + record_ops.to_stopped_by_watchpoint = record_stopped_by_watchpoint;
> record_ops.to_can_execute_reverse = record_can_execute_reverse;
> record_ops.to_stratum = record_stratum;
> /* Add bookmark target methods. */
> @@ -1801,6 +1865,7 @@ init_record_core_ops (void)
> record_core_ops.to_xfer_partial = record_core_xfer_partial;
> record_core_ops.to_insert_breakpoint = record_core_insert_breakpoint;
> record_core_ops.to_remove_breakpoint = record_core_remove_breakpoint;
> + record_core_ops.to_stopped_by_watchpoint = record_stopped_by_watchpoint;
> record_core_ops.to_can_execute_reverse = record_can_execute_reverse;
> record_core_ops.to_has_execution = record_core_has_execution;
> record_core_ops.to_stratum = record_stratum;
...
I've applied the patch below to fix it.
Without this, if the target beneath supports reporting the
stopped data address, there's a case where record can miss
a watchpoint. That is the case of stopping recording when
stopped at a watchpoint, and then continue/step backwards
until a different watchpoint triggers. The stopp_data_address
of the target beneath is called by mistake, and that may
reports the wrong stopped_data_address, from the last time
the target really ran. E.g., on x86_64-linux :
>./gdb -q ./gdb
(top-gdb) start
Temporary breakpoint 3 at 0x454727: file ../../src/gdb/gdb.c, line 28.
Starting program: /home/pedro/gdb/baseline/build/gdb/gdb
[Thread debugging using libthread_db enabled]
Temporary breakpoint 3, main (argc=1, argv=0x7fffffffe3a8) at ../../src/gdb/gdb.c:28
28 memset (&args, 0, sizeof args);
(top-gdb) record
(top-gdb) watch args.argv
Hardware watchpoint 4: args.argv
(top-gdb) c
Continuing.
Hardware watchpoint 4: args.argv
Old value = (char **) 0x0
New value = (char **) 0x7fffffffe3a8
main (argc=1, argv=0x7fffffffe3a8) at ../../src/gdb/gdb.c:31
31 args.use_windows = 0;
(top-gdb) del
Delete all breakpoints? (y or n) y
(top-gdb) watch args.argc
Hardware watchpoint 5: args.argc
(top-gdb) reverse-continue
Continuing.
No more reverse-execution history.
main (argc=1, argv=0x7fffffffe3a8) at ../../src/gdb/gdb.c:28
28 memset (&args, 0, sizeof args);
(top-gdb)
It should have triggered a watchpoint. With the
patch applied, the last reverse-continue does this instead:
(top-gdb) reverse-continue
Continuing.
Hardware watchpoint 5: args.argc
Old value = 1
New value = 0
0x000000000045473d in main (argc=1, argv=0x7fffffffe3a8) at ../../src/gdb/gdb.c:29
29 args.argc = argc;
(top-gdb)
which is correct.
This deserves a testcase, but I haven't written it yet. Will do
(unless someone else wants to, which I'd appreciate :-) ).
--
Pedro Alves
2009-11-24 Pedro Alves <pedro@codesourcery.com>
* record.c (init_record_ops, init_record_core_ops): Actually
install record_stopped_data_address.
---
gdb/record.c | 2 ++
1 file changed, 2 insertions(+)
Index: src/gdb/record.c
===================================================================
--- src.orig/gdb/record.c 2009-11-24 01:36:42.000000000 +0000
+++ src/gdb/record.c 2009-11-24 01:37:01.000000000 +0000
@@ -1668,6 +1668,7 @@ init_record_ops (void)
record_ops.to_insert_breakpoint = record_insert_breakpoint;
record_ops.to_remove_breakpoint = record_remove_breakpoint;
record_ops.to_stopped_by_watchpoint = record_stopped_by_watchpoint;
+ record_ops.to_stopped_data_address = record_stopped_data_address;
record_ops.to_can_execute_reverse = record_can_execute_reverse;
record_ops.to_stratum = record_stratum;
/* Add bookmark target methods. */
@@ -1876,6 +1877,7 @@ init_record_core_ops (void)
record_core_ops.to_insert_breakpoint = record_core_insert_breakpoint;
record_core_ops.to_remove_breakpoint = record_core_remove_breakpoint;
record_core_ops.to_stopped_by_watchpoint = record_stopped_by_watchpoint;
+ record_core_ops.to_stopped_data_address = record_stopped_data_address;
record_core_ops.to_can_execute_reverse = record_can_execute_reverse;
record_core_ops.to_has_execution = record_core_has_execution;
record_core_ops.to_stratum = record_stratum;
next prev parent reply other threads:[~2009-11-24 1:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-01 1:23 Michael Snyder
2009-11-04 3:01 ` Hui Zhu
2009-11-04 17:51 ` Michael Snyder
2009-11-05 1:41 ` Hui Zhu
2009-11-05 18:41 ` Michael Snyder
2009-11-05 19:09 ` Pedro Alves
2009-11-12 0:27 ` Pedro Alves
2009-11-20 18:11 ` Michael Snyder
2009-11-21 9:41 ` Hui Zhu
2009-11-21 12:05 ` Pedro Alves
2009-11-21 19:50 ` Michael Snyder
2009-11-22 2:11 ` Hui Zhu
2009-11-22 12:56 ` Pedro Alves
2009-11-22 15:45 ` Pedro Alves
2009-11-22 19:22 ` Eli Zaretskii
2009-11-24 1:58 ` Pedro Alves [this message]
2009-11-26 2:28 ` Hui Zhu
2009-11-22 15:50 ` Pedro Alves
2009-11-22 20:21 ` Michael Snyder
2009-11-22 23:03 ` Pedro Alves
2009-11-23 3:17 ` Hui Zhu
2009-11-09 3:18 ` Hui Zhu
2009-11-09 21:20 ` Michael Snyder
2009-11-10 7:39 ` Hui Zhu
2009-11-09 17:48 ` Tom Tromey
2009-11-10 23:32 ` Michael Snyder
2009-11-11 8:49 ` Hui Zhu
2009-11-12 0:05 ` Pedro Alves
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=200911240158.17986.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.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