2002-02-24 23:14:33 +01:00
|
|
|
|
/* Target-dependent code for GNU/Linux running on x86-64, for GDB.
|
|
|
|
|
|
|
|
|
|
Copyright 2001 Free Software Foundation, Inc.
|
|
|
|
|
|
2001-09-21 14:19:15 +02:00
|
|
|
|
Contributed by Jiri Smid, SuSE Labs.
|
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "inferior.h"
|
|
|
|
|
#include "gdbcore.h"
|
2002-09-03 15:06:33 +02:00
|
|
|
|
#include "gdb_string.h"
|
2001-09-21 14:19:15 +02:00
|
|
|
|
#include "regcache.h"
|
|
|
|
|
#include "x86-64-tdep.h"
|
|
|
|
|
#include "dwarf2cfi.h"
|
2003-01-06 21:45:30 +01:00
|
|
|
|
#include "osabi.h"
|
2001-09-21 14:19:15 +02:00
|
|
|
|
|
|
|
|
|
#define LINUX_SIGTRAMP_INSN0 (0x48) /* mov $NNNNNNNN,%rax */
|
|
|
|
|
#define LINUX_SIGTRAMP_OFFSET0 (0)
|
|
|
|
|
#define LINUX_SIGTRAMP_INSN1 (0x0f) /* syscall */
|
|
|
|
|
#define LINUX_SIGTRAMP_OFFSET1 (7)
|
|
|
|
|
|
|
|
|
|
static const unsigned char linux_sigtramp_code[] = {
|
2002-10-24 03:37:40 +02:00
|
|
|
|
/* mov $__NR_rt_sigreturn,%rax */
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
LINUX_SIGTRAMP_INSN0, 0xc7, 0xc0, 0x0f, 0x00, 0x00, 0x00,
|
|
|
|
|
/* syscall */
|
|
|
|
|
LINUX_SIGTRAMP_INSN1, 0x05
|
2001-09-21 14:19:15 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
|
|
|
|
|
|
|
|
|
|
/* If PC is in a sigtramp routine, return the address of the start of
|
|
|
|
|
the routine. Otherwise, return 0. */
|
|
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
|
x86_64_linux_sigtramp_start (CORE_ADDR pc)
|
|
|
|
|
{
|
|
|
|
|
unsigned char buf[LINUX_SIGTRAMP_LEN];
|
|
|
|
|
if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (buf[0] != LINUX_SIGTRAMP_INSN0)
|
|
|
|
|
{
|
|
|
|
|
if (buf[0] != LINUX_SIGTRAMP_INSN1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
pc -= LINUX_SIGTRAMP_OFFSET1;
|
|
|
|
|
|
|
|
|
|
if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return pc;
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
#define LINUX_SIGINFO_SIZE 0
|
2001-09-25 12:37:17 +02:00
|
|
|
|
|
2001-09-21 14:19:15 +02:00
|
|
|
|
/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
#define LINUX_UCONTEXT_SIGCONTEXT_OFFSET 40
|
|
|
|
|
|
|
|
|
|
/* Offset to saved PC in sigcontext, from <asm/sigcontext.h>. */
|
|
|
|
|
#define LINUX_SIGCONTEXT_PC_OFFSET 128
|
|
|
|
|
#define LINUX_SIGCONTEXT_FP_OFFSET 120
|
2001-09-21 14:19:15 +02:00
|
|
|
|
|
2002-02-24 23:14:33 +01:00
|
|
|
|
/* Assuming FRAME is for a GNU/Linux sigtramp routine, return the
|
|
|
|
|
address of the associated sigcontext structure. */
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
static CORE_ADDR
|
2001-09-21 14:19:15 +02:00
|
|
|
|
x86_64_linux_sigcontext_addr (struct frame_info *frame)
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR pc;
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
ULONGEST rsp;
|
2001-09-21 14:19:15 +02:00
|
|
|
|
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 23:20:47 +01:00
|
|
|
|
pc = x86_64_linux_sigtramp_start (get_frame_pc (frame));
|
2001-09-21 14:19:15 +02:00
|
|
|
|
if (pc)
|
|
|
|
|
{
|
|
|
|
|
if (frame->next)
|
|
|
|
|
/* If this isn't the top frame, the next frame must be for the
|
|
|
|
|
signal handler itself. The sigcontext structure is part of
|
|
|
|
|
the user context. */
|
2001-09-25 12:37:17 +02:00
|
|
|
|
return frame->next->frame + LINUX_SIGINFO_SIZE +
|
2001-09-21 14:19:15 +02:00
|
|
|
|
LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* This is the top frame. */
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
rsp = read_register (SP_REGNUM);
|
2002-10-24 03:37:40 +02:00
|
|
|
|
return rsp + LINUX_SIGINFO_SIZE + LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
|
2001-09-21 14:19:15 +02:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
error ("Couldn't recognize signal trampoline.");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-24 23:14:33 +01:00
|
|
|
|
/* Assuming FRAME is for a GNU/Linux sigtramp routine, return the
|
|
|
|
|
saved program counter. */
|
2001-09-21 14:19:15 +02:00
|
|
|
|
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
static CORE_ADDR
|
2001-09-21 14:19:15 +02:00
|
|
|
|
x86_64_linux_sigtramp_saved_pc (struct frame_info *frame)
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
|
|
|
|
|
addr = x86_64_linux_sigcontext_addr (frame);
|
|
|
|
|
return read_memory_integer (addr + LINUX_SIGCONTEXT_PC_OFFSET, 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Immediately after a function call, return the saved pc. */
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
x86_64_linux_saved_pc_after_call (struct frame_info *frame)
|
|
|
|
|
{
|
2002-11-18 23:19:33 +01:00
|
|
|
|
if ((get_frame_type (frame) == SIGTRAMP_FRAME))
|
2001-09-21 14:19:15 +02:00
|
|
|
|
return x86_64_linux_sigtramp_saved_pc (frame);
|
|
|
|
|
|
|
|
|
|
return read_memory_integer (read_register (SP_REGNUM), 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Saved Pc. Get it from sigcontext if within sigtramp. */
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
x86_64_linux_frame_saved_pc (struct frame_info *frame)
|
|
|
|
|
{
|
2002-11-18 23:19:33 +01:00
|
|
|
|
if ((get_frame_type (frame) == SIGTRAMP_FRAME))
|
2001-09-21 14:19:15 +02:00
|
|
|
|
return x86_64_linux_sigtramp_saved_pc (frame);
|
|
|
|
|
return cfi_get_ra (frame);
|
|
|
|
|
}
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
|
|
|
|
|
/* Return whether PC is in a GNU/Linux sigtramp routine. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
x86_64_linux_in_sigtramp (CORE_ADDR pc, char *name)
|
|
|
|
|
{
|
|
|
|
|
if (name)
|
|
|
|
|
return STREQ ("__restore_rt", name);
|
2002-10-24 03:37:40 +02:00
|
|
|
|
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
return (x86_64_linux_sigtramp_start (pc) != 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
x86_64_linux_frame_chain (struct frame_info *fi)
|
|
|
|
|
{
|
2002-10-24 03:37:40 +02:00
|
|
|
|
ULONGEST addr;
|
|
|
|
|
CORE_ADDR fp, pc;
|
|
|
|
|
|
2002-11-18 23:19:33 +01:00
|
|
|
|
if (!(get_frame_type (fi) == SIGTRAMP_FRAME))
|
2002-10-24 03:37:40 +02:00
|
|
|
|
{
|
|
|
|
|
fp = cfi_frame_chain (fi);
|
|
|
|
|
if (fp)
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
return fp;
|
2002-10-24 03:37:40 +02:00
|
|
|
|
else
|
|
|
|
|
addr = fi->frame;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
addr = fi->next->frame;
|
|
|
|
|
|
|
|
|
|
addr += LINUX_SIGINFO_SIZE + LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
|
|
|
|
|
|
|
|
|
|
fp = read_memory_integer (addr + LINUX_SIGCONTEXT_FP_OFFSET, 8) + 8;
|
|
|
|
|
|
|
|
|
|
return fp;
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-09 03:04:17 +01:00
|
|
|
|
CORE_ADDR
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
x86_64_init_frame_pc (int fromleaf, struct frame_info *fi)
|
|
|
|
|
{
|
2002-10-24 03:37:40 +02:00
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
|
2002-12-09 03:04:17 +01:00
|
|
|
|
if (get_next_frame (fi) && (get_frame_type (fi->next) == SIGTRAMP_FRAME))
|
2002-10-24 03:37:40 +02:00
|
|
|
|
{
|
2002-12-09 03:04:17 +01:00
|
|
|
|
addr = get_frame_base (get_next_frame (get_next_frame (fi)))
|
2002-10-24 03:37:40 +02:00
|
|
|
|
+ LINUX_SIGINFO_SIZE + LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
|
2002-12-09 03:04:17 +01:00
|
|
|
|
return read_memory_integer (addr + LINUX_SIGCONTEXT_PC_OFFSET, 8);
|
2002-10-24 03:37:40 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-12-09 03:04:17 +01:00
|
|
|
|
return cfi_init_frame_pc (fromleaf, fi);
|
2002-10-24 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (struct context)
(struct context_reg): Moved to dwarf2cfi.h
(context_alloc, frame_state_alloc, context_cpy):
Made extern instead of static, removed prototypes.
* dwarf2cfi.h (struct context)
(struct context_reg): New, moved from dwarf2cfi.c
(context_alloc, frame_state_alloc, context_cpy):
New prototypes.
* x86-64-linux-tdep.c (x86_64_linux_sigtramp_saved_pc):
Changed from static to extern.
(LINUX_SIGINFO_SIZE, LINUX_SIGCONTEXT_PC_OFFSET)
(LINUX_SIGCONTEXT_FP_OFFSET)
(LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Adjusted.
(x86_64_linux_in_sigtramp, x86_64_linux_frame_chain)
(x86_64_init_frame_pc, x86_64_init_extra_frame_info): New.
* x86-64-tdep.c (x86_64_gdbarch_init): Several
set_gdbarch_*() calls now use x86-64 specific functions
instead of DWARF2 CFI ones.
* x86-64-tdep.h (x86_64_linux_in_sigtramp)
(x86_64_linux_frame_chain, x86_64_init_frame_pc)
(x86_64_init_extra_frame_info): New prototypes.
2002-10-24 03:27:43 +02:00
|
|
|
|
}
|
2002-12-21 22:09:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
x86_64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|
|
|
|
{
|
|
|
|
|
x86_64_init_abi (info, gdbarch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
|
|
|
|
extern void _initialize_x86_64_linux_tdep (void);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_initialize_x86_64_linux_tdep (void)
|
|
|
|
|
{
|
|
|
|
|
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_LINUX,
|
|
|
|
|
x86_64_linux_init_abi);
|
|
|
|
|
}
|