gdb/
[deliverable/binutils-gdb.git] / gdb / amd64-tdep.c
index 8f686d140093716982379bfa4edf87bff06ee360..b85f255d5bb59a2fce884a15b334e66983c663d5 100644 (file)
@@ -45,6 +45,9 @@
 #include "features/i386/amd64.c"
 #include "features/i386/amd64-avx.c"
 
+#include "ax.h"
+#include "ax-gdb.h"
+
 /* Note that the AMD64 architecture was previously known as x86-64.
    The latter is (forever) engraved into the canonical system name as
    returned by config.guess, and used as the name for the AMD64 port
@@ -1962,17 +1965,19 @@ amd64_skip_xmm_prologue (CORE_ADDR pc, CORE_ADDR start_pc)
   offset = 4;
   for (xmmreg = 0; xmmreg < 8; xmmreg++)
     {
-      /* movaps %xmmreg?,-0x??(%rbp) */
+      /* 0x0f 0x29 0b??000101 movaps %xmmreg?,-0x??(%rbp) */
       if (buf[offset] != 0x0f || buf[offset + 1] != 0x29
-          || (buf[offset + 2] & 0b00111111) != (xmmreg << 3 | 0b101))
+          || (buf[offset + 2] & 0x3f) != (xmmreg << 3 | 0x5))
        return pc;
 
-      if ((buf[offset + 2] & 0b11000000) == 0b01000000)
+      /* 0b01?????? */
+      if ((buf[offset + 2] & 0xc0) == 0x40)
        {
          /* 8-bit displacement.  */
          offset += 4;
        }
-      else if ((buf[offset + 2] & 0b11000000) == 0b10000000)
+      /* 0b10?????? */
+      else if ((buf[offset + 2] & 0xc0) == 0x80)
        {
          /* 32-bit displacement.  */
          offset += 7;
@@ -2163,6 +2168,22 @@ static const struct frame_unwind amd64_frame_unwind =
   default_frame_sniffer
 };
 \f
+/* Generate a bytecode expression to get the value of the saved PC.  */
+
+static void
+amd64_gen_return_address (struct gdbarch *gdbarch,
+                         struct agent_expr *ax, struct axs_value *value,
+                         CORE_ADDR scope)
+{
+  /* The following sequence assumes the traditional use of the base
+     register.  */
+  ax_reg (ax, AMD64_RBP_REGNUM);
+  ax_const_l (ax, 8);
+  ax_simple (ax, aop_add);
+  value->type = register_type (gdbarch, AMD64_RIP_REGNUM);
+  value->kind = axs_lvalue_memory;
+}
+\f
 
 /* Signal trampolines.  */
 
@@ -2667,6 +2688,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_get_longjmp_target (gdbarch, amd64_get_longjmp_target);
 
   set_gdbarch_relocate_instruction (gdbarch, amd64_relocate_instruction);
+
+  set_gdbarch_gen_return_address (gdbarch, amd64_gen_return_address);
 }
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
This page took 0.026327 seconds and 4 git commands to generate.