2004-07-20 Andrew Cagney <cagney@gnu.org>
authorAndrew Cagney <cagney@redhat.com>
Tue, 20 Jul 2004 15:11:37 +0000 (15:11 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 20 Jul 2004 15:11:37 +0000 (15:11 +0000)
* tramp-frame.h (struct tramp_frame): Change "insn" to a struct
containing both bytes and mask.  Add "frame_type".
* tramp-frame.c (tramp_frame_start): Update.
(tramp_frame_prepend_unwinder): Update.
* mips-linux-tdep.c (mips_linux_o32_sigframe)
(mips_linux_o32_rt_sigframe, mips_linux_n32_rt_sigframe)
(mips_linux_n64_rt_sigframe): Update.  Make "static const".
* ppcnbsd-tdep.c (tramp_frame ppcnbsd_sigtramp): Update.

gdb/ChangeLog
gdb/mips-linux-tdep.c
gdb/ppcnbsd-tdep.c
gdb/tramp-frame.c
gdb/tramp-frame.h

index 848203563b9865bc4247483722dc55dc106f0a4f..caea941f8040edc91553e4053d9fc52b78da97dc 100644 (file)
@@ -1,3 +1,14 @@
+2004-07-20  Andrew Cagney  <cagney@gnu.org>
+
+       * tramp-frame.h (struct tramp_frame): Change "insn" to a struct
+       containing both bytes and mask.  Add "frame_type".
+       * tramp-frame.c (tramp_frame_start): Update.
+       (tramp_frame_prepend_unwinder): Update.
+       * mips-linux-tdep.c (mips_linux_o32_sigframe)
+       (mips_linux_o32_rt_sigframe, mips_linux_n32_rt_sigframe)
+       (mips_linux_n64_rt_sigframe): Update.  Make "static const".
+       * ppcnbsd-tdep.c (tramp_frame ppcnbsd_sigtramp): Update.
+
 2004-07-19  Eli Zaretskii  <eliz@gnu.org>
 
        * config/djgpp/fnchange.lst: Add remapping for bfd/elf32-cr*.c,
index 76bbef2da7affca99807b2f104a3ab002bc08cb0..a13fa361f5c6f2ce4d8f3d117708d0ab3a47fadc 100644 (file)
@@ -830,25 +830,40 @@ static void mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
 #define MIPS_INST_LI_V0_N32_RT_SIGRETURN 0x24020000 + MIPS_NR_N32_rt_sigreturn
 #define MIPS_INST_SYSCALL 0x0000000c
 
-struct tramp_frame mips_linux_o32_sigframe = {
+static const struct tramp_frame mips_linux_o32_sigframe = {
+  SIGTRAMP_FRAME,
   4,
-  { MIPS_INST_LI_V0_SIGRETURN, MIPS_INST_SYSCALL, TRAMP_SENTINEL_INSN },
+  {
+    { MIPS_INST_LI_V0_SIGRETURN, -1 },
+    { MIPS_INST_SYSCALL, -1 },
+    { TRAMP_SENTINEL_INSN, -1 }
+  },
   mips_linux_o32_sigframe_init
 };
 
-struct tramp_frame mips_linux_o32_rt_sigframe = {
+static const struct tramp_frame mips_linux_o32_rt_sigframe = {
+  SIGTRAMP_FRAME,
   4,
-  { MIPS_INST_LI_V0_RT_SIGRETURN, MIPS_INST_SYSCALL, TRAMP_SENTINEL_INSN },
+  {
+    { MIPS_INST_LI_V0_RT_SIGRETURN, -1 },
+    { MIPS_INST_SYSCALL, -1 },
+    { TRAMP_SENTINEL_INSN, -1 } },
   mips_linux_o32_sigframe_init
 };
 
-struct tramp_frame mips_linux_n32_rt_sigframe = {
+static const struct tramp_frame mips_linux_n32_rt_sigframe = {
+  SIGTRAMP_FRAME,
   4,
-  { MIPS_INST_LI_V0_N32_RT_SIGRETURN, MIPS_INST_SYSCALL, TRAMP_SENTINEL_INSN },
+  {
+    { MIPS_INST_LI_V0_N32_RT_SIGRETURN, -1 },
+    { MIPS_INST_SYSCALL, -1 },
+    { TRAMP_SENTINEL_INSN, -1 }
+  },
   mips_linux_n32n64_sigframe_init
 };
 
-struct tramp_frame mips_linux_n64_rt_sigframe = {
+static const struct tramp_frame mips_linux_n64_rt_sigframe = {
+  SIGTRAMP_FRAME,
   4,
   { MIPS_INST_LI_V0_N64_RT_SIGRETURN, MIPS_INST_SYSCALL, TRAMP_SENTINEL_INSN },
   mips_linux_n32n64_sigframe_init
index 317cd85afb18bb75443a6afb99c09374b2ea61ba..0ac9fec31fec75841a8fa0a856b02a4b0c7ee3b4 100644 (file)
@@ -293,14 +293,15 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
    instruction, or zero if it isn't a signal trampoline.  */
 
 static const struct tramp_frame ppcnbsd_sigtramp = {
+  SIGTRAMP_FRAME,
   4, /* insn size */
   { /* insn */
-    0x38610018, /* addi r3,r1,24 */
-    0x38000127, /* li r0,295 */
-    0x44000002, /* sc */
-    0x38000001, /* li r0,1 */
-    0x44000002, /* sc */
-    TRAMP_SENTINEL_INSN
+    { 0x38610018, -1 }, /* addi r3,r1,24 */
+    { 0x38000127, -1 }, /* li r0,295 */
+    { 0x44000002, -1 }, /* sc */
+    { 0x38000001, -1 }, /* li r0,1 */
+    { 0x44000002, -1 }, /* sc */
+    { TRAMP_SENTINEL_INSN, -1 }
   },
   ppcnbsd_sigtramp_cache_init
 };
index 6ea2e3f1ebe1f46da32f6320e74fabdb0e6ec3c3..e1b946b4c79824f0052dd7fb4fb9fd2e7ce18843 100644 (file)
@@ -91,7 +91,7 @@ tramp_frame_start (const struct tramp_frame *tramp,
   int ti;
   /* Search through the trampoline for one that matches the
      instruction sequence around PC.  */
-  for (ti = 0; tramp->insn[ti] != TRAMP_SENTINEL_INSN; ti++)
+  for (ti = 0; tramp->insn[ti].bytes != TRAMP_SENTINEL_INSN; ti++)
     {
       CORE_ADDR func = pc - tramp->insn_size * ti;
       int i;
@@ -99,14 +99,14 @@ tramp_frame_start (const struct tramp_frame *tramp,
        {
          bfd_byte buf[sizeof (tramp->insn[0])];
          ULONGEST insn;
-         if (tramp->insn[i] == TRAMP_SENTINEL_INSN)
+         if (tramp->insn[i].bytes == TRAMP_SENTINEL_INSN)
            return func;
          if (!safe_frame_unwind_memory (next_frame,
                                         func + i * tramp->insn_size,
                                         buf, tramp->insn_size))
            break;
          insn = extract_unsigned_integer (buf, tramp->insn_size);
-         if (tramp->insn[i] != insn)
+         if (tramp->insn[i].bytes != (insn & tramp->insn[i].mask))
            break;
        }
     }
@@ -156,11 +156,11 @@ tramp_frame_prepend_unwinder (struct gdbarch *gdbarch,
   /* Check that the instruction sequence contains a sentinel.  */
   for (i = 0; i < ARRAY_SIZE (tramp_frame->insn); i++)
     {
-      if (tramp_frame->insn[i] == TRAMP_SENTINEL_INSN)
+      if (tramp_frame->insn[i].bytes == TRAMP_SENTINEL_INSN)
        break;
     }
   gdb_assert (i < ARRAY_SIZE (tramp_frame->insn));
-  gdb_assert (tramp_frame->insn_size <= sizeof (tramp_frame->insn[0]));
+  gdb_assert (tramp_frame->insn_size <= sizeof (tramp_frame->insn[0].bytes));
 
   data = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_data);
   unwinder = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_unwind);
index 26d4178e7be2e84a1ea18b7646c3b5359792d80a..9244701e9aa0cf0c517c8e9f88d1b8b3f3dfc887 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef TRAMP_FRAME_H
 #define TRAMP_FRAME_H
 
+#include "frame.h"             /* For "enum frame_type".  */
+
 struct trad_frame;
 struct frame_info;
 struct trad_frame_cache;
@@ -45,16 +47,24 @@ struct trad_frame_cache;
 
 struct tramp_frame
 {
-  /* The trampoline's entire instruction sequence.  Search for this in
-     the inferior at or around the frame's PC.  It is assumed that the
-     PC is INSN_SIZE aligned, and that each element of TRAMP contains
-     one INSN_SIZE instruction.  It is also assumed that TRAMP[0]
-     contains the first instruction of the trampoline and hence the
-     address of the instruction matching TRAMP[0] is the trampoline's
-     "func" address.  The instruction sequence shall be terminated by
+  /* The trampoline's type, some a signal trampolines, some are normal
+     call-frame trampolines (aka thunks).  */
+  enum frame_type frame_type;
+  /* The trampoline's entire instruction sequence.  It consists of a
+     bytes/mask pair.  Search for this in the inferior at or around
+     the frame's PC.  It is assumed that the PC is INSN_SIZE aligned,
+     and that each element of TRAMP contains one INSN_SIZE
+     instruction.  It is also assumed that INSN[0] contains the first
+     instruction of the trampoline and hence the address of the
+     instruction matching INSN[0] is the trampoline's "func" address.
+     The instruction sequence is terminated by
      TRAMP_SENTINEL_INSN.  */
   int insn_size;
-  ULONGEST insn[8];
+  struct
+  {
+    ULONGEST bytes;
+    ULONGEST mask;
+  } insn[8];
   /* Initialize a trad-frame cache corresponding to the tramp-frame.
      FUNC is the address of the instruction TRAMP[0] in memory.  */
   void (*init) (const struct tramp_frame *self,
This page took 0.04098 seconds and 4 git commands to generate.