diff options
author | nobody <> | 2002-05-06 21:00:22 +0000 |
---|---|---|
committer | nobody <> | 2002-05-06 21:00:22 +0000 |
commit | 275602c398b33b8475860af024b006bbbbd495ac (patch) | |
tree | 22412a7722268bd297101bcf3e788a3d585c020c /gdb/x86-64-linux-nat.c | |
parent | 694b26b8e881dd7336e3c0634731f2eee1c1cda6 (diff) | |
download | binutils-gdb-275602c398b33b8475860af024b006bbbbd495ac.tar.gz |
This commit was manufactured by cvs2svn to create branch 'jimb-jimb-macro-020506-branchpoint
macro-020506-branch'.
Sprout from gdb_5_2-branch 2002-03-27 05:12:36 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'gdb_5_2-branch'.'
Cherrypick from gdb_5_2-branch 2002-03-02 23:00:05 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'gdb_5_2-branch'.':
intl/ChangeLog
intl/Makefile.in
Cherrypick from master 2002-05-06 21:00:21 UTC Jim Blandy <jimb@codesourcery.com> 'Separate the job of reading the line number info statement program':
ChangeLog
MAINTAINERS
Makefile.in
bfd/ChangeLog
bfd/ChangeLog-9495
bfd/Makefile.am
bfd/Makefile.in
bfd/aix5ppc-core.c
bfd/aout-adobe.c
bfd/aout-target.h
bfd/aout-tic30.c
bfd/aoutx.h
bfd/archive.c
bfd/archures.c
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/bfd.c
bfd/binary.c
bfd/bout.c
bfd/coff-arm.c
bfd/coff-h8300.c
bfd/coff-mcore.c
bfd/coff-ppc.c
bfd/coff-rs6000.c
bfd/coff-sh.c
bfd/coff-z8k.c
bfd/coff64-rs6000.c
bfd/coffcode.h
bfd/cofflink.c
bfd/coffswap.h
bfd/config.bfd
bfd/configure
bfd/configure.in
bfd/cpu-h8300.c
bfd/cpu-i370.c
bfd/cpu-i386.c
bfd/cpu-mips.c
bfd/cpu-powerpc.c
bfd/cpu-s390.c
bfd/cpu-sh.c
bfd/cpu-sparc.c
bfd/dep-in.sed
bfd/doc/ChangeLog
bfd/doc/Makefile.in
bfd/dwarf2.c
bfd/ecoff.c
bfd/elf-bfd.h
bfd/elf-eh-frame.c
bfd/elf-hppa.h
bfd/elf-m10300.c
bfd/elf.c
bfd/elf32-arm.h
bfd/elf32-cris.c
bfd/elf32-hppa.c
bfd/elf32-hppa.h
bfd/elf32-i370.c
bfd/elf32-i386.c
bfd/elf32-m32r.c
bfd/elf32-m68k.c
bfd/elf32-mips.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-sh64.c
bfd/elf32-sparc.c
bfd/elf32-xstormy16.c
bfd/elf64-alpha.c
bfd/elf64-hppa.c
bfd/elf64-mips.c
bfd/elf64-mmix.c
bfd/elf64-ppc.c
bfd/elf64-ppc.h
bfd/elf64-s390.c
bfd/elf64-sh64.c
bfd/elf64-sparc.c
bfd/elf64-x86-64.c
bfd/elfarm-nabi.c
bfd/elflink.c
bfd/elflink.h
bfd/elfxx-ia64.c
bfd/elfxx-mips.c
bfd/elfxx-mips.h
bfd/elfxx-target.h
bfd/i386linux.c
bfd/i386msdos.c
bfd/i386os9k.c
bfd/ieee.c
bfd/ihex.c
bfd/libbfd-in.h
bfd/libbfd.c
bfd/libbfd.h
bfd/libcoff-in.h
bfd/libcoff.h
bfd/libecoff.h
bfd/libxcoff.h
bfd/linker.c
bfd/m68klinux.c
bfd/merge.c
bfd/mmo.c
bfd/nlm-target.h
bfd/oasys.c
bfd/opncls.c
bfd/pdp11.c
bfd/po/SRC-POTFILES.in
bfd/po/fr.po
bfd/ppcboot.c
bfd/reloc.c
bfd/rs6000-core.c
bfd/som.c
bfd/sparclinux.c
bfd/srec.c
bfd/sunos.c
bfd/syms.c
bfd/targets.c
bfd/tekhex.c
bfd/versados.c
bfd/version.h
bfd/vms.c
bfd/xcofflink.c
config.guess
config.sub
config/ChangeLog
config/acinclude.m4
config/mh-a68bsd
config/mh-apollo68
config/mh-cxux
config/mh-decstation
config/mh-dgux
config/mh-dgux386
config/mh-djgpp
config/mh-hp300
config/mh-hpux
config/mh-hpux8
config/mh-interix
config/mh-irix5
config/mh-irix6
config/mh-lynxrs6k
config/mh-mingw32
config/mh-ncr3000
config/mh-ncrsvr43
config/mh-necv4
config/mh-openedition
config/mh-riscos
config/mh-sco
config/mh-solaris
config/mh-sysv
config/mh-sysv4
config/mh-sysv5
config/mt-aix43
config/mt-alphaieee
config/mt-linux
configure
configure.in
gdb/ChangeLog
gdb/MAINTAINERS
gdb/Makefile.in
gdb/NEWS
gdb/PROBLEMS
gdb/README
gdb/acconfig.h
gdb/acinclude.m4
gdb/aclocal.m4
gdb/alpha-linux-tdep.c
gdb/alpha-nat.c
gdb/alpha-osf1-tdep.c
gdb/alpha-tdep.c
gdb/alpha-tdep.h
gdb/alphabsd-nat.c
gdb/alphafbsd-tdep.c
gdb/alphanbsd-nat.c
gdb/alphanbsd-tdep.c
gdb/arc-tdep.c
gdb/arch-utils.c
gdb/arch-utils.h
gdb/arm-tdep.c
gdb/arm-tdep.h
gdb/avr-tdep.c
gdb/bcache.c
gdb/blockframe.c
gdb/breakpoint.c
gdb/builtin-regs.c
gdb/builtin-regs.h
gdb/c-exp.y
gdb/c-lang.c
gdb/cli-out.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-decode.h
gdb/cli/cli-dump.c
gdb/cli/cli-dump.h
gdb/cli/cli-script.c
gdb/coffread.c
gdb/command.h
gdb/completer.c
gdb/config.in
gdb/config/alpha/alpha-linux.mt
gdb/config/alpha/alpha-osf1.mt
gdb/config/alpha/nbsd.mh
gdb/config/alpha/nbsd.mt
gdb/config/alpha/nm-linux.h
gdb/config/alpha/nm-nbsd.h
gdb/config/alpha/nm-osf.h
gdb/config/alpha/tm-alpha.h
gdb/config/alpha/tm-alphalinux.h
gdb/config/alpha/tm-fbsd.h
gdb/config/alpha/tm-nbsd.h
gdb/config/arc/tm-arc.h
gdb/config/avr/avr.mt
gdb/config/djgpp/README
gdb/config/h8500/tm-h8500.h
gdb/config/i386/fbsd.mh
gdb/config/i386/i386gnu.mh
gdb/config/i386/i386lynx.mh
gdb/config/i386/i386v42mp.mh
gdb/config/i386/nbsd.mt
gdb/config/i386/nbsdelf.mt
gdb/config/i386/nm-fbsd.h
gdb/config/i386/nm-x86-64.h
gdb/config/i386/tm-linux.h
gdb/config/i386/x86-64linux.mt
gdb/config/i960/tm-i960.h
gdb/config/m32r/m32r.mt
gdb/config/m68k/m68klynx.mh
gdb/config/m68k/nbsd.mt
gdb/config/m68k/sun3os4.mh
gdb/config/m68k/tm-nbsd.h
gdb/config/mcore/tm-mcore.h
gdb/config/mips/vr5000.mt
gdb/config/mn10200/tm-mn10200.h
gdb/config/ns32k/nbsd.mt
gdb/config/pa/hppabsd.mh
gdb/config/pa/hppaosf.mh
gdb/config/pa/hpux1020.mh
gdb/config/pa/hpux11.mh
gdb/config/pa/hpux11w.mh
gdb/config/pa/tm-hppa.h
gdb/config/powerpc/nbsd.mt
gdb/config/powerpc/tm-ppc-eabi.h
gdb/config/rs6000/rs6000lynx.mh
gdb/config/rs6000/tm-rs6000.h
gdb/config/s390/s390.mh
gdb/config/s390/s390.mt
gdb/config/s390/s390x.mt
gdb/config/sparc/fbsd.mh
gdb/config/sparc/fbsd.mt
gdb/config/sparc/linux.mh
gdb/config/sparc/sparclynx.mh
gdb/config/sparc/sun4os4.mh
gdb/config/sparc/tm-linux.h
gdb/config/sparc/tm-sp64.h
gdb/config/sparc/tm-sp64linux.h
gdb/config/sparc/tm-sparc.h
gdb/config/v850/tm-v850.h
gdb/config/vax/tm-vax.h
gdb/configure
gdb/configure.host
gdb/configure.in
gdb/configure.tgt
gdb/core-sol2.c
gdb/corefile.c
gdb/corelow.c
gdb/cp-valprint.c
gdb/cris-tdep.c
gdb/d10v-tdep.c
gdb/d30v-tdep.c
gdb/dbxread.c
gdb/defs.h
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/doc/gdbint.texinfo
gdb/dwarf2cfi.c
gdb/dwarf2read.c
gdb/elfread.c
gdb/eval.c
gdb/event-top.c
gdb/exec.c
gdb/f-exp.y
gdb/f-lang.c
gdb/fbsd-proc.c
gdb/findvar.c
gdb/frame.c
gdb/frame.h
gdb/gcore.c
gdb/gdb-events.c
gdb/gdb-events.h
gdb/gdb-events.sh
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbserver/Makefile.in
gdb/gdbserver/config.in
gdb/gdbserver/configure
gdb/gdbserver/configure.in
gdb/gdbserver/gdbreplay.c
gdb/gdbserver/inferiors.c
gdb/gdbserver/linux-arm-low.c
gdb/gdbserver/linux-i386-low.c
gdb/gdbserver/linux-ia64-low.c
gdb/gdbserver/linux-low.c
gdb/gdbserver/linux-low.h
gdb/gdbserver/linux-m68k-low.c
gdb/gdbserver/linux-mips-low.c
gdb/gdbserver/linux-ppc-low.c
gdb/gdbserver/linux-s390-low.c
gdb/gdbserver/linux-sh-low.c
gdb/gdbserver/linux-x86-64-low.c
gdb/gdbserver/mem-break.c
gdb/gdbserver/mem-break.h
gdb/gdbserver/regcache.c
gdb/gdbserver/regcache.h
gdb/gdbserver/remote-utils.c
gdb/gdbserver/server.c
gdb/gdbserver/server.h
gdb/gdbserver/target.c
gdb/gdbserver/target.h
gdb/gdbserver/utils.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-nat.c
gdb/gnu-v3-abi.c
gdb/go32-nat.c
gdb/gregset.h
gdb/h8300-tdep.c
gdb/h8500-tdep.c
gdb/hppa-tdep.c
gdb/hpread.c
gdb/i386-linux-tdep.c
gdb/i386-tdep.c
gdb/i386gnu-nat.c
gdb/i387-nat.c
gdb/i960-tdep.c
gdb/ia64-tdep.c
gdb/infcmd.c
gdb/inferior.h
gdb/inflow.c
gdb/infrun.c
gdb/jv-exp.y
gdb/kod.c
gdb/language.c
gdb/lin-lwp.c
gdb/linespec.c
gdb/linux-proc.c
gdb/m2-exp.y
gdb/m3-nat.c
gdb/m68hc11-tdep.c
gdb/m68klinux-nat.c
gdb/maint.c
gdb/mcore-tdep.c
gdb/mdebugread.c
gdb/mem-break.c
gdb/mi/ChangeLog
gdb/mi/mi-cmd-break.c
gdb/mi/mi-cmd-disas.c
gdb/mi/mi-cmd-stack.c
gdb/mi/mi-cmd-var.c
gdb/mi/mi-console.c
gdb/mi/mi-main.c
gdb/mi/mi-out.c
gdb/mi/mi-parse.c
gdb/minsyms.c
gdb/mips-tdep.c
gdb/mipsread.c
gdb/mn10300-tdep.c
gdb/monitor.c
gdb/ocd.c
gdb/p-exp.y
gdb/p-lang.c
gdb/p-lang.h
gdb/p-typeprint.c
gdb/p-valprint.c
gdb/parse.c
gdb/parser-defs.h
gdb/ppc-bdm.c
gdb/ppc-linux-nat.c
gdb/ppc-linux-tdep.c
gdb/ppc-tdep.h
gdb/printcmd.c
gdb/proc-api.c
gdb/regcache.c
gdb/regformats/reg-ppc.dat
gdb/regformats/reg-x86-64.dat
gdb/remote-array.c
gdb/remote-e7000.c
gdb/remote-es.c
gdb/remote-mips.c
gdb/remote-os9k.c
gdb/remote-rdi.c
gdb/remote-rdp.c
gdb/remote-st.c
gdb/remote-utils.c
gdb/remote-vxsparc.c
gdb/remote.c
gdb/rs6000-nat.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/scm-lang.c
gdb/ser-unix.h
gdb/serial.c
gdb/sh-tdep.c
gdb/solib-legacy.c
gdb/solib-svr4.c
gdb/solib.c
gdb/somread.c
gdb/source.c
gdb/sparc-nat.c
gdb/sparc-tdep.c
gdb/stabsread.c
gdb/stack.c
gdb/std-regs.c
gdb/symfile.c
gdb/symfile.h
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h
gdb/target.c
gdb/target.h
gdb/testsuite/ChangeLog
gdb/testsuite/config/sid.exp
gdb/testsuite/gdb.asm/Makefile.in
gdb/testsuite/gdb.asm/asm-source.exp
gdb/testsuite/gdb.asm/configure
gdb/testsuite/gdb.asm/configure.in
gdb/testsuite/gdb.asm/powerpc.inc
gdb/testsuite/gdb.asm/sparc64.inc
gdb/testsuite/gdb.base/annota1.exp
gdb/testsuite/gdb.base/attach.exp
gdb/testsuite/gdb.base/bar.c
gdb/testsuite/gdb.base/baz.c
gdb/testsuite/gdb.base/completion.exp
gdb/testsuite/gdb.base/cvexpr.c
gdb/testsuite/gdb.base/dbx.exp
gdb/testsuite/gdb.base/default.exp
gdb/testsuite/gdb.base/dump.c
gdb/testsuite/gdb.base/dump.exp
gdb/testsuite/gdb.base/ending-run.exp
gdb/testsuite/gdb.base/foo.c
gdb/testsuite/gdb.base/funcargs.c
gdb/testsuite/gdb.base/funcargs.exp
gdb/testsuite/gdb.base/gcore.exp
gdb/testsuite/gdb.base/grbx.c
gdb/testsuite/gdb.base/help.exp
gdb/testsuite/gdb.base/list.exp
gdb/testsuite/gdb.base/long_long.exp
gdb/testsuite/gdb.base/maint.exp
gdb/testsuite/gdb.base/opaque.exp
gdb/testsuite/gdb.base/overlays.exp
gdb/testsuite/gdb.base/ovlymgr.c
gdb/testsuite/gdb.base/printcmds.exp
gdb/testsuite/gdb.base/ptype.exp
gdb/testsuite/gdb.base/relocate.c
gdb/testsuite/gdb.base/relocate.exp
gdb/testsuite/gdb.base/scope.exp
gdb/testsuite/gdb.base/shlib-call.exp
gdb/testsuite/gdb.base/step-test.exp
gdb/testsuite/gdb.base/watchpoint.exp
gdb/testsuite/gdb.base/whatis.exp
gdb/testsuite/gdb.c++/classes.exp
gdb/testsuite/gdb.c++/cplusfuncs.exp
gdb/testsuite/gdb.c++/hang.H
gdb/testsuite/gdb.c++/hang.exp
gdb/testsuite/gdb.c++/hang1.C
gdb/testsuite/gdb.c++/hang2.C
gdb/testsuite/gdb.c++/hang3.C
gdb/testsuite/gdb.c++/local.cc
gdb/testsuite/gdb.c++/local.exp
gdb/testsuite/gdb.c++/method.exp
gdb/testsuite/gdb.c++/misc.exp
gdb/testsuite/gdb.c++/ovldbreak.exp
gdb/testsuite/gdb.gdb/xfullpath.exp
gdb/testsuite/gdb.java/jmisc1.exp
gdb/testsuite/gdb.java/jmisc2.exp
gdb/testsuite/gdb.mi/ChangeLog
gdb/testsuite/gdb.mi/mi-var-cmd.exp
gdb/testsuite/gdb.mi/mi0-var-cmd.exp
gdb/testsuite/gdb.threads/linux-dp.exp
gdb/testsuite/gdb.trace/gdb_c_test.c
gdb/testsuite/lib/gdb.exp
gdb/thread-db.c
gdb/thread.c
gdb/top.c
gdb/top.h
gdb/tracepoint.c
gdb/tui/ChangeLog
gdb/tui/tui-out.c
gdb/ui-file.c
gdb/ui-out.c
gdb/utils.c
gdb/valarith.c
gdb/valops.c
gdb/valprint.c
gdb/value.h
gdb/varobj.c
gdb/vax-tdep.c
gdb/vax-tdep.h
gdb/version.in
gdb/win32-nat.c
gdb/x86-64-linux-nat.c
gdb/x86-64-tdep.c
gdb/x86-64-tdep.h
gdb/xcoffread.c
gdb/xstormy16-tdep.c
gdb/z8k-tdep.c
include/ChangeLog
include/coff/ChangeLog
include/coff/rs6k64.h
include/dyn-string.h
include/elf/ChangeLog
include/elf/dwarf2.h
include/floatformat.h
include/opcode/ChangeLog
include/opcode/i386.h
include/opcode/mips.h
include/opcode/pdp11.h
include/xregex2.h
libiberty/ChangeLog
libiberty/Makefile.in
libiberty/config.table
libiberty/configure
libiberty/configure.in
libiberty/cp-demangle.c
libiberty/dyn-string.c
libiberty/floatformat.c
libiberty/functions.texi
libiberty/hashtab.c
libiberty/hex.c
libiberty/splay-tree.c
libiberty/strtod.c
libiberty/xatexit.c
libiberty/xmalloc.c
ltmain.sh
mmalloc/ChangeLog
mmalloc/mmap-sup.c
opcodes/ChangeLog
opcodes/Makefile.am
opcodes/Makefile.in
opcodes/configure
opcodes/configure.in
opcodes/dep-in.sed
opcodes/i386-dis.c
opcodes/mips-dis.c
opcodes/mips-opc.c
opcodes/pdp11-dis.c
opcodes/pdp11-opc.c
opcodes/po/fr.po
opcodes/po/id.po
opcodes/ppc-opc.c
opcodes/s390-dis.c
opcodes/z8k-dis.c
opcodes/z8k-opc.h
opcodes/z8kgen.c
sim/ChangeLog
sim/MAINTAINERS
sim/arm/ChangeLog
sim/arm/wrapper.c
sim/common/ChangeLog
sim/common/callback.c
sim/igen/ChangeLog
sim/igen/gen.c
sim/igen/igen.c
sim/m68hc11/ChangeLog
sim/m68hc11/dv-m68hc11.c
sim/m68hc11/dv-m68hc11spi.c
sim/m68hc11/dv-m68hc11tim.c
sim/m68hc11/interp.c
sim/m68hc11/interrupts.c
sim/m68hc11/interrupts.h
sim/m68hc11/m68hc11_sim.c
sim/m68hc11/sim-main.h
sim/mips/ChangeLog
sim/mips/Makefile.in
sim/mips/configure
sim/mips/configure.in
sim/mips/cp1.c
sim/mips/interp.c
sim/mips/mips.igen
sim/mips/sim-main.h
sim/ppc/ChangeLog
sim/ppc/hw_disk.c
sim/ppc/ppc-instructions
sim/ppc/sim_calls.c
sim/z8k/ChangeLog
sim/z8k/writecode.c
Delete:
config/mh-irix4
config/mh-lynxos
config/mh-sun3
config/mh-vaxult2
config/mt-armpic
config/mt-elfalphapic
config/mt-i370pic
config/mt-ia64pic
config/mt-m68kpic
config/mt-papic
config/mt-ppcpic
config/mt-s390pic
config/mt-sparcpic
config/mt-x86pic
gdb/a29k-tdep.c
gdb/config/a29k/a29k-udi.mt
gdb/config/a29k/a29k.mt
gdb/config/a29k/tm-a29k.h
gdb/config/a29k/tm-vx29k.h
gdb/config/a29k/vx29k.mt
gdb/remote-adapt.c
gdb/remote-eb.c
gdb/remote-mm.c
gdb/remote-udi.c
gdb/signals.c
gdb/testsuite/gdb.hp/gdb.threads-hp/usrthbasic.c
gdb/testsuite/gdb.hp/gdb.threads-hp/usrthbasic.exp
gdb/testsuite/gdb.hp/gdb.threads-hp/usrthcore.c
gdb/testsuite/gdb.hp/gdb.threads-hp/usrthcore.exp
gdb/testsuite/gdb.hp/gdb.threads-hp/usrthfork.c
gdb/testsuite/gdb.hp/gdb.threads-hp/usrthfork.exp
Diffstat (limited to 'gdb/x86-64-linux-nat.c')
-rw-r--r-- | gdb/x86-64-linux-nat.c | 194 |
1 files changed, 27 insertions, 167 deletions
diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c index 3fb24dd5ce5..fd9246c2ea7 100644 --- a/gdb/x86-64-linux-nat.c +++ b/gdb/x86-64-linux-nat.c @@ -33,6 +33,19 @@ #include <sys/debugreg.h> #include <sys/syscall.h> #include <sys/procfs.h> +#include <sys/reg.h> + +/* Mapping between the general-purpose registers in `struct user' + format and GDB's register array layout. */ + +static int x86_64_regmap[] = { + RAX, RBX, RCX, RDX, + RSI, RDI, RBP, RSP, + R8, R9, R10, R11, + R12, R13, R14, R15, + RIP, EFLAGS, + DS, ES, FS, GS +}; static unsigned long x86_64_linux_dr_get (int regnum) @@ -74,8 +87,7 @@ x86_64_linux_dr_set (int regnum, unsigned long value) tid = PIDGET (inferior_ptid); errno = 0; - ptrace (PT_WRITE_U, tid, - offsetof (struct user, u_debugreg[regnum]), value); + ptrace (PT_WRITE_U, tid, offsetof (struct user, u_debugreg[regnum]), value); if (errno != 0) perror_with_name ("Couldn't write debug register"); } @@ -113,11 +125,9 @@ x86_64_linux_dr_get_status (void) the register sets used by `ptrace'. */ #define GETREGS_SUPPLIES(regno) \ - (0 <= (regno) && (regno) <= 17) + (0 <= (regno) && (regno) < x86_64_num_gregs) #define GETFPREGS_SUPPLIES(regno) \ (FP0_REGNUM <= (regno) && (regno) <= MXCSR_REGNUM) - -#define PTRACE_XFER_TYPE unsigned long /* Transfering the general-purpose registers between GDB, inferiors @@ -132,7 +142,7 @@ supply_gregset (elf_gregset_t * gregsetp) elf_greg_t *regp = (elf_greg_t *) gregsetp; int i; - for (i = 0; i < X86_64_NUM_GREGS; i++) + for (i = 0; i < x86_64_num_gregs; i++) supply_register (i, (char *) (regp + x86_64_regmap[i])); } @@ -146,9 +156,9 @@ fill_gregset (elf_gregset_t * gregsetp, int regno) elf_greg_t *regp = (elf_greg_t *) gregsetp; int i; - for (i = 0; i < X86_64_NUM_GREGS; i++) + for (i = 0; i < x86_64_num_gregs; i++) if ((regno == -1 || regno == i)) - read_register_gen (i, regp + x86_64_regmap[i]); + read_register_gen (i, (char *) (regp + x86_64_regmap[i])); } /* Fetch all general-purpose registers from process/thread TID and @@ -160,7 +170,7 @@ fetch_regs (int tid) elf_gregset_t regs; if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0) - perror_with_name ("Couldn't get registers"); + perror_with_name ("Couldn't get registers"); supply_gregset (®s); } @@ -332,163 +342,7 @@ static const unsigned char linux_syscall[] = { 0x0f, 0x05 }; /* Offset to saved processor registers from <asm/ucontext.h> */ #define LINUX_UCONTEXT_SIGCONTEXT_OFFSET (36) -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -child_resume (ptid_t ptid, int step, enum target_signal signal) -{ - int pid = PIDGET (ptid); - int request = PTRACE_CONT; - - if (pid == -1) - /* Resume all threads. */ - /* I think this only gets used in the non-threaded case, where "resume - all threads" and "resume inferior_ptid" are the same. */ - pid = PIDGET (inferior_ptid); - - if (step) - { - CORE_ADDR pc = read_pc_pid (pid_to_ptid (pid)); - unsigned char buf[LINUX_SYSCALL_LEN]; - - request = PTRACE_SINGLESTEP; - - /* Returning from a signal trampoline is done by calling a - special system call (sigreturn or rt_sigreturn, see - i386-linux-tdep.c for more information). This system call - restores the registers that were saved when the signal was - raised, including %eflags. That means that single-stepping - won't work. Instead, we'll have to modify the signal context - that's about to be restored, and set the trace flag there. */ - - /* First check if PC is at a system call. */ - if (read_memory_nobpt (pc, (char *) buf, LINUX_SYSCALL_LEN) == 0 - && memcmp (buf, linux_syscall, LINUX_SYSCALL_LEN) == 0) - { - int syscall = - read_register_pid (LINUX_SYSCALL_REGNUM, pid_to_ptid (pid)); - - /* Then check the system call number. */ - if (syscall == SYS_rt_sigreturn) - { - CORE_ADDR sp = read_register (SP_REGNUM); - CORE_ADDR addr = sp; - unsigned long int eflags; - - addr += - sizeof (struct siginfo) + LINUX_UCONTEXT_SIGCONTEXT_OFFSET; - - /* Set the trace flag in the context that's about to be - restored. */ - addr += LINUX_SIGCONTEXT_EFLAGS_OFFSET; - read_memory (addr, (char *) &eflags, 8); - eflags |= 0x0100; - write_memory (addr, (char *) &eflags, 8); - } - } - } - - if (ptrace (request, pid, 0, target_signal_to_host (signal)) == -1) - perror_with_name ("ptrace"); -} - - -/* Copy LEN bytes to or from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. Copy to inferior if - WRITE is nonzero. TARGET is ignored. - - Returns the length copied, which is either the LEN argument or zero. - This xfer function does not do partial moves, since child_ops - doesn't allow memory operations to cross below us in the target stack - anyway. */ - -int -child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct mem_attrib *attrib, struct target_ops *target) -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & -sizeof (PTRACE_XFER_TYPE); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) - / sizeof (PTRACE_XFER_TYPE); - /* Allocate buffer of that many longwords. */ - /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe - because it uses alloca to allocate a buffer of arbitrary size. - For very large xfers, this could crash GDB's stack. */ - register PTRACE_XFER_TYPE *buffer - = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE)) - { - /* Need part of initial word -- fetch it. */ - ptrace (PT_READ_I, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, buffer); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - ptrace (PT_READ_I, PIDGET (inferior_ptid), - ((PTRACE_ARG3_TYPE) - (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))), - buffer + count - 1); - } - - /* Copy data to be written over corresponding part of buffer */ - - memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), - myaddr, len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) - { - errno = 0; - ptrace (PT_WRITE_D, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, buffer[i]); - if (errno) - { - /* Using the appropriate one (I or D) is necessary for - Gould NP1, at least. */ - errno = 0; - ptrace (PT_WRITE_I, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, buffer[i]); - } - if (errno) - return 0; - } -#ifdef CLEAR_INSN_CACHE - CLEAR_INSN_CACHE (); -#endif - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) - { - errno = 0; - ptrace (PT_READ_I, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, buffer + i); - if (errno) - return 0; - } - - /* Copy appropriate bytes out of the buffer. */ - memcpy (myaddr, - (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), - len); - } - return len; -} - /* Interpreting register set info found in core files. */ - /* Provide registers to GDB from a core file. CORE_REG_SECT points to an array of bytes, which are the contents @@ -567,12 +421,12 @@ x86_64_register_u_addr (CORE_ADDR blockend, int regnum) CORE_ADDR fpstate; CORE_ADDR ubase; ubase = blockend; - if (IS_FP_REGNUM(regnum)) + if (IS_FP_REGNUM (regnum)) { fpstate = ubase + ((char *) &u.i387.st_space - (char *) &u); return (fpstate + 16 * (regnum - FP0_REGNUM)); } - else if (IS_SSE_REGNUM(regnum)) + else if (IS_SSE_REGNUM (regnum)) { fpstate = ubase + ((char *) &u.i387.xmm_space - (char *) &u); return (fpstate + 16 * (regnum - XMM0_REGNUM)); @@ -586,3 +440,9 @@ _initialize_x86_64_linux_nat (void) { add_core_fns (&linux_elf_core_fns); } + +int +kernel_u_size (void) +{ + return (sizeof (struct user)); +} |