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.
This commit is contained in:
parent
e12904d27f
commit
2cd8546d13
5 changed files with 63 additions and 26 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue