Update i386 and amd64 ports for unwinder changes.

* amd64-tdep.c (amd64_frame_cache): Expect this_frame.
	(amd64_frame_this_id, amd64_frame_prev_register): Update signature.
	(amd64_frame_unwind): Use default_frame_sniffer.
	(amd64_frame_sniffer): Delete.
	(amd64_sigtramp_frame_cache): Expect this_frame.
	(amd64_sigtramp_frame_this_id, amd64_sigtramp_frame_prev_register)
	(amd64_sigtramp_frame_sniffer): Update signature.
	(amd64_sigtramp_frame_unwind): Add amd64_sigtramp_frame_sniffer.
	(amd64_frame_base_address): Expect this_frame.
	(amd64_dummy_id): Renamed from amd64_unwind_dummy_id.  Expect
	this_frame.
	(amd64_init_abi): Use set_gdbarch_dummy_id and
	frame_unwind_append_unwinder.
	* i386-tdep.c (i386_frame_cache): Expect this_frame.
	(i386_frame_this_id, i386_frame_prev_register): Update signature.
	(i386_frame_unwind): Use default_frame_sniffer.
	(i386_frame_sniffer): Delete.
	(i386_sigtramp_frame_cache): Expect this_frame.
	(i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register)
	(i386_sigtramp_frame_sniffer): Update signature.
	(i386_sigtramp_frame_unwind): Use i386_sigtramp_frame_sniffer.
	(i386_frame_base_address): Update signature.
	(i386_dummy_id): Rename from i386_unwind_dummy_id.  Expect this_frame.
	(i386_push_dummy_call): Update comment.
	(i386_sigtramp_p, i386_svr4_sigtramp_p, i386_svr4_sigcontext_addr):
	Expect this_frame.
	(i386_gdbarch_init): Use set_gdbarch_dummy_id, dwarf2_append_unwinders,
	and frame_unwind_append_unwinder.
	* amd64-linux-tdep.c, amd64-sol2-tdep.c, amd64fbsd-tdep.c,
	amd64nbsd-tdep.c, amd64obsd-tdep.c, i386-linux-tdep.c,
	i386-nto-tdep.c, i386bsd-tdep.c, i386-sol2-tdep.c, i386obsd-tdep.c,
	i386nbsd-tdep.c: Update for unwinder changes.
This commit is contained in:
Daniel Jacobowitz 2008-04-30 21:19:45 +00:00
parent 25492ce3f9
commit 1045891474
14 changed files with 325 additions and 392 deletions

View File

@ -1,3 +1,40 @@
2008-04-30 Daniel Jacobowitz <dan@codesourcery.com>
Update i386 and amd64 ports for unwinder changes.
* amd64-tdep.c (amd64_frame_cache): Expect this_frame.
(amd64_frame_this_id, amd64_frame_prev_register): Update signature.
(amd64_frame_unwind): Use default_frame_sniffer.
(amd64_frame_sniffer): Delete.
(amd64_sigtramp_frame_cache): Expect this_frame.
(amd64_sigtramp_frame_this_id, amd64_sigtramp_frame_prev_register)
(amd64_sigtramp_frame_sniffer): Update signature.
(amd64_sigtramp_frame_unwind): Add amd64_sigtramp_frame_sniffer.
(amd64_frame_base_address): Expect this_frame.
(amd64_dummy_id): Renamed from amd64_unwind_dummy_id. Expect
this_frame.
(amd64_init_abi): Use set_gdbarch_dummy_id and
frame_unwind_append_unwinder.
* i386-tdep.c (i386_frame_cache): Expect this_frame.
(i386_frame_this_id, i386_frame_prev_register): Update signature.
(i386_frame_unwind): Use default_frame_sniffer.
(i386_frame_sniffer): Delete.
(i386_sigtramp_frame_cache): Expect this_frame.
(i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register)
(i386_sigtramp_frame_sniffer): Update signature.
(i386_sigtramp_frame_unwind): Use i386_sigtramp_frame_sniffer.
(i386_frame_base_address): Update signature.
(i386_dummy_id): Rename from i386_unwind_dummy_id. Expect this_frame.
(i386_push_dummy_call): Update comment.
(i386_sigtramp_p, i386_svr4_sigtramp_p, i386_svr4_sigcontext_addr):
Expect this_frame.
(i386_gdbarch_init): Use set_gdbarch_dummy_id, dwarf2_append_unwinders,
and frame_unwind_append_unwinder.
* amd64-linux-tdep.c, amd64-sol2-tdep.c, amd64fbsd-tdep.c,
amd64nbsd-tdep.c, amd64obsd-tdep.c, i386-linux-tdep.c,
i386-nto-tdep.c, i386bsd-tdep.c, i386-sol2-tdep.c, i386obsd-tdep.c,
i386nbsd-tdep.c: Update for unwinder changes.
2008-04-30 Daniel Jacobowitz <dan@codesourcery.com>
* trad-frame.c (struct trad_frame_cache): Rename next_frame to this_frame.

View File

@ -88,9 +88,9 @@ static const gdb_byte linux_sigtramp_code[] =
the routine. Otherwise, return 0. */
static CORE_ADDR
amd64_linux_sigtramp_start (struct frame_info *next_frame)
amd64_linux_sigtramp_start (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
gdb_byte buf[LINUX_SIGTRAMP_LEN];
/* We only recognize a signal trampoline if PC is at the start of
@ -100,7 +100,7 @@ amd64_linux_sigtramp_start (struct frame_info *next_frame)
PC is not at the start of the instruction sequence, there will be
a few trailing readable bytes on the stack. */
if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
if (!safe_frame_unwind_memory (this_frame, pc, buf, sizeof buf))
return 0;
if (buf[0] != LINUX_SIGTRAMP_INSN0)
@ -109,7 +109,7 @@ amd64_linux_sigtramp_start (struct frame_info *next_frame)
return 0;
pc -= LINUX_SIGTRAMP_OFFSET1;
if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
if (!safe_frame_unwind_memory (this_frame, pc, buf, sizeof buf))
return 0;
}
@ -119,13 +119,13 @@ amd64_linux_sigtramp_start (struct frame_info *next_frame)
return pc;
}
/* Return whether the frame preceding NEXT_FRAME corresponds to a
GNU/Linux sigtramp routine. */
/* Return whether THIS_FRAME corresponds to a GNU/Linux sigtramp
routine. */
static int
amd64_linux_sigtramp_p (struct frame_info *next_frame)
amd64_linux_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
@ -137,7 +137,7 @@ amd64_linux_sigtramp_p (struct frame_info *next_frame)
__sigaction, or __libc_sigaction (all aliases to the same
function). */
if (name == NULL || strstr (name, "sigaction") != NULL)
return (amd64_linux_sigtramp_start (next_frame) != 0);
return (amd64_linux_sigtramp_start (this_frame) != 0);
return (strcmp ("__restore_rt", name) == 0);
}
@ -145,17 +145,16 @@ amd64_linux_sigtramp_p (struct frame_info *next_frame)
/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
#define AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 40
/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
routine, return the address of the associated sigcontext structure. */
/* Assuming THIS_FRAME is a GNU/Linux sigtramp routine, return the
address of the associated sigcontext structure. */
static CORE_ADDR
amd64_linux_sigcontext_addr (struct frame_info *next_frame)
amd64_linux_sigcontext_addr (struct frame_info *this_frame)
{
CORE_ADDR sp;
gdb_byte buf[8];
frame_unwind_register (next_frame,
gdbarch_sp_regnum (get_frame_arch (next_frame)), buf);
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 8);
/* The sigcontext structure is part of the user context. A pointer

View File

@ -65,13 +65,13 @@ static int amd64_sol2_gregset_reg_offset[] = {
};
/* Return whether the frame preceding NEXT_FRAME corresponds to a
Solaris sigtramp routine. */
/* Return whether THIS_FRAME corresponds to a Solaris sigtramp
routine. */
static int
amd64_sol2_sigtramp_p (struct frame_info *next_frame)
amd64_sol2_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
@ -83,12 +83,12 @@ amd64_sol2_sigtramp_p (struct frame_info *next_frame)
'mcontext_t' that contains the saved set of machine registers. */
static CORE_ADDR
amd64_sol2_mcontext_addr (struct frame_info *next_frame)
amd64_sol2_mcontext_addr (struct frame_info *this_frame)
{
CORE_ADDR sp, ucontext_addr;
sp = frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
ucontext_addr = get_frame_memory_unsigned (next_frame, sp + 8, 8);
sp = get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
ucontext_addr = get_frame_memory_unsigned (this_frame, sp + 8, 8);
return ucontext_addr + 72;
}

View File

@ -788,7 +788,7 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
/* Normal frames. */
static struct amd64_frame_cache *
amd64_frame_cache (struct frame_info *next_frame, void **this_cache)
amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct amd64_frame_cache *cache;
gdb_byte buf[8];
@ -800,9 +800,9 @@ amd64_frame_cache (struct frame_info *next_frame, void **this_cache)
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
cache->pc = get_frame_func (this_frame);
if (cache->pc != 0)
amd64_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
amd64_analyze_prologue (cache->pc, get_frame_pc (this_frame), cache);
if (cache->frameless_p)
{
@ -813,12 +813,12 @@ amd64_frame_cache (struct frame_info *next_frame, void **this_cache)
at the stack pointer. For truly "frameless" functions this
might work too. */
frame_unwind_register (next_frame, AMD64_RSP_REGNUM, buf);
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 8) + cache->sp_offset;
}
else
{
frame_unwind_register (next_frame, AMD64_RBP_REGNUM, buf);
get_frame_register (this_frame, AMD64_RBP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 8);
}
@ -841,11 +841,11 @@ amd64_frame_cache (struct frame_info *next_frame, void **this_cache)
}
static void
amd64_frame_this_id (struct frame_info *next_frame, void **this_cache,
amd64_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
struct amd64_frame_cache *cache =
amd64_frame_cache (next_frame, this_cache);
amd64_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@ -854,67 +854,34 @@ amd64_frame_this_id (struct frame_info *next_frame, void **this_cache,
(*this_id) = frame_id_build (cache->base + 16, cache->pc);
}
static void
amd64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, gdb_byte *valuep)
static struct value *
amd64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct amd64_frame_cache *cache =
amd64_frame_cache (next_frame, this_cache);
amd64_frame_cache (this_frame, this_cache);
gdb_assert (regnum >= 0);
if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp)
{
*optimizedp = 0;
*lvalp = not_lval;
*addrp = 0;
*realnump = -1;
if (valuep)
{
/* Store the value. */
store_unsigned_integer (valuep, 8, cache->saved_sp);
}
return;
}
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
if (regnum < AMD64_NUM_SAVED_REGS && cache->saved_regs[regnum] != -1)
{
*optimizedp = 0;
*lvalp = lval_memory;
*addrp = cache->saved_regs[regnum];
*realnump = -1;
if (valuep)
{
/* Read the value in from memory. */
read_memory (*addrp, valuep,
register_size (gdbarch, regnum));
}
return;
}
return frame_unwind_got_memory (this_frame, regnum,
cache->saved_regs[regnum]);
*optimizedp = 0;
*lvalp = lval_register;
*addrp = 0;
*realnump = regnum;
if (valuep)
frame_unwind_register (next_frame, (*realnump), valuep);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
static const struct frame_unwind amd64_frame_unwind =
{
NORMAL_FRAME,
amd64_frame_this_id,
amd64_frame_prev_register
amd64_frame_prev_register,
NULL,
default_frame_sniffer
};
static const struct frame_unwind *
amd64_frame_sniffer (struct frame_info *next_frame)
{
return &amd64_frame_unwind;
}
/* Signal trampolines. */
@ -924,10 +891,10 @@ amd64_frame_sniffer (struct frame_info *next_frame)
on both platforms. */
static struct amd64_frame_cache *
amd64_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct amd64_frame_cache *cache;
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
CORE_ADDR addr;
gdb_byte buf[8];
int i;
@ -937,10 +904,10 @@ amd64_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
cache = amd64_alloc_frame_cache ();
frame_unwind_register (next_frame, AMD64_RSP_REGNUM, buf);
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 8) - 8;
addr = tdep->sigcontext_addr (next_frame);
addr = tdep->sigcontext_addr (this_frame);
gdb_assert (tdep->sc_reg_offset);
gdb_assert (tdep->sc_num_regs <= AMD64_NUM_SAVED_REGS);
for (i = 0; i < tdep->sc_num_regs; i++)
@ -952,70 +919,70 @@ amd64_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
}
static void
amd64_sigtramp_frame_this_id (struct frame_info *next_frame,
amd64_sigtramp_frame_this_id (struct frame_info *this_frame,
void **this_cache, struct frame_id *this_id)
{
struct amd64_frame_cache *cache =
amd64_sigtramp_frame_cache (next_frame, this_cache);
amd64_sigtramp_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base + 16, frame_pc_unwind (next_frame));
(*this_id) = frame_id_build (cache->base + 16, get_frame_pc (this_frame));
}
static void
amd64_sigtramp_frame_prev_register (struct frame_info *next_frame,
void **this_cache,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, gdb_byte *valuep)
static struct value *
amd64_sigtramp_frame_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
/* Make sure we've initialized the cache. */
amd64_sigtramp_frame_cache (next_frame, this_cache);
amd64_sigtramp_frame_cache (this_frame, this_cache);
amd64_frame_prev_register (next_frame, this_cache, regnum,
optimizedp, lvalp, addrp, realnump, valuep);
return amd64_frame_prev_register (this_frame, this_cache, regnum);
}
static int
amd64_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
/* We shouldn't even bother if we don't have a sigcontext_addr
handler. */
if (tdep->sigcontext_addr == NULL)
return 0;
if (tdep->sigtramp_p != NULL)
{
if (tdep->sigtramp_p (this_frame))
return 1;
}
if (tdep->sigtramp_start != 0)
{
CORE_ADDR pc = get_frame_pc (this_frame);
gdb_assert (tdep->sigtramp_end != 0);
if (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end)
return 1;
}
return 0;
}
static const struct frame_unwind amd64_sigtramp_frame_unwind =
{
SIGTRAMP_FRAME,
amd64_sigtramp_frame_this_id,
amd64_sigtramp_frame_prev_register
amd64_sigtramp_frame_prev_register,
NULL,
amd64_sigtramp_frame_sniffer
};
static const struct frame_unwind *
amd64_sigtramp_frame_sniffer (struct frame_info *next_frame)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
/* We shouldn't even bother if we don't have a sigcontext_addr
handler. */
if (tdep->sigcontext_addr == NULL)
return NULL;
if (tdep->sigtramp_p != NULL)
{
if (tdep->sigtramp_p (next_frame))
return &amd64_sigtramp_frame_unwind;
}
if (tdep->sigtramp_start != 0)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
gdb_assert (tdep->sigtramp_end != 0);
if (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end)
return &amd64_sigtramp_frame_unwind;
}
return NULL;
}
static CORE_ADDR
amd64_frame_base_address (struct frame_info *next_frame, void **this_cache)
amd64_frame_base_address (struct frame_info *this_frame, void **this_cache)
{
struct amd64_frame_cache *cache =
amd64_frame_cache (next_frame, this_cache);
amd64_frame_cache (this_frame, this_cache);
return cache->base;
}
@ -1029,15 +996,13 @@ static const struct frame_base amd64_frame_base =
};
static struct frame_id
amd64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
amd64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
{
gdb_byte buf[8];
CORE_ADDR fp;
frame_unwind_register (next_frame, AMD64_RBP_REGNUM, buf);
fp = extract_unsigned_integer (buf, 8);
fp = get_frame_register_unsigned (this_frame, AMD64_RBP_REGNUM);
return frame_id_build (fp + 16, frame_pc_unwind (next_frame));
return frame_id_build (fp + 16, get_frame_pc (this_frame));
}
/* 16 byte align the SP per frame requirements. */
@ -1194,10 +1159,10 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_num_pseudo_regs (gdbarch, 0);
tdep->mm0_regnum = -1;
set_gdbarch_unwind_dummy_id (gdbarch, amd64_unwind_dummy_id);
set_gdbarch_dummy_id (gdbarch, amd64_dummy_id);
frame_unwind_append_sniffer (gdbarch, amd64_sigtramp_frame_sniffer);
frame_unwind_append_sniffer (gdbarch, amd64_frame_sniffer);
frame_unwind_append_unwinder (gdbarch, &amd64_sigtramp_frame_unwind);
frame_unwind_append_unwinder (gdbarch, &amd64_frame_unwind);
frame_base_set_default (gdbarch, &amd64_frame_base);
/* If we have a register mapping, enable the generic core file support. */

View File

@ -33,18 +33,18 @@
/* Support for signal handlers. */
/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp
routine, return the address of the associated sigcontext structure. */
/* Assuming THIS_FRAME is for a BSD sigtramp routine, return the
address of the associated sigcontext structure. */
static CORE_ADDR
amd64fbsd_sigcontext_addr (struct frame_info *next_frame)
amd64fbsd_sigcontext_addr (struct frame_info *this_frame)
{
CORE_ADDR sp;
/* The `struct sigcontext' (which really is an `ucontext_t' on
FreeBSD/amd64) lives at a fixed offset in the signal frame. See
<machine/sigframe.h>. */
sp = frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
sp = frame_unwind_register_unsigned (this_frame, AMD64_RSP_REGNUM);
return sp + 16;
}

View File

