diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-01-24 13:49:58 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-01-24 13:49:58 +0000 |
commit | d0d8b0c6675218bed37125a99c9fedb12f9c1265 (patch) | |
tree | d0f620269b49c6eb5182c4cf12bd24c9dc65e5ba /gdb/i386-nat.c | |
parent | 4403d8e9b35649c5b24f65c0ec0decc3839e1164 (diff) | |
download | gdb-d0d8b0c6675218bed37125a99c9fedb12f9c1265.zip gdb-d0d8b0c6675218bed37125a99c9fedb12f9c1265.tar.gz gdb-d0d8b0c6675218bed37125a99c9fedb12f9c1265.tar.bz2 |
gdb/
Fix watchpoints to be specific for each inferior.
* breakpoint.c (watchpoint_in_thread_scope): Verify also
current_program_space.
* i386-nat.c (i386_inferior_data_cleanup): New.
(i386_inferior_data_get): Replace variable inf_data_local by an
inferior_data call.
(i386_use_watchpoints): Initialize i386_inferior_data.
* linux-nat.c (linux_nat_iterate_watchpoint_lwps): Use INFERIOR_PTID
specific iterate_over_lwps.
gdb/testsuite/
Fix watchpoints to be specific for each inferior.
* gdb.multi/watchpoint-multi.c: New file.
* gdb.multi/watchpoint-multi.exp: New file.
Diffstat (limited to 'gdb/i386-nat.c')
-rw-r--r-- | gdb/i386-nat.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index e52de1e..753de67 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -181,16 +181,31 @@ struct i386_inferior_data struct i386_debug_reg_state state; }; +/* Per-inferior hook for register_inferior_data_with_cleanup. */ + +static void +i386_inferior_data_cleanup (struct inferior *inf, void *arg) +{ + struct i386_inferior_data *inf_data = arg; + + xfree (inf_data); +} + /* Get data specific for INFERIOR_PTID LWP. Return special data area for processes being detached. */ static struct i386_inferior_data * i386_inferior_data_get (void) { - /* Intermediate patch stub. */ - static struct i386_inferior_data inf_data_local; struct inferior *inf = current_inferior (); - struct i386_inferior_data *inf_data = &inf_data_local; + struct i386_inferior_data *inf_data; + + inf_data = inferior_data (inf, i386_inferior_data); + if (inf_data == NULL) + { + inf_data = xzalloc (sizeof (*inf_data)); + set_inferior_data (current_inferior (), i386_inferior_data, inf_data); + } if (inf->pid != ptid_get_pid (inferior_ptid)) { @@ -855,6 +870,10 @@ i386_use_watchpoints (struct target_ops *t) t->to_remove_watchpoint = i386_remove_watchpoint; t->to_insert_hw_breakpoint = i386_insert_hw_breakpoint; t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint; + + if (i386_inferior_data == NULL) + i386_inferior_data + = register_inferior_data_with_cleanup (i386_inferior_data_cleanup); } void |