Ejemplo n.º 1
0
void
_initialize_i386obsd_nat (void)
{
  add_inf_child_target (&i386_obsd_nat_target);

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (i386obsd_supply_pcb);

  /* OpenBSD provides a vm.psstrings 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.  This is especially
     important for OpenBSD, since it uses a different memory layout
     than NetBSD, yet we cannot distinguish between the two.

     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 VM_PSSTRINGS
  {
    struct _ps_strings _ps;
    int mib[2];
    size_t len;

    mib[0] = CTL_VM;
    mib[1] = VM_PSSTRINGS;
    len = sizeof (_ps);
    if (sysctl (mib, 2, &_ps, &len, NULL, 0) == 0)
      {
	i386obsd_sigtramp_start_addr = (u_long) _ps.val - 128;
	i386obsd_sigtramp_end_addr = (u_long) _ps.val;
      }
  }
#endif
}
Ejemplo n.º 2
0
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);
    }
Ejemplo n.º 3
0
void
_initialize_ppcobsd_nat (void)
{
  struct target_ops *t;

  /* Add in local overrides.  */
  t = inf_ptrace_target ();
  t->to_fetch_registers = ppcobsd_fetch_registers;
  t->to_store_registers = ppcobsd_store_registers;
  add_target (t);

  /* General-purpose registers.  */
  ppcobsd_reg_offsets.r0_offset = offsetof (struct reg, gpr);
  ppcobsd_reg_offsets.pc_offset = offsetof (struct reg, pc);
  ppcobsd_reg_offsets.ps_offset = offsetof (struct reg, ps);
  ppcobsd_reg_offsets.cr_offset = offsetof (struct reg, cnd);
  ppcobsd_reg_offsets.lr_offset = offsetof (struct reg, lr);
  ppcobsd_reg_offsets.ctr_offset = offsetof (struct reg, cnt);
  ppcobsd_reg_offsets.xer_offset = offsetof (struct reg, xer);
  ppcobsd_reg_offsets.mq_offset = offsetof (struct reg, mq);

  /* Floating-point registers.  */
  ppcobsd_reg_offsets.f0_offset = offsetof (struct reg, fpr);
  ppcobsd_reg_offsets.fpscr_offset = -1;

  /* AltiVec registers.  */
  ppcobsd_reg_offsets.vr0_offset = offsetof (struct vreg, vreg);
  ppcobsd_reg_offsets.vscr_offset = offsetof (struct vreg, vscr);
  ppcobsd_reg_offsets.vrsave_offset = offsetof (struct vreg, vrsave);

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (ppcobsd_supply_pcb);
}
Ejemplo n.º 4
0
void
_initialize_alphabsd_nat (void)
{
  add_inf_child_target (&the_alpha_bsd_nat_target);

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (alphabsd_supply_pcb);
}
Ejemplo n.º 5
0
void
_initialize_i386nbsd_nat (void)
{
  /* We've got nothing to add to the common *BSD/i386 target.  */
  add_target (i386bsd_target ());

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (i386nbsd_supply_pcb);
}
Ejemplo n.º 6
0
void
_initialize_sparc64fbsd_nat (void)
{
  add_inf_child_target (&the_sparc64_fbsd_nat_target);

  sparc_gregmap = &sparc64fbsd_gregmap;

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);
}
Ejemplo n.º 7
0
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
}
Ejemplo n.º 8
0
void
_initialize_sparcnbsd_nat (void)
{
  sparc_gregmap = &sparc32nbsd_gregmap;
  sparc_fpregmap = &sparc32_bsd_fpregmap;

  /* We've got nothing to add to the generic SPARC target.  */
  add_target (sparc_target ());

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (sparc32nbsd_supply_pcb);
}
void
_initialize_amd64obsd_nat (void)
{
  amd64_native_gregset32_reg_offset = amd64obsd32_r_reg_offset;
  amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64obsd32_r_reg_offset);
  amd64_native_gregset64_reg_offset = amd64obsd_r_reg_offset;

  /* We've got nothing to add to the common *BSD/amd64 target.  */
  add_target (amd64bsd_target ());

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (amd64obsd_supply_pcb);
}
Ejemplo n.º 10
0
void
_initialize_m68kbsd_nat (void)
{
  struct target_ops *t;

  t = inf_ptrace_target ();
  t->to_fetch_registers = m68kbsd_fetch_inferior_registers;
  t->to_store_registers = m68kbsd_store_inferior_registers;
  add_target (t);

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (m68kbsd_supply_pcb);
}
Ejemplo n.º 11
0
void
_initialize_ppcnbsd_nat (void)
{
  struct target_ops *t;

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (ppcnbsd_supply_pcb);

  /* Add in local overrides.  */
  t = inf_ptrace_target ();
  t->to_fetch_registers = ppcnbsd_fetch_inferior_registers;
  t->to_store_registers = ppcnbsd_store_inferior_registers;
  add_target (t);
}
Ejemplo n.º 12
0
void
_initialize_sparc64fbsd_nat (void)
{
  struct target_ops *t;

  /* Add some extra features to the generic SPARC target.  */
  t = sparc_target ();
  fbsd_nat_add_target (t);

  sparc_gregmap = &sparc64fbsd_gregmap;

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);
}
Ejemplo n.º 13
0
void
_initialize_vaxbsd_nat (void)
{
  struct target_ops *t;

  /* Add some extra features to the common *BSD/vax target.  */
  t = inf_ptrace_target ();
  t->to_fetch_registers = vaxbsd_fetch_inferior_registers;
  t->to_store_registers = vaxbsd_store_inferior_registers;
  t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
  add_target (t);

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (vaxbsd_supply_pcb);
}
Ejemplo n.º 14
0
void
_initialize_sparcnbsd_nat (void)
{
  struct target_ops *t;
  sparc_gregmap = &sparc32nbsd_gregmap;
  sparc_fpregmap = &sparc32_bsd_fpregmap;

  /* Add some extra features to the generic SPARC target.  */
  t = sparc_target ();
  t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
  add_target (t);

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (sparc32nbsd_supply_pcb);
}
Ejemplo n.º 15
0
void
_initialize_sparc64nbsd_nat (void)
{
  sparc_supply_gregset = sparc64nbsd_supply_gregset;
  sparc_collect_gregset = sparc64nbsd_collect_gregset;
  sparc_supply_fpregset = sparc64nbsd_supply_fpregset;
  sparc_collect_fpregset = sparc64nbsd_collect_fpregset;
  sparc_gregset_supplies_p = sparc64nbsd_gregset_supplies_p;
  sparc_fpregset_supplies_p = sparc64nbsd_fpregset_supplies_p;

  /* We've got nothing to add to the generic SPARC target.  */
  add_target (sparc_target ());

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (sparc64nbsd_supply_pcb);
}
Ejemplo n.º 16
0
void
_initialize_amd64dfly_nat (void)
{
  struct target_ops *t;
  int offset;

  amd64_native_gregset32_reg_offset = amd64dfly32_r_reg_offset;
  amd64_native_gregset64_reg_offset = amd64dfly64_r_reg_offset;

  /* Add some extra features to the common *BSD/x86 target.  */
  t = amd64bsd_target ();
  t->to_read_description = amd64fbsd_read_description;

  dfly_nat_add_target (t);

#ifdef DFLY_PCB_SUPPLY
  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (amd64dfly_supply_pcb);
#endif

  /* 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 amd64dfly_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_sparc64fbsd_nat (void)
{
  struct target_ops *t;

  /* Add some extra features to the generic SPARC target.  */
  t = sparc_target ();
  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);

  sparc_gregset = &sparc64fbsd_gregset;

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);
}
Ejemplo n.º 18
0
void
_initialize_arm_netbsd_nat (void)
{
  struct target_ops *t;

  t = inf_ptrace_target ();
  t->to_fetch_registers = armnbsd_fetch_registers;
  t->to_store_registers = armnbsd_store_registers;
  t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
  add_target (t);

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (armnbsd_supply_pcb);

  deprecated_add_core_fns (&arm_netbsd_core_fns);
  deprecated_add_core_fns (&arm_netbsd_elfcore_fns);
}
Ejemplo n.º 19
0
void
_initialize_i386fbsd_nat (void)
{
  struct target_ops *t;

  /* Add some extra features to the common *BSD/i386 target.  */
  t = i386bsd_target ();

#ifdef PT_GETXSTATE_INFO
  t->to_read_description = i386fbsd_read_description;
#endif

  t->to_resume = i386fbsd_resume;
  fbsd_nat_add_target (t);

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (i386fbsd_supply_pcb);

#ifdef KERN_PROC_SIGTRAMP
  /* Normally signal frames are detected via i386fbsd_sigtramp_p.
     However, FreeBSD 9.2 through 10.1 do not include the page holding
     the signal code in core dumps.  These releases do provide a
     kern.proc.sigtramp.<pid> sysctl that returns the location of the
     signal trampoline for a running process.  We fetch the location
     of the current (gdb) process and use this to identify signal
     frames in core dumps from these releases.  */
  {
    int mib[4];
    struct kinfo_sigtramp kst;
    size_t len;

    mib[0] = CTL_KERN;
    mib[1] = KERN_PROC;
    mib[2] = KERN_PROC_SIGTRAMP;
    mib[3] = getpid ();
    len = sizeof (kst);
    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
      {
	i386fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
	i386fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;
      }
  }
#endif
}
Ejemplo n.º 20
0
void
_initialize_sparc64obsd_nat (void)
{
  sparc_supply_gregset = sparc64_supply_gregset;
  sparc_collect_gregset = sparc64_collect_gregset;
  sparc_supply_fpregset = sparc64_supply_fpregset;
  sparc_collect_fpregset = sparc64_collect_fpregset;
  sparc_gregset_supplies_p = sparc64obsd_gregset_supplies_p;
  sparc_fpregset_supplies_p = sparc64obsd_fpregset_supplies_p;

  sparc_gregmap = &sparc64nbsd_gregmap;
  sparc_fpregmap = &sparc64_bsd_fpregmap;

  /* Add some extra features to the generic SPARC target.  */
  obsd_add_target (sparc_target ());

  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (sparc64obsd_supply_pcb);
}
void
_initialize_i386nbsd_nat (void)
{
  /* Support debugging kernel virtual memory images.  */
  bsd_kvm_add_target (i386nbsd_supply_pcb);
}