@ -32,31 +32,30 @@
/* Support for signal handlers. */
/* Return whether the frame preceding NEXT_FRAME corresponds to a
NetBSD sigtramp routine. */
/* Return whether THIS_FRAME corresponds to a NetBSD sigtramp
routine. */
static int
amd64nbsd_sigtramp_p (struct frame_info *next_frame)
amd64nbsd_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
return nbsd_pc_in_sigtramp (pc, name);
}
/* Assuming NEXT_FRAME is preceded by a frame corresponding to a
NetBSD sigtramp routine, return the address of the associated
mcontext structure. */
/* Assuming THIS_FRAME corresponds to a NetBSD sigtramp routine,
return the address of the associated mcontext structure. */
static CORE_ADDR
amd64nbsd_mcontext_addr (struct frame_info *next_frame)
amd64nbsd_mcontext_addr (struct frame_info *this_frame)
{
CORE_ADDR addr;
/* The register %r15 points at `struct ucontext' upon entry of a
signal trampoline. */
addr = frame_unwind_register_unsigned (next_frame, AMD64_R15_REGNUM);
addr = get_frame_register_unsigned (this_frame, AMD64_R15_REGNUM);
/* The mcontext structure lives as offset 56 in `struct ucontext'. */
return addr + 56;

View File

@ -79,13 +79,13 @@ amd64obsd_regset_from_core_section (struct gdbarch *gdbarch,
/* Default page size. */
static const int amd64obsd_page_size = 4096;
/* Return whether the frame preceding NEXT_FRAME corresponds to an
OpenBSD sigtramp routine. */
/* Return whether THIS_FRAME corresponds to an OpenBSD sigtramp
routine. */
static int
amd64obsd_sigtramp_p (struct frame_info *next_frame)
amd64obsd_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
CORE_ADDR start_pc = (pc & ~(amd64obsd_page_size - 1));
const gdb_byte sigreturn[] =
{
@ -110,7 +110,7 @@ amd64obsd_sigtramp_p (struct frame_info *next_frame)
/* If we can't read the instructions at START_PC, return zero. */
buf = alloca ((sizeof sigreturn) + 1);
if (!safe_frame_unwind_memory (next_frame, start_pc + 6, buf, buflen))
if (!safe_frame_unwind_memory (this_frame, start_pc + 6, buf, buflen))
return 0;
/* Check for sigreturn(2). Depending on how the assembler encoded
@ -123,13 +123,13 @@ amd64obsd_sigtramp_p (struct frame_info *next_frame)
return 1;
}
/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp
routine, return the address of the associated sigcontext structure. */
/* Assuming THIS_FRAME is for a BSD sigtramp routine, return the
address of the associated sigcontext structure. */
static CORE_ADDR
amd64obsd_sigcontext_addr (struct frame_info *next_frame)
amd64obsd_sigcontext_addr (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
ULONGEST offset = (pc & (amd64obsd_page_size - 1));
/* The %rsp register points at `struct sigcontext' upon entry of a
@ -145,9 +145,9 @@ amd64obsd_sigcontext_addr (struct frame_info *next_frame)
instruction clobbers %rsp, but its value is saved in `%rdi'. */
if (offset > 5)
return frame_unwind_register_unsigned (next_frame, AMD64_RDI_REGNUM);
return get_frame_register_unsigned (this_frame, AMD64_RDI_REGNUM);
else
return frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
return get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
}
/* OpenBSD 3.5 or later. */
@ -340,7 +340,7 @@ amd64obsd_collect_uthread (const struct regcache *regcache,
#define amd64obsd_tf_reg_offset amd64obsd_sc_reg_offset
static struct trad_frame_cache *
amd64obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
amd64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
{
struct trad_frame_cache *cache;
CORE_ADDR func, sp, addr;
@ -351,13 +351,11 @@ amd64obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
if (*this_cache)
return *this_cache;
cache = trad_frame_cache_zalloc (next_frame);
cache = trad_frame_cache_zalloc (this_frame);
*this_cache = cache;
/* NORMAL_FRAME matches the type in amd64obsd_trapframe_unwind, but
SIGTRAMP_FRAME might be more appropriate. */
func = frame_func_unwind (next_frame, NORMAL_FRAME);
sp = frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
func = get_frame_func (this_frame);
sp = get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
find_pc_partial_function (func, &name, NULL, NULL);
if (name && strncmp (name, "Xintr", 5) == 0)
@ -387,32 +385,28 @@ amd64obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
}
static void
amd64obsd_trapframe_this_id (struct frame_info *next_frame,
amd64obsd_trapframe_this_id (struct frame_info *this_frame,
void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
amd64obsd_trapframe_cache (next_frame, this_cache);
amd64obsd_trapframe_cache (this_frame, this_cache);
trad_frame_get_id (cache, this_id);
}
static void
amd64obsd_trapframe_prev_register (struct frame_info *next_frame,
void **this_cache, int regnum,
int *optimizedp, enum lval_type *lvalp,
CORE_ADDR *addrp, int *realnump,
gdb_byte *valuep)
static struct value *
amd64obsd_trapframe_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
amd64obsd_trapframe_cache (next_frame, this_cache);
amd64obsd_trapframe_cache (this_frame, this_cache);
trad_frame_get_register (cache, next_frame, regnum,
optimizedp, lvalp, addrp, realnump, valuep);
return trad_frame_get_register (cache, this_frame, regnum);
}
static int
amd64obsd_trapframe_sniffer (const struct frame_unwind *self,
struct frame_info *next_frame,
struct frame_info *this_frame,
void **this_prologue_cache)
{
ULONGEST cs;
@ -420,11 +414,11 @@ amd64obsd_trapframe_sniffer (const struct frame_unwind *self,
/* Check Current Privilege Level and bail out if we're not executing
in kernel space. */
cs = frame_unwind_register_unsigned (next_frame, AMD64_CS_REGNUM);
cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM);
if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
return 0;
find_pc_partial_function (frame_pc_unwind (next_frame), &name, NULL, NULL);
find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
return (name && ((strcmp (name, "calltrap") == 0)
|| (strcmp (name, "osyscall1") == 0)
|| (strcmp (name, "Xsyscall") == 0)

View File

@ -115,13 +115,13 @@ static const gdb_byte linux_sigtramp_code[] =
#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
/* If NEXT_FRAME unwinds into a sigtramp routine, return the address
of the start of the routine. Otherwise, return 0. */
/* If THIS_FRAME is a sigtramp routine, return the address of the
start of the routine. Otherwise, return 0. */
static CORE_ADDR
i386_linux_sigtramp_start (struct frame_info *next_frame)
i386_linux_sigtramp_start (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
gdb_byte buf[LINUX_SIGTRAMP_LEN];
/* We only recognize a signal trampoline if PC is at the start of
@ -131,7 +131,7 @@ i386_linux_sigtramp_start (struct frame_info *next_frame)
PC is not at the start of the instruction sequence, there will be
a few trailing readable bytes on the stack. */
if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_SIGTRAMP_LEN))
return 0;
if (buf[0] != LINUX_SIGTRAMP_INSN0)
@ -152,7 +152,7 @@ i386_linux_sigtramp_start (struct frame_info *next_frame)
pc -= adjust;
if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_SIGTRAMP_LEN))
return 0;
}
@ -183,13 +183,13 @@ static const gdb_byte linux_rt_sigtramp_code[] =
#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
/* If NEXT_FRAME unwinds into an RT sigtramp routine, return the
address of the start of the routine. Otherwise, return 0. */
/* If THIS_FRAME is an RT sigtramp routine, return the address of the
start of the routine. Otherwise, return 0. */
static CORE_ADDR
i386_linux_rt_sigtramp_start (struct frame_info *next_frame)
i386_linux_rt_sigtramp_start (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
gdb_byte buf[LINUX_RT_SIGTRAMP_LEN];
/* We only recognize a signal trampoline if PC is at the start of
@ -199,7 +199,7 @@ i386_linux_rt_sigtramp_start (struct frame_info *next_frame)
PC is not at the start of the instruction sequence, there will be
a few trailing readable bytes on the stack. */
if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN))
if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN))
return 0;
if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
@ -209,7 +209,7 @@ i386_linux_rt_sigtramp_start (struct frame_info *next_frame)
pc -= LINUX_RT_SIGTRAMP_OFFSET1;
if (!safe_frame_unwind_memory (next_frame, pc, buf,
if (!safe_frame_unwind_memory (this_frame, pc, buf,
LINUX_RT_SIGTRAMP_LEN))
return 0;
}
@ -220,13 +220,13 @@ i386_linux_rt_sigtramp_start (struct frame_info *next_frame)
return pc;
}
/* Return whether the frame preceding NEXT_FRAME corresponds to a
GNU/Linux sigtramp routine. */
/* Return whether THIS_FRAME corresponds to a GNU/Linux sigtramp
routine. */
static int
i386_linux_sigtramp_p (struct frame_info *next_frame)
i386_linux_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
@ -237,8 +237,8 @@ i386_linux_sigtramp_p (struct frame_info *next_frame)
be part of the preceding function. This should always be sigaction,
__sigaction, or __libc_sigaction (all aliases to the same function). */
if (name == NULL || strstr (name, "sigaction") != NULL)
return (i386_linux_sigtramp_start (next_frame) != 0
|| i386_linux_rt_sigtramp_start (next_frame) != 0);
return (i386_linux_sigtramp_start (this_frame) != 0
|| i386_linux_rt_sigtramp_start (this_frame) != 0);
return (strcmp ("__restore", name) == 0
|| strcmp ("__restore_rt", name) == 0);
@ -268,20 +268,20 @@ i386_linux_dwarf_signal_frame_p (struct gdbarch *gdbarch,
/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
#define I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 20
/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
routine, return the address of the associated sigcontext structure. */
/* Assuming THIS_FRAME is a GNU/Linux sigtramp routine, return the
address of the associated sigcontext structure. */
static CORE_ADDR
i386_linux_sigcontext_addr (struct frame_info *next_frame)
i386_linux_sigcontext_addr (struct frame_info *this_frame)
{
CORE_ADDR pc;
CORE_ADDR sp;
gdb_byte buf[4];
frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4);
pc = i386_linux_sigtramp_start (next_frame);
pc = i386_linux_sigtramp_start (this_frame);
if (pc)
{
/* The sigcontext structure lives on the stack, right after
@ -290,12 +290,12 @@ i386_linux_sigcontext_addr (struct frame_info *next_frame)
pointer. Keep in mind that the first instruction of the
sigtramp code is "pop %eax". If the PC is after this
instruction, adjust the returned value accordingly. */
if (pc == frame_pc_unwind (next_frame))
if (pc == get_frame_pc (this_frame))
return sp + 4;
return sp;
}
pc = i386_linux_rt_sigtramp_start (next_frame);
pc = i386_linux_rt_sigtramp_start (this_frame);
if (pc)
{
CORE_ADDR ucontext_addr;

View File

@ -204,13 +204,13 @@ i386nto_regset_fill (const struct regcache *regcache, int regset, char *data)
return 0;
}
/* Return whether the frame preceding NEXT_FRAME corresponds to a QNX
Neutrino sigtramp routine. */
/* Return whether THIS_FRAME corresponds to a QNX Neutrino sigtramp
routine. */
static int
i386nto_sigtramp_p (struct frame_info *next_frame)
i386nto_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
@ -219,16 +219,16 @@ i386nto_sigtramp_p (struct frame_info *next_frame)
#define I386_NTO_SIGCONTEXT_OFFSET 136
/* Assuming NEXT_FRAME is a frame following a QNX Neutrino sigtramp
routine, return the address of the associated sigcontext structure. */
/* Assuming THIS_FRAME is a QNX Neutrino sigtramp routine, return the
address of the associated sigcontext structure. */
static CORE_ADDR
i386nto_sigcontext_addr (struct frame_info *next_frame)
i386nto_sigcontext_addr (struct frame_info *this_frame)
{
char buf[4];
CORE_ADDR sp;
frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4);
return sp + I386_NTO_SIGCONTEXT_OFFSET;

View File

@ -49,13 +49,13 @@ static int i386_sol2_gregset_reg_offset[] =
0 * 4 /* %gs */
};
/* Return whether the frame preceding NEXT_FRAME corresponds to a
Solaris sigtramp routine. */
/* Return whether THIS_FRAME corresponds to a Solaris sigtramp
routine. */
static int
i386_sol2_sigtramp_p (struct frame_info *next_frame)
i386_sol2_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
@ -67,12 +67,12 @@ i386_sol2_sigtramp_p (struct frame_info *next_frame)
`mcontext_t' that contains the saved set of machine registers. */
static CORE_ADDR
i386_sol2_mcontext_addr (struct frame_info *next_frame)
i386_sol2_mcontext_addr (struct frame_info *this_frame)
{
CORE_ADDR sp, ucontext_addr;
sp = frame_unwind_register_unsigned (next_frame, I386_ESP_REGNUM);
ucontext_addr = get_frame_memory_unsigned (next_frame, sp + 8, 4);
sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
ucontext_addr = get_frame_memory_unsigned (this_frame, sp + 8, 4);
return ucontext_addr + 36;
}

View File

@ -956,7 +956,7 @@ i386_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
/* Normal frames. */
static struct i386_frame_cache *
i386_frame_cache (struct frame_info *next_frame, void **this_cache)
i386_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct i386_frame_cache *cache;
gdb_byte buf[4];
@ -977,7 +977,7 @@ i386_frame_cache (struct frame_info *next_frame, void **this_cache)
They (usually) share their frame pointer with the frame that was
in progress when the signal occurred. */
frame_unwind_register (next_frame, I386_EBP_REGNUM, buf);
get_frame_register (this_frame, I386_EBP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4);
if (cache->base == 0)
return cache;
@ -985,14 +985,14 @@ i386_frame_cache (struct frame_info *next_frame, void **this_cache)
/* For normal frames, %eip is stored at 4(%ebp). */
cache->saved_regs[I386_EIP_REGNUM] = 4;
cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
cache->pc = get_frame_func (this_frame);
if (cache->pc != 0)
i386_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
i386_analyze_prologue (cache->pc, get_frame_pc (this_frame), cache);
if (cache->stack_align)
{
/* Saved stack pointer has been saved in %ecx. */
frame_unwind_register (next_frame, I386_ECX_REGNUM, buf);
get_frame_register (this_frame, I386_ECX_REGNUM, buf);
cache->saved_sp = extract_unsigned_integer(buf, 4);
}
@ -1017,7 +1017,7 @@ i386_frame_cache (struct frame_info *next_frame, void **this_cache)
}
else
{
frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4) + cache->sp_offset;
}
}
@ -1037,10 +1037,10 @@ i386_frame_cache (struct frame_info *next_frame, void **this_cache)
}
static void
i386_frame_this_id (struct frame_info *next_frame, void **this_cache,
i386_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
struct i386_frame_cache *cache = i386_frame_cache (next_frame, this_cache);
struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@ -1050,13 +1050,11 @@ i386_frame_this_id (struct frame_info *next_frame, void **this_cache,
(*this_id) = frame_id_build (cache->base + 8, cache->pc);
}
static void
i386_frame_prev_register (struct frame_info *next_frame, void **this_cache,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, gdb_byte *valuep)
static struct value *
i386_frame_prev_register (struct frame_info *this_frame, void **this_cache,
int regnum)
{
struct i386_frame_cache *cache = i386_frame_cache (next_frame, this_cache);
struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache);
gdb_assert (regnum >= 0);
@ -1081,93 +1079,43 @@ i386_frame_prev_register (struct frame_info *next_frame, void **this_cache,
if (regnum == I386_EFLAGS_REGNUM)
{
*optimizedp = 0;
*lvalp = not_lval;
*addrp = 0;
*realnump = -1;
if (valuep)
{
ULONGEST val;
ULONGEST val;
/* Clear the direction flag. */
val = frame_unwind_register_unsigned (next_frame,
I386_EFLAGS_REGNUM);
val &= ~(1 << 10);
store_unsigned_integer (valuep, 4, val);
}
return;
val = get_frame_register_unsigned (this_frame, regnum);
val &= ~(1 << 10);
return frame_unwind_got_constant (this_frame, regnum, val);
}
if (regnum == I386_EIP_REGNUM && cache->pc_in_eax)
{
*optimizedp = 0;
*lvalp = lval_register;
*addrp = 0;
*realnump = I386_EAX_REGNUM;
if (valuep)
frame_unwind_register (next_frame, (*realnump), valuep);
return;
}
return frame_unwind_got_register (this_frame, regnum, I386_EAX_REGNUM);
if (regnum == I386_ESP_REGNUM && cache->saved_sp)
{
*optimizedp = 0;
*lvalp = not_lval;
*addrp = 0;
*realnump = -1;
if (valuep)
{
/* Store the value. */
store_unsigned_integer (valuep, 4, cache->saved_sp);
}
return;
}
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
if (regnum < I386_NUM_SAVED_REGS && cache->saved_regs[regnum] != -1)
{
*optimizedp = 0;
*lvalp = lval_memory;
*addrp = cache->saved_regs[regnum];
*realnump = -1;
if (valuep)
{
/* Read the value in from memory. */
read_memory (*addrp, valuep,
register_size (get_frame_arch (next_frame), regnum));
}
return;
}
return frame_unwind_got_memory (this_frame, regnum,
cache->saved_regs[regnum]);
*optimizedp = 0;
*lvalp = lval_register;
*addrp = 0;
*realnump = regnum;
if (valuep)
frame_unwind_register (next_frame, (*realnump), valuep);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
static const struct frame_unwind i386_frame_unwind =
{
NORMAL_FRAME,
i386_frame_this_id,
i386_frame_prev_register
i386_frame_prev_register,
NULL,
default_frame_sniffer
};
static const struct frame_unwind *
i386_frame_sniffer (struct frame_info *next_frame)
{
return &i386_frame_unwind;
}
/* Signal trampolines. */
static struct i386_frame_cache *
i386_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct i386_frame_cache *cache;
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
CORE_ADDR addr;
gdb_byte buf[4];
@ -1176,10 +1124,10 @@ i386_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
cache = i386_alloc_frame_cache ();
frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4) - 4;
addr = tdep->sigcontext_addr (next_frame);
addr = tdep->sigcontext_addr (this_frame);
if (tdep->sc_reg_offset)
{
int i;
@ -1201,70 +1149,70 @@ i386_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
}
static void
i386_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache,
i386_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
struct i386_frame_cache *cache =
i386_sigtramp_frame_cache (next_frame, this_cache);
i386_sigtramp_frame_cache (this_frame, this_cache);
/* See the end of i386_push_dummy_call. */
(*this_id) = frame_id_build (cache->base + 8, frame_pc_unwind (next_frame));
(*this_id) = frame_id_build (cache->base + 8, get_frame_pc (this_frame));
}
static void
i386_sigtramp_frame_prev_register (struct frame_info *next_frame,
void **this_cache,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, gdb_byte *valuep)
static struct value *
i386_sigtramp_frame_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
/* Make sure we've initialized the cache. */
i386_sigtramp_frame_cache (next_frame, this_cache);
i386_sigtramp_frame_cache (this_frame, this_cache);
i386_frame_prev_register (next_frame, this_cache, regnum,
optimizedp, lvalp, addrp, realnump, valuep);
return i386_frame_prev_register (this_frame, this_cache, regnum);
}
static int
i386_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_prologue_cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
/* We shouldn't even bother if we don't have a sigcontext_addr
handler. */
if (tdep->sigcontext_addr == NULL)
return 0;
if (tdep->sigtramp_p != NULL)
{
if (tdep->sigtramp_p (this_frame))
return 1;
}
if (tdep->sigtramp_start != 0)
{
CORE_ADDR pc = get_frame_pc (this_frame);
gdb_assert (tdep->sigtramp_end != 0);
if (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end)
return 1;
}
return 0;
}
static const struct frame_unwind i386_sigtramp_frame_unwind =
{
SIGTRAMP_FRAME,
i386_sigtramp_frame_this_id,
i386_sigtramp_frame_prev_register
i386_sigtramp_frame_prev_register,
NULL,
i386_sigtramp_frame_sniffer
};
static const struct frame_unwind *
i386_sigtramp_frame_sniffer (struct frame_info *next_frame)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
/* We shouldn't even bother if we don't have a sigcontext_addr
handler. */
if (tdep->sigcontext_addr == NULL)
return NULL;
if (tdep->sigtramp_p != NULL)
{
if (tdep->sigtramp_p (next_frame))
return &i386_sigtramp_frame_unwind;
}
if (tdep->sigtramp_start != 0)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
gdb_assert (tdep->sigtramp_end != 0);
if (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end)
return &i386_sigtramp_frame_unwind;
}
return NULL;
}
static CORE_ADDR
i386_frame_base_address (struct frame_info *next_frame, void **this_cache)
i386_frame_base_address (struct frame_info *this_frame, void **this_cache)
{
struct i386_frame_cache *cache = i386_frame_cache (next_frame, this_cache);
struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache);
return cache->base;
}
@ -1278,16 +1226,14 @@ static const struct frame_base i386_frame_base =
};
static struct frame_id
i386_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
i386_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
{
gdb_byte buf[4];
CORE_ADDR fp;
frame_unwind_register (next_frame, I386_EBP_REGNUM, buf);
fp = extract_unsigned_integer (buf, 4);
fp = get_frame_register_unsigned (this_frame, I386_EBP_REGNUM);
/* See the end of i386_push_dummy_call. */
return frame_id_build (fp + 8, frame_pc_unwind (next_frame));
return frame_id_build (fp + 8, get_frame_pc (this_frame));
}
@ -1371,7 +1317,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* MarkK wrote: This "+ 8" is all over the place:
(i386_frame_this_id, i386_sigtramp_frame_this_id,
i386_unwind_dummy_id). It's there, since all frame unwinders for
i386_dummy_id). It's there, since all frame unwinders for
a given target have to agree (within a certain margin) on the
definition of the stack address of a frame. Otherwise
frame_id_inner() won't work correctly. Since DWARF2/GCC uses the
@ -2108,13 +2054,13 @@ i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name)
}
/* Return whether the frame preceding NEXT_FRAME corresponds to a
sigtramp routine. */
/* Return whether the THIS_FRAME corresponds to a sigtramp
routine. */
static int
i386_sigtramp_p (struct frame_info *next_frame)
i386_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
@ -2146,13 +2092,13 @@ i386_print_insn (bfd_vma pc, struct disassemble_info *info)
/* System V Release 4 (SVR4). */
/* Return whether the frame preceding NEXT_FRAME corresponds to a SVR4
sigtramp routine. */
/* Return whether THIS_FRAME corresponds to a SVR4 sigtramp
routine. */
static int
i386_svr4_sigtramp_p (struct frame_info *next_frame)
i386_svr4_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
char *name;
/* UnixWare uses _sigacthandler. The origin of the other symbols is
@ -2163,17 +2109,16 @@ i386_svr4_sigtramp_p (struct frame_info *next_frame)
|| strcmp ("sigvechandler", name) == 0));
}
/* Assuming NEXT_FRAME is for a frame following a SVR4 sigtramp
routine, return the address of the associated sigcontext (ucontext)
structure. */
/* Assuming THIS_FRAME is for a SVR4 sigtramp routine, return the
address of the associated sigcontext (ucontext) structure. */
static CORE_ADDR
i386_svr4_sigcontext_addr (struct frame_info *next_frame)
i386_svr4_sigcontext_addr (struct frame_info *this_frame)
{
gdb_byte buf[4];
CORE_ADDR sp;
frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4);
return read_memory_unsigned_integer (sp + 8, 4);
@ -2440,7 +2385,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, i386_print_insn);
set_gdbarch_unwind_dummy_id (gdbarch, i386_unwind_dummy_id);
set_gdbarch_dummy_id (gdbarch, i386_dummy_id);
set_gdbarch_unwind_pc (gdbarch, i386_unwind_pc);
@ -2452,15 +2397,15 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_fetch_pointer_argument (gdbarch, i386_fetch_pointer_argument);
/* Hook in the DWARF CFI frame unwinder. */
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
dwarf2_append_unwinders (gdbarch);
frame_base_set_default (gdbarch, &i386_frame_base);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
frame_unwind_append_sniffer (gdbarch, i386_sigtramp_frame_sniffer);
frame_unwind_append_sniffer (gdbarch, i386_frame_sniffer);
frame_unwind_append_unwinder (gdbarch, &i386_sigtramp_frame_unwind);
frame_unwind_append_unwinder (gdbarch, &i386_frame_unwind);
/* If we have a register mapping, enable the generic core file
support, unless it has already been enabled. */

View File

@ -31,16 +31,16 @@
/* Support for signal handlers. */
/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp
routine, return the address of the associated sigcontext structure. */
/* Assuming THIS_FRAME is for a BSD sigtramp routine, return the
address of the associated sigcontext structure. */
static CORE_ADDR
i386bsd_sigcontext_addr (struct frame_info *next_frame)
i386bsd_sigcontext_addr (struct frame_info *this_frame)
{
gdb_byte buf[4];
CORE_ADDR sp;
frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4);
return read_memory_unsigned_integer (sp + 8, 4);

View File

@ -228,13 +228,13 @@ static const struct tramp_frame i386nbsd_sigtramp_si4 =
static void
i386nbsd_sigtramp_cache_init (const struct tramp_frame *self,
struct frame_info *next_frame,
struct trad_frame_cache *this_cache,
CORE_ADDR func)
struct frame_info *this_frame,
struct trad_frame_cache *this_cache,
CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
CORE_ADDR sp = frame_unwind_register_unsigned (next_frame, I386_ESP_REGNUM);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
CORE_ADDR base;
int *reg_offset;
int num_regs;

View File

@ -63,13 +63,13 @@ static const int i386obsd_sigreturn_offset[] = {
-1
};
/* Return whether the frame preceding NEXT_FRAME corresponds to an
OpenBSD sigtramp routine. */
/* Return whether THIS_FRAME corresponds to an OpenBSD sigtramp
routine. */
static int
i386obsd_sigtramp_p (struct frame_info *next_frame)
i386obsd_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
CORE_ADDR start_pc = (pc & ~(i386obsd_page_size - 1));
/* The call sequence invoking sigreturn(2). */
const gdb_byte sigreturn[] =
@ -101,7 +101,7 @@ i386obsd_sigtramp_p (struct frame_info *next_frame)
for (offset = i386obsd_sigreturn_offset; *offset != -1; offset++)
{
/* If we can't read the instructions, return zero. */
if (!safe_frame_unwind_memory (next_frame, start_pc + *offset,
if (!safe_frame_unwind_memory (this_frame, start_pc + *offset,
buf, buflen))
return 0;
@ -337,7 +337,7 @@ static int i386obsd_tf_reg_offset[] =
};
static struct trad_frame_cache *
i386obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
i386obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
{
struct trad_frame_cache *cache;
CORE_ADDR func, sp, addr;
@ -348,13 +348,11 @@ i386obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
if (*this_cache)
return *this_cache;
cache = trad_frame_cache_zalloc (next_frame);
cache = trad_frame_cache_zalloc (this_frame);
*this_cache = cache;
/* NORMAL_FRAME matches the type in i386obsd_trapframe_unwind, but
SIGTRAMP_FRAME might be more appropriate. */
func = frame_func_unwind (next_frame, NORMAL_FRAME);
sp = frame_unwind_register_unsigned (next_frame, I386_ESP_REGNUM);
func = get_frame_func (this_frame);
sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
find_pc_partial_function (func, &name, NULL, NULL);
if (name && strncmp (name, "Xintr", 5) == 0)
@ -384,32 +382,28 @@ i386obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
}
static void
i386obsd_trapframe_this_id (struct frame_info *next_frame,
i386obsd_trapframe_this_id (struct frame_info *this_frame,
void **this_cache, struct frame_id *this_id)
{
struct trad_frame_cache *cache =
i386obsd_trapframe_cache (next_frame, this_cache);
i386obsd_trapframe_cache (this_frame, this_cache);
trad_frame_get_id (cache, this_id);
}
static void
i386obsd_trapframe_prev_register (struct frame_info *next_frame,
void **this_cache, int regnum,
int *optimizedp, enum lval_type *lvalp,
CORE_ADDR *addrp, int *realnump,
gdb_byte *valuep)
static struct value *
i386obsd_trapframe_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
struct trad_frame_cache *cache =
i386obsd_trapframe_cache (next_frame, this_cache);
i386obsd_trapframe_cache (this_frame, this_cache);
trad_frame_get_register (cache, next_frame, regnum,
optimizedp, lvalp, addrp, realnump, valuep);
return trad_frame_get_register (cache, this_frame, regnum);
}
static int
i386obsd_trapframe_sniffer (const struct frame_unwind *self,
struct frame_info *next_frame,
struct frame_info *this_frame,
void **this_prologue_cache)
{
ULONGEST cs;
@ -417,11 +411,11 @@ i386obsd_trapframe_sniffer (const struct frame_unwind *self,
/* Check Current Privilege Level and bail out if we're not executing
in kernel space. */
cs = frame_unwind_register_unsigned (next_frame, I386_CS_REGNUM);
cs = get_frame_register_unsigned (this_frame, I386_CS_REGNUM);
if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
return 0;
find_pc_partial_function (frame_pc_unwind (next_frame), &name, NULL, NULL);
find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
return (name && (strcmp (name, "calltrap") == 0
|| strcmp (name, "syscall1") == 0
|| strncmp (name, "Xintr", 5) == 0