[C++/mingw] gdbserver casts
[deliverable/binutils-gdb.git] / gdb / gdbserver / linux-m68k-low.c
index bc59e3ec18ac041038aa11889d2bbd843323ac62..10129a695982db8a0ed8b78d293352cbacf8181a 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU/Linux/m68k specific low level interface, for the remote server for GDB.
-   Copyright (C) 1995-2013 Free Software Foundation, Inc.
+   Copyright (C) 1995-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,6 +21,7 @@
 
 /* Defined in auto-generated file reg-m68k.c.  */
 void init_registers_m68k (void);
+extern const struct target_desc *tdesc_m68k;
 
 #ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>
@@ -67,7 +68,7 @@ m68k_cannot_fetch_register (int regno)
 
 #ifdef HAVE_PTRACE_GETREGS
 #include <sys/procfs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
 
 static void
 m68k_fill_gregset (struct regcache *regcache, void *buf)
@@ -109,7 +110,7 @@ m68k_store_fpregset (struct regcache *regcache, const void *buf)
 
 #endif /* HAVE_PTRACE_GETREGS */
 
-struct regset_info target_regsets[] = {
+static struct regset_info m68k_regsets[] = {
 #ifdef HAVE_PTRACE_GETREGS
   { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
     GENERAL_REGS,
@@ -118,12 +119,21 @@ struct regset_info target_regsets[] = {
     FP_REGS,
     m68k_fill_fpregset, m68k_store_fpregset },
 #endif /* HAVE_PTRACE_GETREGS */
-  { 0, 0, 0, -1, -1, NULL, NULL }
+  NULL_REGSET
 };
 
-static const unsigned char m68k_breakpoint[] = { 0x4E, 0x4F };
+static const gdb_byte m68k_breakpoint[] = { 0x4E, 0x4F };
 #define m68k_breakpoint_len 2
 
+/* Implementation of linux_target_ops method "sw_breakpoint_from_kind".  */
+
+static const gdb_byte *
+m68k_sw_breakpoint_from_kind (int kind, int *size)
+{
+  *size = m68k_breakpoint_len;
+  return m68k_breakpoint;
+}
+
 static CORE_ADDR
 m68k_get_pc (struct regcache *regcache)
 {
@@ -174,19 +184,58 @@ ps_get_thread_area (const struct ps_prochandle *ph,
 }
 #endif /* PTRACE_GET_THREAD_AREA */
 
+static struct regsets_info m68k_regsets_info =
+  {
+    m68k_regsets, /* regsets */
+    0, /* num_regsets */
+    NULL, /* disabled_regsets */
+  };
+
+static struct usrregs_info m68k_usrregs_info =
+  {
+    m68k_num_regs,
+    m68k_regmap,
+  };
+
+static struct regs_info regs_info =
+  {
+    NULL, /* regset_bitmap */
+    &m68k_usrregs_info,
+    &m68k_regsets_info
+  };
+
+static const struct regs_info *
+m68k_regs_info (void)
+{
+  return &regs_info;
+}
+
+static void
+m68k_arch_setup (void)
+{
+  current_process ()->tdesc = tdesc_m68k;
+}
+
 struct linux_target_ops the_low_target = {
-  init_registers_m68k,
-  m68k_num_regs,
-  m68k_regmap,
-  NULL,
+  m68k_arch_setup,
+  m68k_regs_info,
   m68k_cannot_fetch_register,
   m68k_cannot_store_register,
   NULL, /* fetch_register */
   m68k_get_pc,
   m68k_set_pc,
-  m68k_breakpoint,
-  m68k_breakpoint_len,
+  NULL, /* breakpoint_kind_from_pc */
+  m68k_sw_breakpoint_from_kind,
   NULL,
   2,
   m68k_breakpoint_at,
 };
+
+void
+initialize_low_arch (void)
+{
+  /* Initialize the Linux target descriptions.  */
+  init_registers_m68k ();
+
+  initialize_regsets_info (&m68k_regsets_info);
+}
This page took 0.034111 seconds and 4 git commands to generate.