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: Sun, 22 Nov 2009 15:50:00 -0000 [thread overview]
Message-ID: <200911221549.37239.pedro@codesourcery.com> (raw)
In-Reply-To: <200911221255.25826.pedro@codesourcery.com>
On Sunday 22 November 2009 12:55:25, Pedro Alves wrote:
> Fixing hardware breakpoints is a different and unrelated
> issue.
>
> Actually, the problem you're seeing sounds simple: The
> breakpoint is set at 0x40055b, but GDB shows the SIGTRAP trigger
> at 0x40055c. Off by one, that is. Completelly untested,
> but I bet that something like this fixes it:
>
> record_wait:
> if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
> tmp_pc))
> {
> /* There is a breakpoint. GDB will want to stop. */
> + if (software_breakpoint_inserted_here_p (get_regcache_aspace (regcache),
> + tmp_pc))
>
> struct gdbarch *gdbarch = get_regcache_arch (regcache);
> CORE_ADDR decr_pc_after_break
> = gdbarch_decr_pc_after_break (gdbarch);
> if (decr_pc_after_break)
> regcache_write_pc (regcache,
> tmp_pc + decr_pc_after_break);
> + }
> }
>
As in the patch below. Applied.
--
Pedro Alves
2009-11-22 Pedro Alves <pedro@codesourcery.com>
Make hardware breakpoints work for process repord.
* record.c (record_wait): Only adjust PC on software breakpoints
hits.
---
gdb/record.c | 54 ++++++++++++++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 22 deletions(-)
Index: src/gdb/record.c
===================================================================
--- src.orig/gdb/record.c 2009-11-22 15:36:49.000000000 +0000
+++ src/gdb/record.c 2009-11-22 15:39:10.000000000 +0000
@@ -1097,6 +1097,7 @@ record_wait (struct target_ops *ops,
&& status->value.sig == TARGET_SIGNAL_TRAP)
{
struct regcache *regcache;
+ struct address_space *aspace;
/* Yes -- this is likely our single-step finishing,
but check if there's any reason the core would be
@@ -1105,22 +1106,25 @@ record_wait (struct target_ops *ops,
registers_changed ();
regcache = get_current_regcache ();
tmp_pc = regcache_read_pc (regcache);
+ aspace = get_regcache_aspace (regcache);
if (target_stopped_by_watchpoint ())
{
/* Always interested in watchpoints. */
}
- else if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
- tmp_pc))
+ else if (breakpoint_inserted_here_p (aspace, tmp_pc))
{
/* There is a breakpoint here. Let the core
handle it. */
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- CORE_ADDR decr_pc_after_break
- = gdbarch_decr_pc_after_break (gdbarch);
- if (decr_pc_after_break)
- regcache_write_pc (regcache,
- tmp_pc + decr_pc_after_break);
+ if (software_breakpoint_inserted_here_p (aspace, tmp_pc))
+ {
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ CORE_ADDR decr_pc_after_break
+ = gdbarch_decr_pc_after_break (gdbarch);
+ if (decr_pc_after_break)
+ regcache_write_pc (regcache,
+ tmp_pc + decr_pc_after_break);
+ }
}
else
{
@@ -1147,6 +1151,7 @@ record_wait (struct target_ops *ops,
{
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct address_space *aspace = get_regcache_aspace (regcache);
int continue_flag = 1;
int first_record_end = 1;
struct cleanup *old_cleanups = make_cleanup (record_wait_cleanups, 0);
@@ -1159,18 +1164,20 @@ record_wait (struct target_ops *ops,
if (execution_direction == EXEC_FORWARD)
{
tmp_pc = regcache_read_pc (regcache);
- if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
- tmp_pc))
+ if (breakpoint_inserted_here_p (aspace, tmp_pc))
{
+ int decr_pc_after_break = gdbarch_decr_pc_after_break (gdbarch);
+
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
"Process record: break at %s.\n",
paddress (gdbarch, tmp_pc));
- if (gdbarch_decr_pc_after_break (gdbarch)
- && !record_resume_step)
+
+ if (decr_pc_after_break
+ && !record_resume_step
+ && software_breakpoint_inserted_here_p (aspace, tmp_pc))
regcache_write_pc (regcache,
- tmp_pc +
- gdbarch_decr_pc_after_break (gdbarch));
+ tmp_pc + decr_pc_after_break);
goto replay_out;
}
}
@@ -1240,28 +1247,31 @@ record_wait (struct target_ops *ops,
/* check breakpoint */
tmp_pc = regcache_read_pc (regcache);
- if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
- tmp_pc))
+ if (breakpoint_inserted_here_p (aspace, tmp_pc))
{
+ int decr_pc_after_break
+ = gdbarch_decr_pc_after_break (gdbarch);
+
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
"Process record: break "
"at %s.\n",
paddress (gdbarch, tmp_pc));
- if (gdbarch_decr_pc_after_break (gdbarch)
+ if (decr_pc_after_break
&& execution_direction == EXEC_FORWARD
- && !record_resume_step)
+ && !record_resume_step
+ && software_breakpoint_inserted_here_p (aspace,
+ tmp_pc))
regcache_write_pc (regcache,
- tmp_pc +
- gdbarch_decr_pc_after_break (gdbarch));
+ tmp_pc + decr_pc_after_break);
continue_flag = 0;
}
if (record_hw_watchpoint)
{
if (record_debug)
- fprintf_unfiltered (gdb_stdlog,
- "Process record: hit hw watchpoint.\n");
+ fprintf_unfiltered (gdb_stdlog, "\
+Process record: hit hw watchpoint.\n");
continue_flag = 0;
}
/* Check target signal */
next prev parent reply other threads:[~2009-11-22 15:50 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
2009-11-26 2:28 ` Hui Zhu
2009-11-22 15:50 ` Pedro Alves [this message]
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=200911221549.37239.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