gdb: Disable -Werror for -Wmaybe-uninitialized
[deliverable/binutils-gdb.git] / gdb / arch-utils.h
index ab558e2c805d009a269325a47c83bf3e7b275bdf..967a4b19de17a59843a61a6d810fbe3ca1a2bd8d 100644 (file)
@@ -1,6 +1,6 @@
 /* Dynamic architecture support for GDB, the GNU debugger.
 
-   Copyright (C) 1998-2016 Free Software Foundation, Inc.
+   Copyright (C) 1998-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -25,63 +25,53 @@ struct frame_info;
 struct minimal_symbol;
 struct type;
 struct gdbarch_info;
+struct dwarf2_frame_state;
+
+template <size_t bp_size, const gdb_byte *break_insn>
+struct bp_manipulation
+{
+  static int
+  kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
+  {
+    return bp_size;
+  }
 
-#define GDBARCH_BREAKPOINT_FROM_PC(ARCH)                              \
-  static const gdb_byte *                                             \
-  ARCH##_breakpoint_from_pc (struct gdbarch *gdbarch,                 \
-                            CORE_ADDR *pcptr,                          \
-                            int *lenptr)                               \
-  {                                                                    \
-    int kind = ARCH##_breakpoint_kind_from_pc (gdbarch, pcptr);        \
-                                                                    \
-    return ARCH##_sw_breakpoint_from_kind (gdbarch, kind, lenptr);   \
+  static const gdb_byte *
+  bp_from_kind (struct gdbarch *gdbarch, int kind, int *size)
+  {
+    *size = kind;
+    return break_insn;
+  }
+};
+
+template <size_t bp_size,
+         const gdb_byte *break_insn_little,
+         const gdb_byte *break_insn_big>
+struct bp_manipulation_endian
+{
+  static int
+  kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
+  {
+    return bp_size;
   }
 
-#define GDBARCH_BREAKPOINT_MANIPULATION(ARCH,BREAK_INSN)             \
-  static int                                                         \
-  ARCH##_breakpoint_kind_from_pc (struct gdbarch *gdbarch,           \
-                                 CORE_ADDR *pcptr)                   \
-  {                                                                  \
-    return sizeof (BREAK_INSN);                                      \
-  }                                                                  \
-  static const gdb_byte *                                            \
-  ARCH##_sw_breakpoint_from_kind (struct gdbarch *gdbarch,           \
-                                 int kind, int *size)                \
-  {                                                                  \
-    *size = kind;                                                    \
-    return BREAK_INSN;                                               \
-  }                                                                  \
-  GDBARCH_BREAKPOINT_FROM_PC (ARCH)
-
-#define SET_GDBARCH_BREAKPOINT_MANIPULATION(ARCH)                      \
-  set_gdbarch_breakpoint_from_pc (gdbarch, ARCH##_breakpoint_from_pc); \
-  set_gdbarch_breakpoint_kind_from_pc (gdbarch,                        \
-                                      ARCH##_breakpoint_kind_from_pc); \
-  set_gdbarch_sw_breakpoint_from_kind (gdbarch,                        \
-                                      ARCH##_sw_breakpoint_from_kind)
-
-#define GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN(ARCH, \
-                                              LITTLE_BREAK_INSN,       \
-                                              BIG_BREAK_INSN)          \
-  static int                                                           \
-  ARCH##_breakpoint_kind_from_pc (struct gdbarch *gdbarch,             \
-                                 CORE_ADDR *pcptr)                     \
-  {                                                                    \
-    gdb_static_assert (ARRAY_SIZE (LITTLE_BREAK_INSN)                  \
-                      == ARRAY_SIZE (BIG_BREAK_INSN));         \
-    return sizeof (BIG_BREAK_INSN);                                    \
-  }                                                                    \
-  static const gdb_byte *                                            \
-  ARCH##_sw_breakpoint_from_kind (struct gdbarch *gdbarch,           \
-                                 int kind, int *size)                \
-  {                                                                  \
-    *size = kind;                                                    \
-    if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)              \
-      return BIG_BREAK_INSN;                                         \
-    else                                                             \
-      return LITTLE_BREAK_INSN;                                      \
-  }                                                                  \
-  GDBARCH_BREAKPOINT_FROM_PC (ARCH)
+  static const gdb_byte *
+  bp_from_kind (struct gdbarch *gdbarch, int kind, int *size)
+  {
+    *size = kind;
+    if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+      return break_insn_big;
+    else
+      return break_insn_little;
+  }
+};
+
+#define BP_MANIPULATION(BREAK_INSN) \
+  bp_manipulation<sizeof (BREAK_INSN), BREAK_INSN>
+
+#define BP_MANIPULATION_ENDIAN(BREAK_INSN_LITTLE, BREAK_INSN_BIG) \
+  bp_manipulation_endian<sizeof (BREAK_INSN_LITTLE),             \
+  BREAK_INSN_LITTLE, BREAK_INSN_BIG>
 
 /* An implementation of gdbarch_displaced_step_copy_insn for
    processors that don't need to modify the instruction before
@@ -141,6 +131,11 @@ CORE_ADDR default_adjust_dwarf2_addr (CORE_ADDR pc);
 
 CORE_ADDR default_adjust_dwarf2_line (CORE_ADDR addr, int rel);
 
+/* Default DWARF vendor CFI handler.  */
+
+bool default_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op,
+                                         struct dwarf2_frame_state *fs);
+
 /* Version of cannot_fetch_register() / cannot_store_register() that
    always fails.  */
 
@@ -228,6 +223,14 @@ extern int default_has_shared_address_space (struct gdbarch *);
 extern int default_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
                                             CORE_ADDR addr, char **msg);
 
+extern const gdb_byte *default_breakpoint_from_pc (struct gdbarch *gdbarch,
+                                                  CORE_ADDR *pcptr,
+                                                  int *lenptr);
+
+extern int default_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
+                                                      struct regcache *regcache,
+                                                      CORE_ADDR *pcptr);
+
 extern void default_gen_return_address (struct gdbarch *gdbarch,
                                        struct agent_expr *ax,
                                        struct axs_value *value,
This page took 0.02563 seconds and 4 git commands to generate.