mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-02-07 09:48:28 +00:00
Make hardware breakpoints work for process repord.
* record.c (record_wait): Only adjust PC on software breakpoints hits.
This commit is contained in:
parent
9093389c0f
commit
a9840291c6
@ -1,3 +1,10 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2009-11-22 Pedro Alves <pedro@codesourcery.com>
|
2009-11-22 Pedro Alves <pedro@codesourcery.com>
|
||||||
Michael Snyder <msnyder@vmware.com>
|
Michael Snyder <msnyder@vmware.com>
|
||||||
|
|
||||||
|
54
gdb/record.c
54
gdb/record.c
@ -1097,6 +1097,7 @@ record_wait (struct target_ops *ops,
|
|||||||
&& status->value.sig == TARGET_SIGNAL_TRAP)
|
&& status->value.sig == TARGET_SIGNAL_TRAP)
|
||||||
{
|
{
|
||||||
struct regcache *regcache;
|
struct regcache *regcache;
|
||||||
|
struct address_space *aspace;
|
||||||
|
|
||||||
/* Yes -- this is likely our single-step finishing,
|
/* Yes -- this is likely our single-step finishing,
|
||||||
but check if there's any reason the core would be
|
but check if there's any reason the core would be
|
||||||
@ -1105,22 +1106,25 @@ record_wait (struct target_ops *ops,
|
|||||||
registers_changed ();
|
registers_changed ();
|
||||||
regcache = get_current_regcache ();
|
regcache = get_current_regcache ();
|
||||||
tmp_pc = regcache_read_pc (regcache);
|
tmp_pc = regcache_read_pc (regcache);
|
||||||
|
aspace = get_regcache_aspace (regcache);
|
||||||
|
|
||||||
if (target_stopped_by_watchpoint ())
|
if (target_stopped_by_watchpoint ())
|
||||||
{
|
{
|
||||||
/* Always interested in watchpoints. */
|
/* Always interested in watchpoints. */
|
||||||
}
|
}
|
||||||
else if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
|
else if (breakpoint_inserted_here_p (aspace, tmp_pc))
|
||||||
tmp_pc))
|
|
||||||
{
|
{
|
||||||
/* There is a breakpoint here. Let the core
|
/* There is a breakpoint here. Let the core
|
||||||
handle it. */
|
handle it. */
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
if (software_breakpoint_inserted_here_p (aspace, tmp_pc))
|
||||||
CORE_ADDR decr_pc_after_break
|
{
|
||||||
= gdbarch_decr_pc_after_break (gdbarch);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
if (decr_pc_after_break)
|
CORE_ADDR decr_pc_after_break
|
||||||
regcache_write_pc (regcache,
|
= gdbarch_decr_pc_after_break (gdbarch);
|
||||||
tmp_pc + decr_pc_after_break);
|
if (decr_pc_after_break)
|
||||||
|
regcache_write_pc (regcache,
|
||||||
|
tmp_pc + decr_pc_after_break);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1147,6 +1151,7 @@ record_wait (struct target_ops *ops,
|
|||||||
{
|
{
|
||||||
struct regcache *regcache = get_current_regcache ();
|
struct regcache *regcache = get_current_regcache ();
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
struct address_space *aspace = get_regcache_aspace (regcache);
|
||||||
int continue_flag = 1;
|
int continue_flag = 1;
|
||||||
int first_record_end = 1;
|
int first_record_end = 1;
|
||||||
struct cleanup *old_cleanups = make_cleanup (record_wait_cleanups, 0);
|
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)
|
if (execution_direction == EXEC_FORWARD)
|
||||||
{
|
{
|
||||||
tmp_pc = regcache_read_pc (regcache);
|
tmp_pc = regcache_read_pc (regcache);
|
||||||
if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
|
if (breakpoint_inserted_here_p (aspace, tmp_pc))
|
||||||
tmp_pc))
|
|
||||||
{
|
{
|
||||||
|
int decr_pc_after_break = gdbarch_decr_pc_after_break (gdbarch);
|
||||||
|
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: break at %s.\n",
|
"Process record: break at %s.\n",
|
||||||
paddress (gdbarch, tmp_pc));
|
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,
|
regcache_write_pc (regcache,
|
||||||
tmp_pc +
|
tmp_pc + decr_pc_after_break);
|
||||||
gdbarch_decr_pc_after_break (gdbarch));
|
|
||||||
goto replay_out;
|
goto replay_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1240,28 +1247,31 @@ record_wait (struct target_ops *ops,
|
|||||||
|
|
||||||
/* check breakpoint */
|
/* check breakpoint */
|
||||||
tmp_pc = regcache_read_pc (regcache);
|
tmp_pc = regcache_read_pc (regcache);
|
||||||
if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
|
if (breakpoint_inserted_here_p (aspace, tmp_pc))
|
||||||
tmp_pc))
|
|
||||||
{
|
{
|
||||||
|
int decr_pc_after_break
|
||||||
|
= gdbarch_decr_pc_after_break (gdbarch);
|
||||||
|
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: break "
|
"Process record: break "
|
||||||
"at %s.\n",
|
"at %s.\n",
|
||||||
paddress (gdbarch, tmp_pc));
|
paddress (gdbarch, tmp_pc));
|
||||||
if (gdbarch_decr_pc_after_break (gdbarch)
|
if (decr_pc_after_break
|
||||||
&& execution_direction == EXEC_FORWARD
|
&& execution_direction == EXEC_FORWARD
|
||||||
&& !record_resume_step)
|
&& !record_resume_step
|
||||||
|
&& software_breakpoint_inserted_here_p (aspace,
|
||||||
|
tmp_pc))
|
||||||
regcache_write_pc (regcache,
|
regcache_write_pc (regcache,
|
||||||
tmp_pc +
|
tmp_pc + decr_pc_after_break);
|
||||||
gdbarch_decr_pc_after_break (gdbarch));
|
|
||||||
continue_flag = 0;
|
continue_flag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record_hw_watchpoint)
|
if (record_hw_watchpoint)
|
||||||
{
|
{
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog, "\
|
||||||
"Process record: hit hw watchpoint.\n");
|
Process record: hit hw watchpoint.\n");
|
||||||
continue_flag = 0;
|
continue_flag = 0;
|
||||||
}
|
}
|
||||||
/* Check target signal */
|
/* Check target signal */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user