X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fi386-darwin-nat.c;h=e57b12693f029b4606e3056e04b295d098a93543;hb=10b2ded43caa3298cded1df8b620caaaee3f9209;hp=08a706b85829fe4155d524cfd0a7de0bc223793c;hpb=ac7936dfd0c85e5de2dfec45ca0dbf72baeffa51;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c index 08a706b858..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-2017 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. Contributed by Apple Computer, Inc. @@ -43,12 +43,21 @@ #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 (regcache_get_ptid (regcache)); int fetched = 0; @@ -163,9 +172,9 @@ 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 (regcache_get_ptid (regcache)); struct gdbarch *gdbarch = regcache->arch (); @@ -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); }