/* Native-dependent code for the i386.
- Copyright (C) 2001, 2004-2005, 2007-2012 Free Software Foundation,
- Inc.
+ Copyright (C) 2001-2013 Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "i386-nat.h"
#include "defs.h"
+#include "i386-nat.h"
#include "breakpoint.h"
#include "command.h"
#include "gdbcmd.h"
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))
{
const char *func, CORE_ADDR addr,
int len, enum target_hw_bp_type type)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
int i;
puts_unfiltered (func);
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 (NULL, i386_inferior_data_cleanup);
}
void