void darwin_complete_target (struct target_ops *target) { #ifdef BFD64 amd64_native_gregset64_reg_offset = amd64_darwin_thread_state_reg_offset; amd64_native_gregset64_num_regs = amd64_darwin_thread_state_num_regs; amd64_native_gregset32_reg_offset = i386_darwin_thread_state_reg_offset; amd64_native_gregset32_num_regs = i386_darwin_thread_state_num_regs; #endif i386_use_watchpoints (target); i386_dr_low.set_control = i386_darwin_dr_set_control; i386_dr_low.set_addr = i386_darwin_dr_set_addr; i386_dr_low.get_addr = i386_darwin_dr_get_addr; i386_dr_low.get_status = i386_darwin_dr_get_status; i386_dr_low.get_control = i386_darwin_dr_get_control; /* Let's assume that the kernel is 64 bits iff the executable is. */ #ifdef __x86_64__ i386_set_debug_register_length (8); #else i386_set_debug_register_length (4); #endif target->to_fetch_registers = i386_darwin_fetch_inferior_registers; target->to_store_registers = i386_darwin_store_inferior_registers; }
void _initialize_i386_linux_nat (void) { struct target_ops *t; /* Fill in the generic GNU/Linux methods. */ t = linux_target (); i386_use_watchpoints (t); i386_dr_low.set_control = i386_linux_dr_set_control; i386_dr_low.set_addr = i386_linux_dr_set_addr; i386_dr_low.reset_addr = i386_linux_dr_reset_addr; i386_dr_low.get_status = i386_linux_dr_get_status; i386_dr_low.unset_status = i386_linux_dr_unset_status; i386_set_debug_register_length (4); /* Override the default ptrace resume method. */ t->to_resume = i386_linux_resume; /* Override the GNU/Linux inferior startup hook. */ super_post_startup_inferior = t->to_post_startup_inferior; t->to_post_startup_inferior = i386_linux_child_post_startup_inferior; /* Add our register access methods. */ t->to_fetch_registers = i386_linux_fetch_inferior_registers; t->to_store_registers = i386_linux_store_inferior_registers; t->to_read_description = i386_linux_read_description; /* Register the target. */ linux_nat_add_target (t); linux_nat_set_new_thread (t, i386_linux_new_thread); }
void _initialize_amd64_windows_nat (void) { windows_set_context_register_offsets (mappings); windows_set_segment_register_p (amd64_windows_segment_register_p); i386_set_debug_register_length (8); }
void _initialize_amd64fbsd_nat (void) { struct target_ops *t; int offset; amd64_native_gregset32_reg_offset = amd64fbsd32_r_reg_offset; amd64_native_gregset64_reg_offset = amd64fbsd64_r_reg_offset; /* Add some extra features to the common *BSD/i386 target. */ t = amd64bsd_target (); #ifdef HAVE_PT_GETDBREGS i386_use_watchpoints (t); i386_dr_low.set_control = amd64bsd_dr_set_control; i386_dr_low.set_addr = amd64bsd_dr_set_addr; i386_dr_low.get_addr = amd64bsd_dr_get_addr; i386_dr_low.get_status = amd64bsd_dr_get_status; i386_dr_low.get_control = amd64bsd_dr_get_control; i386_set_debug_register_length (8); #endif /* HAVE_PT_GETDBREGS */ t->to_pid_to_exec_file = fbsd_pid_to_exec_file; t->to_find_memory_regions = fbsd_find_memory_regions; t->to_make_corefile_notes = fbsd_make_corefile_notes; add_target (t); /* Support debugging kernel virtual memory images. */ bsd_kvm_add_target (amd64fbsd_supply_pcb); /* To support the recognition of signal handlers, i386bsd-tdep.c hardcodes some constants. Inclusion of this file means that we are compiling a native debugger, which means that we can use the system header files and sysctl(3) to get at the relevant information. */ #define SC_REG_OFFSET amd64fbsd_sc_reg_offset /* We only check the program counter, stack pointer and frame pointer since these members of `struct sigcontext' are essential for providing backtraces. */ #define SC_RIP_OFFSET SC_REG_OFFSET[AMD64_RIP_REGNUM] #define SC_RSP_OFFSET SC_REG_OFFSET[AMD64_RSP_REGNUM] #define SC_RBP_OFFSET SC_REG_OFFSET[AMD64_RBP_REGNUM] /* Override the default value for the offset of the program counter in the sigcontext structure. */ offset = offsetof (struct sigcontext, sc_rip); if (SC_RIP_OFFSET != offset) { warning (_("\ offsetof (struct sigcontext, sc_rip) yields %d instead of %d.\n\ Please report this to <*****@*****.**>."), offset, SC_RIP_OFFSET); }
void _initialize_i386fbsd_nat (void) { struct target_ops *t; /* Add some extra features to the common *BSD/i386 target. */ t = i386bsd_target (); #ifdef HAVE_PT_GETDBREGS i386_use_watchpoints (t); i386_dr_low.set_control = i386bsd_dr_set_control; i386_dr_low.set_addr = i386bsd_dr_set_addr; i386_dr_low.get_addr = i386bsd_dr_get_addr; i386_dr_low.get_status = i386bsd_dr_get_status; i386_dr_low.get_control = i386bsd_dr_get_control; i386_set_debug_register_length (4); #endif /* HAVE_PT_GETDBREGS */ t->to_resume = i386fbsd_resume; t->to_pid_to_exec_file = fbsd_pid_to_exec_file; t->to_find_memory_regions = fbsd_find_memory_regions; t->to_make_corefile_notes = fbsd_make_corefile_notes; add_target (t); /* Support debugging kernel virtual memory images. */ bsd_kvm_add_target (i386fbsd_supply_pcb); /* FreeBSD provides a kern.ps_strings sysctl that we can use to locate the sigtramp. That way we can still recognize a sigtramp if its location is changed in a new kernel. Of course this is still based on the assumption that the sigtramp is placed directly under the location where the program arguments and environment can be found. */ #ifdef KERN_PS_STRINGS { int mib[2]; u_long ps_strings; size_t len; mib[0] = CTL_KERN; mib[1] = KERN_PS_STRINGS; len = sizeof (ps_strings); if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0) { i386fbsd_sigtramp_start_addr = ps_strings - 128; i386fbsd_sigtramp_end_addr = ps_strings; } } #endif }
void _initialize_amd64_linux_nat (void) { struct target_ops *t; amd64_native_gregset32_reg_offset = amd64_linux_gregset32_reg_offset; amd64_native_gregset32_num_regs = I386_LINUX_NUM_REGS; amd64_native_gregset64_reg_offset = amd64_linux_gregset_reg_offset; amd64_native_gregset64_num_regs = AMD64_LINUX_NUM_REGS; gdb_assert (ARRAY_SIZE (amd64_linux_gregset32_reg_offset) == amd64_native_gregset32_num_regs); /* Fill in the generic GNU/Linux methods. */ t = linux_target (); i386_use_watchpoints (t); i386_dr_low.set_control = amd64_linux_dr_set_control; i386_dr_low.set_addr = amd64_linux_dr_set_addr; i386_dr_low.get_addr = amd64_linux_dr_get_addr; i386_dr_low.get_status = amd64_linux_dr_get_status; i386_dr_low.get_control = amd64_linux_dr_get_control; i386_set_debug_register_length (8); /* Override the GNU/Linux inferior startup hook. */ super_post_startup_inferior = t->to_post_startup_inferior; t->to_post_startup_inferior = amd64_linux_child_post_startup_inferior; /* Add our register access methods. */ t->to_fetch_registers = amd64_linux_fetch_inferior_registers; t->to_store_registers = amd64_linux_store_inferior_registers; t->to_read_description = amd64_linux_read_description; /* Register the target. */ linux_nat_add_target (t); linux_nat_set_new_thread (t, amd64_linux_new_thread); linux_nat_set_siginfo_fixup (t, amd64_linux_siginfo_fixup); linux_nat_set_prepare_to_resume (t, amd64_linux_prepare_to_resume); }
void _initialize_i386_windows_nat (void) { windows_set_context_register_offsets (mappings); i386_set_debug_register_length (4); }