X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fi386-darwin-nat.c;h=e57b12693f029b4606e3056e04b295d098a93543;hb=10b2ded43caa3298cded1df8b620caaaee3f9209;hp=5acba7cd25a7fe5fa67043e7c740e6b3599e8ac3;hpb=32d0add0a654c1204ab71dc8a55d9374538c4b33;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c index 5acba7cd25..e57b12693f 100644 --- a/gdb/i386-darwin-nat.c +++ b/gdb/i386-darwin-nat.c @@ -1,5 +1,5 @@ /* Darwin support for GDB, the GNU debugger. - Copyright (C) 1997-2015 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. Contributed by Apple Computer, Inc. @@ -43,16 +43,25 @@ #include "amd64-darwin-tdep.h" #endif +struct i386_darwin_nat_target final : public x86_nat_target +{ + /* Add our register access methods. */ + void fetch_registers (struct regcache *, int) override; + void store_registers (struct regcache *, int) override; +}; + +static struct i386_darwin_nat_target darwin_target; + /* Read register values from the inferior process. If REGNO is -1, do this for all registers. Otherwise, REGNO specifies which register (so we can save time). */ -static void -i386_darwin_fetch_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regno) + +void +i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno) { - thread_t current_thread = ptid_get_tid (inferior_ptid); + thread_t current_thread = ptid_get_tid (regcache_get_ptid (regcache)); int fetched = 0; - struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch *gdbarch = regcache->arch (); #ifdef BFD64 if (gdbarch_ptr_bit (gdbarch) == 64) @@ -163,12 +172,12 @@ i386_darwin_fetch_inferior_registers (struct target_ops *ops, If REGNO is -1, do this for all registers. Otherwise, REGNO specifies which register (so we can save time). */ -static void -i386_darwin_store_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regno) +void +i386_darwin_nat_target::store_registers (struct regcache *regcache, + int regno) { - thread_t current_thread = ptid_get_tid (inferior_ptid); - struct gdbarch *gdbarch = get_regcache_arch (regcache); + thread_t current_thread = ptid_get_tid (regcache_get_ptid (regcache)); + struct gdbarch *gdbarch = regcache->arch (); #ifdef BFD64 if (gdbarch_ptr_bit (gdbarch) == 64) @@ -628,7 +637,7 @@ darwin_set_sstep (thread_t thread, int enable) } void -darwin_complete_target (struct target_ops *target) +_initialize_i386_darwin_nat (void) { #ifdef BFD64 amd64_native_gregset64_reg_offset = amd64_darwin_thread_state_reg_offset; @@ -637,8 +646,6 @@ darwin_complete_target (struct target_ops *target) amd64_native_gregset32_num_regs = i386_darwin_thread_state_num_regs; #endif - x86_use_watchpoints (target); - x86_dr_low.set_control = i386_darwin_dr_set_control; x86_dr_low.set_addr = i386_darwin_dr_set_addr; x86_dr_low.get_addr = i386_darwin_dr_get_addr; @@ -652,6 +659,5 @@ darwin_complete_target (struct target_ops *target) x86_set_debug_register_length (4); #endif - target->to_fetch_registers = i386_darwin_fetch_inferior_registers; - target->to_store_registers = i386_darwin_store_inferior_registers; + add_inf_child_target (&darwin_target); }