aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-07-20 15:11:37 +0000
committerAndrew Cagney <cagney@redhat.com>2004-07-20 15:11:37 +0000
commit2cd8546d1321946294f6c89cdfb250a7de50f99d (patch)
tree77cf2b4bed624e2cc61b1f00caa2cccb7f6b39e7
parente12904d27fcfac19123e57e6cb606045e7e829b9 (diff)
downloadgdb-2cd8546d1321946294f6c89cdfb250a7de50f99d.zip
gdb-2cd8546d1321946294f6c89cdfb250a7de50f99d.tar.gz
gdb-2cd8546d1321946294f6c89cdfb250a7de50f99d.tar.bz2
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.
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/mips-linux-tdep.c29
-rw-r--r--gdb/ppcnbsd-tdep.c13
-rw-r--r--gdb/tramp-frame.c10
-rw-r--r--gdb/tramp-frame.h26
5 files changed, 63 insertions, 26 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8482035..caea941 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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,
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 76bbef2..a13fa36 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -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
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index 317cd85..0ac9fec 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -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
};
diff --git a/gdb/tramp-frame.c b/gdb/tramp-frame.c
index 6ea2e3f..e1b946b 100644
--- a/gdb/tramp-frame.c
+++ b/gdb/tramp-frame.c
@@ -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);
diff --git a/gdb/tramp-frame.h b/gdb/tramp-frame.h
index 26d4178..9244701 100644
--- a/gdb/tramp-frame.h
+++ b/gdb/tramp-frame.h
@@ -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,