2002-02-24 22:14:33 +00:00
|
|
|
|
/* Target-dependent code for GNU/Linux running on x86-64, for GDB.
|
|
|
|
|
|
2003-01-13 Andrew Cagney <ac131313@redhat.com>
* ax-gdb.c, c-valprint.c, charset.c, corefile.c: Update copyright.
* demangle.c, disasm.c, dwarf2cfi.c, dwarfread.c: Update copyright.
* elfread.c, eval.c, expprint.c, expression.h: Update copyright.
* f-typeprint.c, findvar.c, gcore.c, gdb_mbuild.sh: Update copyright.
* gdbtypes.h, gnu-v2-abi.c, inferior.h, inftarg.c: Update copyright.
* language.c, language.h, m32r-tdep.c: Update copyright.
* mn10200-tdep.c, scm-lang.c, scm-lang.h: Update copyright.
* somsolib.c, somsolib.h, symfile.c, symtab.h: Update copyright.
* thread-db.c, typeprint.c, utils.c, valarith.c: Update copyright.
* values.c, win32-nat.c, x86-64-linux-nat.c: Update copyright.
* x86-64-linux-tdep.c, z8k-tdep.c: Update copyright.
* cli/cli-decode.h, config/h8500/tm-h8500.h: Update copyright.
Index: mi/ChangeLog
2003-01-13 Andrew Cagney <ac131313@redhat.com>
* mi-cmd-env.c: Update copyright.
2003-01-14 00:49:06 +00:00
|
|
|
|
Copyright 2001, 2003 Free Software Foundation, Inc.
|
2002-02-24 22:14:33 +00:00
|
|
|
|
|
2001-09-21 12:19:15 +00: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 13:06:33 +00:00
|
|
|
|
#include "gdb_string.h"
|
2001-09-21 12:19:15 +00:00
|
|
|
|
#include "regcache.h"
|
|
|
|
|
#include "x86-64-tdep.h"
|
|
|
|
|
#include "dwarf2cfi.h"
|
2003-01-06 20:45:30 +00:00
|
|
|
|
#include "osabi.h"
|
2001-09-21 12:19:15 +00: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 01:37:40 +00: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 01:27:43 +00:00
|
|
|
|
LINUX_SIGTRAMP_INSN0, 0xc7, 0xc0, 0x0f, 0x00, 0x00, 0x00,
|
|
|
|
|
/* syscall */
|
|
|
|
|
LINUX_SIGTRAMP_INSN1, 0x05
|
2001-09-21 12:19:15 +00: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 01:27:43 +00:00
|
|
|
|
#define LINUX_SIGINFO_SIZE 0
|
2001-09-25 10:37:17 +00:00
|
|
|
|
|
2001-09-21 12:19:15 +00: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 01:27:43 +00: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 12:19:15 +00:00
|
|
|
|
|
2002-02-24 22:14:33 +00: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 01:27:43 +00:00
|
|
|
|
static CORE_ADDR
|
2001-09-21 12:19:15 +00: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 01:27:43 +00:00
|
|
|
|
ULONGEST rsp;
|
2001-09-21 12:19:15 +00: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 22:20:47 +00:00
|
|
|
|
pc = x86_64_linux_sigtramp_start (get_frame_pc (frame));
|
2001-09-21 12:19:15 +00:00
|
|
|
|
if (pc)
|
|
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-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: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
|
if (get_next_frame (frame))
|
2001-09-21 12:19:15 +00:00
|
|
|
|
/* 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. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-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: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
|
return get_frame_base (get_next_frame (frame)) + LINUX_SIGINFO_SIZE +
|
2001-09-21 12:19:15 +00: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 01:27:43 +00:00
|
|
|
|
rsp = read_register (SP_REGNUM);
|
2002-10-24 01:37:40 +00:00
|
|
|
|
return rsp + LINUX_SIGINFO_SIZE + LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
|
2001-09-21 12:19:15 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
error ("Couldn't recognize signal trampoline.");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-24 22:14:33 +00:00
|
|
|
|
/* Assuming FRAME is for a GNU/Linux sigtramp routine, return the
|
|
|
|
|
saved program counter. */
|
2001-09-21 12:19:15 +00: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 01:27:43 +00:00
|
|
|
|
static CORE_ADDR
|
2001-09-21 12:19:15 +00: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 22:19:33 +00:00
|
|
|
|
if ((get_frame_type (frame) == SIGTRAMP_FRAME))
|
2001-09-21 12:19:15 +00: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 22:19:33 +00:00
|
|
|
|
if ((get_frame_type (frame) == SIGTRAMP_FRAME))
|
2001-09-21 12:19:15 +00: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 01:27:43 +00:00
|
|
|
|
|
|
|
|
|
/* Return whether PC is in a GNU/Linux sigtramp routine. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
x86_64_linux_in_sigtramp (CORE_ADDR pc, char *name)
|
|
|
|
|
{
|
|
|
|
|
if (name)
|
2003-01-09 18:30:32 +00:00
|
|
|
|
return strcmp ("__restore_rt", name) == 0;
|
2002-10-24 01:37:40 +00: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 01:27:43 +00:00
|
|
|
|
return (x86_64_linux_sigtramp_start (pc) != 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
x86_64_linux_frame_chain (struct frame_info *fi)
|
|
|
|
|
{
|
2002-10-24 01:37:40 +00:00
|
|
|
|
ULONGEST addr;
|
|
|
|
|
CORE_ADDR fp, pc;
|
|
|
|
|
|
2002-11-18 22:19:33 +00:00
|
|
|
|
if (!(get_frame_type (fi) == SIGTRAMP_FRAME))
|
2002-10-24 01:37:40 +00: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 01:27:43 +00:00
|
|
|
|
return fp;
|
2002-10-24 01:37:40 +00:00
|
|
|
|
else
|
2003-01-07 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_base.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10200-tdep.c: Ditto.
* mn10300-tdep.c, ns32k-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c: Ditto.
* x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* config/h8500/tm-h8500.h, config/mn10200/tm-mn10200.h: Ditto.
* config/sparc/tm-sparc.h: Ditto.
2003-01-08 01:53:38 +00:00
|
|
|
|
addr = get_frame_base (fi);
|
2002-10-24 01:37:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-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: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
|
addr = get_frame_base (get_next_frame (fi));
|
2002-10-24 01:37:40 +00:00
|
|
|
|
|
|
|
|
|
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 01:27:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-09 02:04:17 +00: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 01:27:43 +00:00
|
|
|
|
x86_64_init_frame_pc (int fromleaf, struct frame_info *fi)
|
|
|
|
|
{
|
2002-10-24 01:37:40 +00:00
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-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: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
|
if (get_next_frame (fi)
|
|
|
|
|
&& (get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
|
2002-10-24 01:37:40 +00:00
|
|
|
|
{
|
2002-12-09 02:04:17 +00:00
|
|
|
|
addr = get_frame_base (get_next_frame (get_next_frame (fi)))
|
2002-10-24 01:37:40 +00:00
|
|
|
|
+ LINUX_SIGINFO_SIZE + LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
|
2002-12-09 02:04:17 +00:00
|
|
|
|
return read_memory_integer (addr + LINUX_SIGCONTEXT_PC_OFFSET, 8);
|
2002-10-24 01:37:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-12-09 02:04:17 +00: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 01:27:43 +00:00
|
|
|
|
}
|
2002-12-21 21:09:58 +00: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);
|
|
|
|
|
}
|