|
From: <sv...@va...> - 2005-11-01 13:43:46
|
Author: tom
Date: 2005-10-31 17:05:21 +0000 (Mon, 31 Oct 2005)
New Revision: 4970
Log:
Get core dumping working again - the architecture specific code that=20
was in the sigframe module has been moved into the coredump module=20
where it belongs and things fixed up to compiler again.
Added:
trunk/coregrind/m_coredump/
trunk/coregrind/m_coredump/coredump-amd64-linux.c
trunk/coregrind/m_coredump/coredump-elf.c
trunk/coregrind/m_coredump/coredump-ppc32-linux.c
trunk/coregrind/m_coredump/coredump-x86-linux.c
trunk/coregrind/m_coredump/priv_elf.h
Removed:
trunk/coregrind/m_coredump.c
Modified:
trunk/coregrind/Makefile.am
trunk/coregrind/m_aspacemgr/aspacemgr.c
trunk/coregrind/m_libcfile.c
trunk/coregrind/m_sigframe/sigframe-amd64-linux.c
trunk/coregrind/m_sigframe/sigframe-ppc32-linux.c
trunk/coregrind/m_sigframe/sigframe-x86-linux.c
trunk/coregrind/m_signals.c
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/include/pub_tool_aspacemgr.h
trunk/include/vki-amd64-linux.h
Modified: trunk/coregrind/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/Makefile.am 2005-10-26 16:17:46 UTC (rev 4969)
+++ trunk/coregrind/Makefile.am 2005-10-31 17:05:21 UTC (rev 4970)
@@ -18,6 +18,7 @@
=20
# Remember to include all the arch-specific files in the distribution.
EXTRA_DIST =3D \
+ $(addsuffix .c,$(addprefix m_coredump/coredump-,$(VG_PLATFORM_AL=
L))) \
$(addsuffix .S,$(addprefix m_dispatch/dispatch-,$(VG_PLATFORM_AL=
L))) \
$(addsuffix .c,$(addprefix m_sigframe/sigframe-,$(VG_PLATFORM_AL=
L))) \
$(addsuffix .S,$(addprefix m_syswrap/syscall-,$(VG_PLATFORM_ALL)=
)) \
@@ -75,6 +76,7 @@
vki_unistd-amd64-linux.h\
vki_unistd-ppc32-linux.h\
vki_unistd-x86-linux.h \
+ m_coredump/priv_elf.h \
m_debuginfo/priv_symtab.h \
m_debuginfo/priv_symtypes.h \
m_demangle/ansidecl.h \
@@ -97,7 +99,6 @@
=20
libcoregrind_a_SOURCES =3D \
m_commandline.c \
- m_coredump.c \
m_cpuid.S \
m_clientstate.c \
m_debugger.c \
@@ -132,6 +133,8 @@
m_ume.c \
m_aspacemgr/read_procselfmaps.c \
m_aspacemgr/aspacemgr.c \
+ m_coredump/coredump-elf.c \
+ m_coredump/coredump-@VG_PLATFORM@.c \
m_debuginfo/dwarf.c \
m_debuginfo/stabs.c \
m_debuginfo/symtab.c \
Modified: trunk/coregrind/m_aspacemgr/aspacemgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-10-26 16:17:46 UTC (rev =
4969)
+++ trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-10-31 17:05:21 UTC (rev =
4970)
@@ -541,13 +541,14 @@
=20
/* Extract the device and inode numbers for a fd. */
static=20
-Bool get_inode_for_fd ( Int fd, /*OUT*/UInt* dev, /*OUT*/UInt* ino )
+Bool get_inode_for_fd ( Int fd, /*OUT*/UWord* dev, /*OUT*/UWord* ino, /*=
OUT*/UInt* mode )
{
struct vki_stat buf;
Int r =3D aspacem_fstat(fd, &buf);
if (r =3D=3D 0) {
*dev =3D buf.st_dev;
*ino =3D buf.st_ino;
+ *mode =3D buf.st_mode;
return True;
}
return False;
@@ -1621,6 +1622,7 @@
seg->smode =3D SmFixed;
seg->dev =3D 0;
seg->ino =3D 0;
+ seg->mode =3D 0;
seg->offset =3D 0;
seg->fnIdx =3D -1;
seg->hasR =3D seg->hasW =3D seg->hasX =3D seg->hasT =3D seg->isCH =3D=
False;
@@ -2047,7 +2049,8 @@
Int fd, Off64T offset )
{
HChar buf[VKI_PATH_MAX];
- UInt dev, ino;
+ UWord dev, ino;
+ UInt mode;
NSegment seg;
Bool needDiscard;
=20
@@ -2068,9 +2071,10 @@
seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
if (!(flags & VKI_MAP_ANONYMOUS)) {
- if (get_inode_for_fd(fd, &dev, &ino)) {
+ if (get_inode_for_fd(fd, &dev, &ino, &mode)) {
seg.dev =3D dev;
seg.ino =3D ino;
+ seg.mode =3D mode;
}
if (get_name_for_fd(fd, buf, VKI_PATH_MAX)) {
seg.fnIdx =3D allocate_segname( buf );
@@ -2219,7 +2223,8 @@
Addr advised;
Bool ok;
MapRequest req;
- UInt dev, ino;
+ UWord dev, ino;
+ UInt mode;
HChar buf[VKI_PATH_MAX];
=20
/* Not allowable. */
@@ -2264,9 +2269,10 @@
seg.hasR =3D toBool(prot & VKI_PROT_READ);
seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
- if (get_inode_for_fd(fd, &dev, &ino)) {
+ if (get_inode_for_fd(fd, &dev, &ino, &mode)) {
seg.dev =3D dev;
seg.ino =3D ino;
+ seg.mode =3D mode;
}
if (get_name_for_fd(fd, buf, VKI_PATH_MAX)) {
seg.fnIdx =3D allocate_segname( buf );
@@ -2472,7 +2478,8 @@
Addr advised;
Bool ok;
MapRequest req;
- UInt dev, ino;
+ UWord dev, ino;
+ UInt mode;
HChar buf[VKI_PATH_MAX];
=20
/* Not allowable. */
@@ -2515,9 +2522,10 @@
seg.hasR =3D toBool(prot & VKI_PROT_READ);
seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
- if (get_inode_for_fd(fd, &dev, &ino)) {
+ if (get_inode_for_fd(fd, &dev, &ino, &mode)) {
seg.dev =3D dev;
seg.ino =3D ino;
+ seg.mode - mode;
}
if (get_name_for_fd(fd, buf, VKI_PATH_MAX)) {
seg.fnIdx =3D allocate_segname( buf );
Added: trunk/coregrind/m_coredump/coredump-amd64-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_coredump/coredump-amd64-linux.c 2005-10-26 16:17:46=
UTC (rev 4969)
+++ trunk/coregrind/m_coredump/coredump-amd64-linux.c 2005-10-31 17:05:21=
UTC (rev 4970)
@@ -0,0 +1,90 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Dumping core. coredump-amd64-linux.c ---*/
+/*--------------------------------------------------------------------*/
+=20
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward=20
+ js...@ac...
+
+ 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.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_core_basics.h"
+#include "pub_core_libcbase.h"
+#include "pub_core_coredump.h"
+#include "pub_core_threadstate.h"
+
+#include "priv_elf.h"
+
+void ML_(fill_elfregs_from_tst)(struct vki_user_regs_struct* regs,=20
+ const ThreadArchState* arch)
+{
+ regs->eflags =3D LibVEX_GuestAMD64_get_rflags(&arch->vex);
+ regs->rsp =3D arch->vex.guest_RSP;
+ regs->rip =3D arch->vex.guest_RIP;
+
+ regs->rbx =3D arch->vex.guest_RBX;
+ regs->rcx =3D arch->vex.guest_RCX;
+ regs->rdx =3D arch->vex.guest_RDX;
+ regs->rsi =3D arch->vex.guest_RSI;
+ regs->rdi =3D arch->vex.guest_RDI;
+ regs->rbp =3D arch->vex.guest_RBP;
+ regs->rax =3D arch->vex.guest_RAX;
+ regs->r8 =3D arch->vex.guest_R8;
+ regs->r9 =3D arch->vex.guest_R9;
+ regs->r10 =3D arch->vex.guest_R10;
+ regs->r11 =3D arch->vex.guest_R11;
+ regs->r12 =3D arch->vex.guest_R12;
+ regs->r13 =3D arch->vex.guest_R13;
+ regs->r14 =3D arch->vex.guest_R14;
+ regs->r15 =3D arch->vex.guest_R15;
+
+//:: regs->cs =3D arch->vex.guest_cs;
+//:: regs->fs =3D arch->vex.guest_fs;
+//:: regs->gs =3D arch->vex.guest_gs;
+}
+
+void ML_(fill_elffpregs_from_tst)(vki_elf_fpregset_t* fpu,
+ const ThreadArchState* arch)
+{
+//:: fpu->cwd =3D ?;
+//:: fpu->swd =3D ?;
+//:: fpu->twd =3D ?;
+//:: fpu->fop =3D ?;
+//:: fpu->rip =3D ?;
+//:: fpu->rdp =3D ?;
+//:: fpu->mxcsr =3D ?;
+//:: fpu->mxcsr_mask =3D ?;
+//:: fpu->st_space =3D ?;
+
+# define DO(n) VG_(memcpy)(fpu->xmm_space + n * 4, &arch->vex.guest_XM=
M##n, sizeof(arch->vex.guest_XMM##n))
+ DO(0); DO(1); DO(2); DO(3); DO(4); DO(5); DO(6); DO(7);
+ DO(8); DO(9); DO(10); DO(11); DO(12); DO(13); DO(14); DO(15);
+# undef DO
+
+ VG_(memset)(fpu->padding, 0, sizeof(fpu->padding));
+}
+
+void VG_(make_coredump)(ThreadId tid, const vki_siginfo_t *si, UInt max_=
size)
+{
+ ML_(make_elf_coredump)(tid, si, max_size);
+}
Copied: trunk/coregrind/m_coredump/coredump-elf.c (from rev 4969, trunk/c=
oregrind/m_coredump.c)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_coredump.c 2005-10-26 16:17:46 UTC (rev 4969)
+++ trunk/coregrind/m_coredump/coredump-elf.c 2005-10-31 17:05:21 UTC (re=
v 4970)
@@ -0,0 +1,439 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Dumping core. coredump-elf.c ---*/
+/*--------------------------------------------------------------------*/
+=20
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward=20
+ js...@ac...
+
+ 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.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_core_basics.h"
+#include "pub_core_aspacemgr.h"
+#include "pub_core_libcbase.h"
+#include "pub_core_machine.h"
+#include "pub_core_coredump.h"
+#include "pub_core_libcprint.h"
+#include "pub_core_libcfile.h" // VG_(close) et al
+#include "pub_core_libcproc.h" // VG_(geteuid), VG_(getegid)
+#include "pub_core_libcassert.h" // VG_(exit), vg_assert
+#include "pub_core_mallocfree.h" // VG_(malloc), VG_(free)
+#include "pub_core_threadstate.h"
+#include "pub_core_clientstate.h"
+#include "pub_core_options.h"
+
+#include "priv_elf.h"
+
+/*
+ Dump core
+ =20
+ Generate a standard ELF core file corresponding to the client state
+ at the time of a crash.
+ */
+#include <elf.h>
+#ifndef NT_PRXFPREG
+#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/el=
f/common.h */
+#endif /* NT_PRXFPREG */
+
+#if VG_WORDSIZE =3D=3D 8
+#define ESZ(x) Elf64_##x
+#elif VG_WORDSIZE =3D=3D 4
+#define ESZ(x) Elf32_##x
+#else
+#error VG_WORDSIZE needs to =3D=3D4 or =3D=3D8
+#endif
+
+/* TODO: GIVE THIS A PROPER HOME
+ TODO: MERGE THIS WITH DUPLICATES IN m_main.c and mac_leakcheck.c
+ Extract from aspacem a vector of the current segment start
+ addresses. The vector is dynamically allocated and should be freed
+ by the caller when done. REQUIRES m_mallocfree to be running.
+ Writes the number of addresses required into *n_acquired. */
+
+static Addr* get_seg_starts ( /*OUT*/Int* n_acquired )
+{
+ Addr* starts;
+ Int n_starts, r =3D 0;
+
+ n_starts =3D 1;
+ while (True) {
+ starts =3D VG_(malloc)( n_starts * sizeof(Addr) );
+ if (starts =3D=3D NULL)
+ break;
+ r =3D VG_(am_get_segment_starts)( starts, n_starts );
+ if (r >=3D 0)
+ break;
+ VG_(free)(starts);
+ n_starts *=3D 2;
+ }
+
+ if (starts =3D=3D NULL) {
+ *n_acquired =3D 0;
+ return NULL;
+ }
+
+ *n_acquired =3D r;
+ return starts;
+}
+
+/* If true, then this Segment may be mentioned in the core */
+static Bool may_dump(const NSegment *seg)
+{
+ if (seg->kind =3D=3D SkAnonC ||
+ seg->kind =3D=3D SkShmC ||
+ (seg->kind =3D=3D SkFileC &&
+ !VKI_S_ISCHR(seg->mode) && !VKI_S_ISBLK(seg->mode)))
+ return True;
+
+ return False;
+}
+
+/* If true, then this Segment's contents will be in the core */
+static Bool should_dump(const NSegment *seg)
+{
+ return may_dump(seg); // && seg->hasW;
+}
+
+static void fill_ehdr(ESZ(Ehdr) *ehdr, Int num_phdrs)
+{
+ VG_(memset)(ehdr, 0, sizeof(*ehdr));
+
+ VG_(memcpy)(ehdr->e_ident, ELFMAG, SELFMAG);
+ ehdr->e_ident[EI_CLASS] =3D VG_ELF_CLASS;
+ ehdr->e_ident[EI_DATA] =3D VG_ELF_DATA2XXX;
+ ehdr->e_ident[EI_VERSION] =3D EV_CURRENT;
+
+ ehdr->e_type =3D ET_CORE;
+ ehdr->e_machine =3D VG_ELF_MACHINE;
+ ehdr->e_version =3D EV_CURRENT;
+ ehdr->e_entry =3D 0;
+ ehdr->e_phoff =3D sizeof(ESZ(Ehdr));
+ ehdr->e_shoff =3D 0;
+ ehdr->e_flags =3D 0;
+ ehdr->e_ehsize =3D sizeof(ESZ(Ehdr));
+ ehdr->e_phentsize =3D sizeof(ESZ(Phdr));
+ ehdr->e_phnum =3D num_phdrs;
+ ehdr->e_shentsize =3D 0;
+ ehdr->e_shnum =3D 0;
+ ehdr->e_shstrndx =3D 0;
+
+}
+
+static void fill_phdr(ESZ(Phdr) *phdr, const NSegment *seg, UInt off, Bo=
ol write)
+{
+ SizeT len =3D seg->end - seg->start;
+
+ write =3D write && should_dump(seg);
+
+ VG_(memset)(phdr, 0, sizeof(*phdr));
+
+ phdr->p_type =3D PT_LOAD;
+ phdr->p_offset =3D off;
+ phdr->p_vaddr =3D seg->start;
+ phdr->p_paddr =3D 0;
+ phdr->p_filesz =3D write ? len : 0;
+ phdr->p_memsz =3D len;
+ phdr->p_flags =3D 0;
+
+ if (seg->hasR)
+ phdr->p_flags |=3D PF_R;
+ if (seg->hasW)
+ phdr->p_flags |=3D PF_W;
+ if (seg->hasX)
+ phdr->p_flags |=3D PF_X;
+
+ phdr->p_align =3D VKI_PAGE_SIZE;
+}
+
+struct note {
+ struct note *next;
+ ESZ(Nhdr) note;
+ Char name[0];
+};
+
+static UInt note_size(const struct note *n)
+{
+ return sizeof(ESZ(Nhdr)) + VG_ROUNDUP(VG_(strlen)(n->name)+1, 4) + VG=
_ROUNDUP(n->note.n_descsz, 4);
+}
+
+static void add_note(struct note **list, const Char *name, UInt type, co=
nst void *data, UInt datasz)
+{
+ Int namelen =3D VG_(strlen)(name)+1;
+ Int notelen =3D sizeof(struct note) +=20
+ VG_ROUNDUP(namelen, 4) +=20
+ VG_ROUNDUP(datasz, 4);
+ struct note *n =3D VG_(arena_malloc)(VG_AR_CORE, notelen);
+
+ VG_(memset)(n, 0, notelen);
+
+ n->next =3D *list;
+ *list =3D n;
+
+ n->note.n_type =3D type;
+ n->note.n_namesz =3D namelen;
+ n->note.n_descsz =3D datasz;
+
+ VG_(memcpy)(n->name, name, namelen);
+ VG_(memcpy)(n->name+VG_ROUNDUP(namelen,4), data, datasz);
+}
+
+static void write_note(Int fd, const struct note *n)
+{
+ VG_(write)(fd, &n->note, note_size(n));
+}
+
+static void fill_prpsinfo(const ThreadState *tst, struct vki_elf_prpsinf=
o *prpsinfo)
+{
+ static Char name[VKI_PATH_MAX];
+
+ VG_(memset)(prpsinfo, 0, sizeof(*prpsinfo));
+
+ switch(tst->status) {
+ case VgTs_Runnable:
+ case VgTs_Yielding:
+ prpsinfo->pr_sname =3D 'R';
+ break;
+
+ case VgTs_WaitSys:
+ prpsinfo->pr_sname =3D 'S';
+ break;
+
+ case VgTs_Zombie:
+ prpsinfo->pr_sname =3D 'Z';
+ break;
+
+ case VgTs_Empty:
+ case VgTs_Init:
+ prpsinfo->pr_sname =3D '?';
+ break;
+ }
+
+ prpsinfo->pr_uid =3D 0;
+ prpsinfo->pr_gid =3D 0;
+ =20
+ if (VG_(resolve_filename)(VG_(cl_exec_fd), name, VKI_PATH_MAX)) {
+ Char *n =3D name+VG_(strlen)(name)-1;
+
+ while (n > name && *n !=3D '/')
+ n--;
+ if (n !=3D name)
+ n++;
+
+ VG_(strncpy)(prpsinfo->pr_fname, n, sizeof(prpsinfo->pr_fname));
+ }
+}
+
+static void fill_prstatus(const ThreadState *tst,=20
+ struct vki_elf_prstatus *prs,=20
+ const vki_siginfo_t *si)
+{
+ struct vki_user_regs_struct *regs;
+
+ VG_(memset)(prs, 0, sizeof(*prs));
+
+ prs->pr_info.si_signo =3D si->si_signo;
+ prs->pr_info.si_code =3D si->si_code;
+ prs->pr_info.si_errno =3D 0;
+
+ prs->pr_cursig =3D si->si_signo;
+
+ prs->pr_pid =3D tst->os_state.lwpid;
+ prs->pr_ppid =3D 0;
+ prs->pr_pgrp =3D VG_(getpgrp)();
+ prs->pr_sid =3D VG_(getpgrp)();
+ =20
+ regs =3D (struct vki_user_regs_struct *)prs->pr_reg;
+
+ vg_assert(sizeof(*regs) =3D=3D sizeof(prs->pr_reg));
+
+ ML_(fill_elfregs_from_tst)(regs, &tst->arch);
+}
+
+static void fill_fpu(const ThreadState *tst, vki_elf_fpregset_t *fpu)
+{
+ ML_(fill_elffpregs_from_tst)(fpu, &tst->arch);
+}
+
+#if defined(VGP_x86_linux)
+static void fill_xfpu(const ThreadState *tst, vki_elf_fpxregset_t *xfpu)
+{
+ ML_(fill_elffpxregs_from_tst)(xfpu, &tst->arch);
+}
+#endif
+
+void ML_(make_elf_coredump)(ThreadId tid, const vki_siginfo_t *si, UInt =
max_size)
+{
+ Char buf[1000];
+ Char *basename =3D "vgcore";
+ Char *coreext =3D "";
+ Int seq =3D 0;
+ Int core_fd;
+ NSegment *seg;
+ ESZ(Ehdr) ehdr;
+ ESZ(Phdr) *phdrs;
+ Int num_phdrs;
+ Int i, idx;
+ UInt off;
+ struct note *notelist, *note;
+ UInt notesz;
+ struct vki_elf_prpsinfo prpsinfo;
+ struct vki_elf_prstatus prstatus;
+ Addr *seg_starts;
+ Int n_seg_starts;
+
+ if (VG_(clo_log_name) !=3D NULL) {
+ coreext =3D ".core";
+ basename =3D VG_(clo_log_name);
+ }
+
+ for(;;) {
+ SysRes sres;
+
+ if (seq =3D=3D 0)
+ VG_(sprintf)(buf, "%s%s.pid%d",
+ basename, coreext, VG_(getpid)());
+ else
+ VG_(sprintf)(buf, "%s%s.pid%d.%d",
+ basename, coreext, VG_(getpid)(), seq);
+ seq++;
+
+ sres =3D VG_(open)(buf, =20
+ VKI_O_CREAT|VKI_O_WRONLY|VKI_O_EXCL|VKI_O_TRUNC,=20
+ VKI_S_IRUSR|VKI_S_IWUSR);
+ if (!sres.isError) {
+ core_fd =3D sres.val;
+ break;
+ }
+
+ if (sres.isError && sres.val !=3D VKI_EEXIST)
+ return; /* can't create file */
+ }
+
+ /* Get the segments */
+ seg_starts =3D get_seg_starts(&n_seg_starts);
+
+ /* First, count how many memory segments to dump */
+ num_phdrs =3D 1; /* start with notes */
+ for(i =3D 0; i < n_seg_starts; i++) {
+ if (!may_dump(VG_(am_find_nsegment(seg_starts[i]))))
+ continue;
+
+ num_phdrs++;
+ }
+
+ fill_ehdr(&ehdr, num_phdrs);
+
+ notelist =3D NULL;
+
+ /* Second, work out their layout */
+ phdrs =3D VG_(arena_malloc)(VG_AR_CORE, sizeof(*phdrs) * num_phdrs);
+
+ for(i =3D 1; i < VG_N_THREADS; i++) {
+ vki_elf_fpregset_t fpu;
+#if defined(VGP_x86_linux)
+ vki_elf_fpxregset_t xfpu;
+#endif
+
+ if (VG_(threads)[i].status =3D=3D VgTs_Empty)
+ continue;
+
+#if defined(VGP_x86_linux)
+ fill_xfpu(&VG_(threads)[i], &xfpu);
+ add_note(¬elist, "LINUX", NT_PRXFPREG, &xfpu, sizeof(xfpu));
+#endif
+
+ fill_fpu(&VG_(threads)[i], &fpu);
+ add_note(¬elist, "CORE", NT_FPREGSET, &fpu, sizeof(fpu));
+
+ fill_prstatus(&VG_(threads)[i], &prstatus, si);
+ add_note(¬elist, "CORE", NT_PRSTATUS, &prstatus, sizeof(prstatu=
s));
+ }
+
+ fill_prpsinfo(&VG_(threads)[tid], &prpsinfo);
+ add_note(¬elist, "CORE", NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo))=
;
+
+ for(note =3D notelist, notesz =3D 0; note !=3D NULL; note =3D note->n=
ext)
+ notesz +=3D note_size(note);
+
+ off =3D sizeof(ehdr) + sizeof(*phdrs) * num_phdrs;
+
+ phdrs[0].p_type =3D PT_NOTE;
+ phdrs[0].p_offset =3D off;
+ phdrs[0].p_vaddr =3D 0;
+ phdrs[0].p_paddr =3D 0;
+ phdrs[0].p_filesz =3D notesz;
+ phdrs[0].p_memsz =3D 0;
+ phdrs[0].p_flags =3D 0;
+ phdrs[0].p_align =3D 0;
+
+ off +=3D notesz;
+
+ off =3D VG_PGROUNDUP(off);
+
+ for(i =3D 0, idx =3D 1; i < n_seg_starts; i++) {
+ seg =3D VG_(am_find_nsegment(seg_starts[i]));
+
+ if (!may_dump(seg))
+ continue;
+
+ fill_phdr(&phdrs[idx], seg, off, (seg->end - seg->start + off) < m=
ax_size);
+ =20
+ off +=3D phdrs[idx].p_filesz;
+
+ idx++;
+ }
+
+ /* write everything out */
+ VG_(write)(core_fd, &ehdr, sizeof(ehdr));
+ VG_(write)(core_fd, phdrs, sizeof(*phdrs) * num_phdrs);
+
+ for(note =3D notelist; note !=3D NULL; note =3D note->next)
+ write_note(core_fd, note);
+ =20
+ VG_(lseek)(core_fd, phdrs[1].p_offset, VKI_SEEK_SET);
+
+ for(i =3D 0, idx =3D 1; i < n_seg_starts; i++) {
+ seg =3D VG_(am_find_nsegment(seg_starts[i]));
+
+ if (!should_dump(seg))
+ continue;
+
+ if (phdrs[idx].p_filesz > 0) {
+ Int ret;
+
+ vg_assert(VG_(lseek)(core_fd, phdrs[idx].p_offset, VKI_SEEK_SET) =3D=3D=
phdrs[idx].p_offset);
+ vg_assert(seg->end - seg->start >=3D phdrs[idx].p_filesz);
+
+ ret =3D VG_(write)(core_fd, (void *)seg->start, phdrs[idx].p_filesz);
+ }
+ idx++;
+ }
+
+ VG_(free)(seg_starts);
+
+ VG_(close)(core_fd);
+}
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Added: trunk/coregrind/m_coredump/coredump-ppc32-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_coredump/coredump-ppc32-linux.c 2005-10-26 16:17:46=
UTC (rev 4969)
+++ trunk/coregrind/m_coredump/coredump-ppc32-linux.c 2005-10-31 17:05:21=
UTC (rev 4970)
@@ -0,0 +1,75 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Dumping core. coredump-ppc32-linux.c ---*/
+/*--------------------------------------------------------------------*/
+=20
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward=20
+ js...@ac...
+
+ 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.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_core_basics.h"
+#include "pub_core_coredump.h"
+#include "pub_core_threadstate.h"
+
+#include "priv_elf.h"
+
+void ML_(fill_elfregs_from_tst)(struct vki_user_regs_struct* regs,=20
+ const ThreadArchState* arch)
+{
+# define DO(n) regs->gpr[n] =3D arch->vex.guest_GPR##n
+ DO(0); DO(1); DO(2); DO(3); DO(4); DO(5); DO(6); DO(7);
+ DO(8); DO(9); DO(10); DO(11); DO(12); DO(13); DO(14); DO(15);
+ DO(16); DO(17); DO(18); DO(19); DO(20); DO(21); DO(22); DO(23);
+ DO(24); DO(25); DO(26); DO(27); DO(28); DO(29); DO(30); DO(31);
+# undef DO
+
+ regs->nip =3D arch->vex.guest_CIA;
+ regs->msr =3D 0xf032; /* pretty arbitrary */
+ regs->orig_gpr3 =3D arch->vex.guest_GPR3;
+ regs->ctr =3D arch->vex.guest_CTR;
+ regs->link =3D arch->vex.guest_LR;
+ regs->xer =3D LibVEX_GuestPPC32_get_XER(&arch->vex);
+ regs->ccr =3D LibVEX_GuestPPC32_get_CR(&arch->vex);
+ regs->mq =3D 0;
+ regs->trap =3D 0;
+ regs->dar =3D 0; /* should be fault address? */
+ regs->dsisr =3D 0;
+ regs->result =3D 0;
+}
+
+void ML_(fill_elffpregs_from_tst)(vki_elf_fpregset_t* fpu,
+ const ThreadArchState* arch)
+{
+# define DO(n) fpu[n] =3D arch->vex.guest_FPR##n
+ DO(0); DO(1); DO(2); DO(3); DO(4); DO(5); DO(6); DO(7);
+ DO(8); DO(9); DO(10); DO(11); DO(12); DO(13); DO(14); DO(15);
+ DO(16); DO(17); DO(18); DO(19); DO(20); DO(21); DO(22); DO(23);
+ DO(24); DO(25); DO(26); DO(27); DO(28); DO(29); DO(30); DO(31);
+# undef DO
+}
+
+void VG_(make_coredump)(ThreadId tid, const vki_siginfo_t *si, UInt max_=
size)
+{
+ ML_(make_elf_coredump)(tid, si, max_size);
+}
Added: trunk/coregrind/m_coredump/coredump-x86-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_coredump/coredump-x86-linux.c 2005-10-26 16:17:46 U=
TC (rev 4969)
+++ trunk/coregrind/m_coredump/coredump-x86-linux.c 2005-10-31 17:05:21 U=
TC (rev 4970)
@@ -0,0 +1,110 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Dumping core. coredump-x86-linux.c ---*/
+/*--------------------------------------------------------------------*/
+=20
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward=20
+ js...@ac...
+
+ 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.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_core_basics.h"
+#include "pub_core_libcbase.h"
+#include "pub_core_coredump.h"
+#include "pub_core_threadstate.h"
+
+#include "priv_elf.h"
+
+void ML_(fill_elfregs_from_tst)(struct vki_user_regs_struct* regs,=20
+ const ThreadArchState* arch)
+{
+ regs->eflags =3D LibVEX_GuestX86_get_eflags(&arch->vex);
+ regs->esp =3D arch->vex.guest_ESP;
+ regs->eip =3D arch->vex.guest_EIP;
+
+ regs->ebx =3D arch->vex.guest_EBX;
+ regs->ecx =3D arch->vex.guest_ECX;
+ regs->edx =3D arch->vex.guest_EDX;
+ regs->esi =3D arch->vex.guest_ESI;
+ regs->edi =3D arch->vex.guest_EDI;
+ regs->ebp =3D arch->vex.guest_EBP;
+ regs->eax =3D arch->vex.guest_EAX;
+
+ regs->cs =3D arch->vex.guest_CS;
+ regs->ds =3D arch->vex.guest_DS;
+ regs->ss =3D arch->vex.guest_SS;
+ regs->es =3D arch->vex.guest_ES;
+ regs->fs =3D arch->vex.guest_FS;
+ regs->gs =3D arch->vex.guest_GS;
+}
+
+//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const Char *from)
+//:: {
+//:: if (VG_(have_ssestate)) {
+//:: UShort *to;
+//:: Int i;
+//::=20
+//:: /* This is what the kernel does */
+//:: VG_(memcpy)(fpu, from, 7*sizeof(long));
+//:: =20
+//:: to =3D (UShort *)&fpu->st_space[0];
+//:: from +=3D 18 * sizeof(UShort);
+//::=20
+//:: for (i =3D 0; i < 8; i++, to +=3D 5, from +=3D 8)=20
+//:: VG_(memcpy)(to, from, 5*sizeof(UShort));
+//:: } else
+//:: VG_(memcpy)(fpu, from, sizeof(*fpu));
+//:: }
+
+void ML_(fill_elffpregs_from_tst)(vki_elf_fpregset_t* fpu,
+ const ThreadArchState* arch)
+{
+//:: fill_fpu(fpu, (const Char *)&arch->m_sse);
+}
+
+void ML_(fill_elffpxregs_from_tst)(vki_elf_fpxregset_t* xfpu,
+ const ThreadArchState* arch)
+{
+//:: xfpu->cwd =3D ?;
+//:: xfpu->swd =3D ?;
+//:: xfpu->twd =3D ?;
+//:: xfpu->fop =3D ?;
+//:: xfpu->fip =3D ?;
+//:: xfpu->fcs =3D ?;
+//:: xfpu->foo =3D ?;
+//:: xfpu->fos =3D ?;
+//:: xfpu->mxcsr =3D ?;
+ xfpu->reserved =3D 0;
+//:: xfpu->st_space =3D ?;
+
+# define DO(n) VG_(memcpy)(xfpu->xmm_space + n * 4, &arch->vex.guest_X=
MM##n, sizeof(arch->vex.guest_XMM##n))
+ DO(0); DO(1); DO(2); DO(3); DO(4); DO(5); DO(6); DO(7);
+# undef DO
+
+ VG_(memset)(xfpu->padding, 0, sizeof(xfpu->padding));
+}
+
+void VG_(make_coredump)(ThreadId tid, const vki_siginfo_t *si, UInt max_=
size)
+{
+ ML_(make_elf_coredump)(tid, si, max_size);
+}
Added: trunk/coregrind/m_coredump/priv_elf.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_coredump/priv_elf.h 2005-10-26 16:17:46 UTC (rev 49=
69)
+++ trunk/coregrind/m_coredump/priv_elf.h 2005-10-31 17:05:21 UTC (rev 49=
70)
@@ -0,0 +1,51 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Header for ELF core dump stuff. priv_elf.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward
+ js...@ac...
+
+ 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.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PRIV_SYMTAB_H
+#define __PRIV_SYMTAB_H
+
+void ML_(make_elf_coredump)(ThreadId tid, const vki_siginfo_t *si, UInt =
max_size);
+
+void ML_(fill_elfregs_from_tst)(struct vki_user_regs_struct* regs,=20
+ const ThreadArchState* arch);
+
+void ML_(fill_elffpregs_from_tst)(vki_elf_fpregset_t* fpu,
+ const ThreadArchState* arch);
+
+#if defined(VGP_x86_linux)
+void ML_(fill_elffpxregs_from_tst)(vki_elf_fpxregset_t* xfpu,
+ const ThreadArchState* arch);
+#endif
+
+#endif // __PRIV_SYMTAB_H
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Deleted: trunk/coregrind/m_coredump.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_coredump.c 2005-10-26 16:17:46 UTC (rev 4969)
+++ trunk/coregrind/m_coredump.c 2005-10-31 17:05:21 UTC (rev 4970)
@@ -1,376 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Dumping core. m_coredump.c ---*/
-/*--------------------------------------------------------------------*/
-=20
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Julian Seward=20
- js...@ac...
-
- 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.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#include "pub_core_basics.h"
-#include "pub_core_coredump.h"
-#include "pub_core_libcassert.h"
-
-// Core dumping is disabled until someone can work out how to abstract o=
ut
-// the arch-specific and word-size-specific parts neatly.
-//
-// Note that the code below is not 64-bit clean!
-//
-#if 0
-/*
- Dump core
- =20
- Generate a standard ELF core file corresponding to the client state
- at the time of a crash.
- */
-#include <elf.h>
-#ifndef NT_PRXFPREG
-#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/el=
f/common.h */
-#endif /* NT_PRXFPREG */
-
-/* If true, then this Segment may be mentioned in the core */
-static Bool may_dump(const Segment *seg)
-{
- return (seg->flags & (SF_DEVICE|SF_VALGRIND)) =3D=3D 0 && VG_(is_clie=
nt_addr)(seg->addr);
-}
-
-/* If true, then this Segment's contents will be in the core */
-static Bool should_dump(const Segment *seg)
-{
- return may_dump(seg); // && (seg->prot & VKI_PROT_WRITE);
-}
-
-static void fill_ehdr(Elf32_Ehdr *ehdr, Int num_phdrs)
-{
- VG_(memset)(ehdr, 0, sizeof(*ehdr));
-
- VG_(memcpy)(ehdr->e_ident, ELFMAG, SELFMAG);
- ehdr->e_ident[EI_CLASS] =3D VG_ELF_CLASS;
- ehdr->e_ident[EI_DATA] =3D VG_ELF_ENDIANNESS;
- ehdr->e_ident[EI_VERSION] =3D EV_CURRENT;
-
- ehdr->e_type =3D ET_CORE;
- ehdr->e_machine =3D VG_ELF_MACHINE;
- ehdr->e_version =3D EV_CURRENT;
- ehdr->e_entry =3D 0;
- ehdr->e_phoff =3D sizeof(Elf32_Ehdr);
- ehdr->e_shoff =3D 0;
- ehdr->e_flags =3D 0;
- ehdr->e_ehsize =3D sizeof(Elf32_Ehdr);
- ehdr->e_phentsize =3D sizeof(Elf32_Phdr);
- ehdr->e_phnum =3D num_phdrs;
- ehdr->e_shentsize =3D 0;
- ehdr->e_shnum =3D 0;
- ehdr->e_shstrndx =3D 0;
-
-}
-
-static void fill_phdr(Elf32_Phdr *phdr, const Segment *seg, UInt off, Bo=
ol write)
-{
- write =3D write && should_dump(seg);
-
- VG_(memset)(phdr, 0, sizeof(*phdr));
-
- phdr->p_type =3D PT_LOAD;
- phdr->p_offset =3D off;
- phdr->p_vaddr =3D seg->addr;
- phdr->p_paddr =3D 0;
- phdr->p_filesz =3D write ? seg->len : 0;
- phdr->p_memsz =3D seg->len;
- phdr->p_flags =3D 0;
-
- if (seg->prot & VKI_PROT_READ)
- phdr->p_flags |=3D PF_R;
- if (seg->prot & VKI_PROT_WRITE)
- phdr->p_flags |=3D PF_W;
- if (seg->prot & VKI_PROT_EXEC)
- phdr->p_flags |=3D PF_X;
-
- phdr->p_align =3D VKI_PAGE_SIZE;
-}
-
-struct note {
- struct note *next;
- Elf32_Nhdr note;
- Char name[0];
-};
-
-static UInt note_size(const struct note *n)
-{
- return sizeof(Elf32_Nhdr) + VG_ROUNDUP(VG_(strlen)(n->name)+1, 4) + V=
G_ROUNDUP(n->note.n_descsz, 4);
-}
-
-static void add_note(struct note **list, const Char *name, UInt type, co=
nst void *data, UInt datasz)
-{
- Int namelen =3D VG_(strlen)(name)+1;
- Int notelen =3D sizeof(struct note) +=20
- VG_ROUNDUP(namelen, 4) +=20
- VG_ROUNDUP(datasz, 4);
- struct note *n =3D VG_(arena_malloc)(VG_AR_CORE, notelen);
-
- VG_(memset)(n, 0, notelen);
-
- n->next =3D *list;
- *list =3D n;
-
- n->note.n_type =3D type;
- n->note.n_namesz =3D namelen;
- n->note.n_descsz =3D datasz;
-
- VG_(memcpy)(n->name, name, namelen);
- VG_(memcpy)(n->name+VG_ROUNDUP(namelen,4), data, datasz);
-}
-
-static void write_note(Int fd, const struct note *n)
-{
- VG_(write)(fd, &n->note, note_size(n));
-}
-
-static void fill_prpsinfo(const ThreadState *tst, struct vki_elf_prpsinf=
o *prpsinfo)
-{
- static Char name[VKI_PATH_MAX];
- Bool res;
-
- VG_(memset)(prpsinfo, 0, sizeof(*prpsinfo));
-
- switch(tst->status) {
- case VgTs_Runnable:
- case VgTs_Yielding:
- prpsinfo->pr_sname =3D 'R';
- break;
-
- case VgTs_WaitSys:
- prpsinfo->pr_sname =3D 'S';
- break;
-
- case VgTs_Zombie:
- prpsinfo->pr_sname =3D 'Z';
- break;
-
- case VgTs_Empty:
- case VgTs_Init:
- prpsinfo->pr_sname =3D '?';
- break;
- }
-
- prpsinfo->pr_uid =3D 0;
- prpsinfo->pr_gid =3D 0;
- =20
- if (VG_(resolve_filename)(VG_(clexecfd), name, VKI_PATH_MAX)) {
- Char *n =3D name+VG_(strlen)(name)-1;
-
- while (n > name && *n !=3D '/')
- n--;
- if (n !=3D name)
- n++;
-
- VG_(strncpy)(prpsinfo->pr_fname, n, sizeof(prpsinfo->pr_fname));
- }
-}
-
-static void fill_prstatus(const ThreadState *tst,=20
- struct vki_elf_prstatus *prs,=20
- const vki_siginfo_t *si)
-{
- struct vki_user_regs_struct *regs;
-
- VG_(memset)(prs, 0, sizeof(*prs));
-
- prs->pr_info.si_signo =3D si->si_signo;
- prs->pr_info.si_code =3D si->si_code;
- prs->pr_info.si_errno =3D 0;
-
- prs->pr_cursig =3D si->si_signo;
-
- prs->pr_pid =3D tst->os_state.lwpid;
- prs->pr_ppid =3D 0;
- prs->pr_pgrp =3D VG_(getpgrp)();
- prs->pr_sid =3D VG_(getpgrp)();
- =20
- regs =3D (struct vki_user_regs_struct *)prs->pr_reg;
-
- vg_assert(sizeof(*regs) =3D=3D sizeof(prs->pr_reg));
-
- VG_(fill_elfregs_from_tst)(regs, &tst->arch);
-}
-
-static void fill_fpu(const ThreadState *tst, vki_elf_fpregset_t *fpu)
-{
- VG_(fill_elffpregs_from_tst)(fpu, &tst->arch);
-}
-
-static void fill_xfpu(const ThreadState *tst, vki_elf_fpxregset_t *xfpu)
-{
- VG_(fill_elffpxregs_from_tst)(xfpu, &tst->arch);
-}
-
-void VG_(make_coredump)(ThreadId tid, const vki_siginfo_t *si, UInt max_=
size)
-{
- Char buf[1000];
- Char *basename =3D "vgcore";
- Char *coreext =3D "";
- Int seq =3D 0;
- Int core_fd;
- Segment *seg;
- Elf32_Ehdr ehdr;
- Elf32_Phdr *phdrs;
- Int num_phdrs;
- Int i, idx;
- UInt off;
- struct note *notelist, *note;
- UInt notesz;
- struct vki_elf_prpsinfo prpsinfo;
- struct vki_elf_prstatus prstatus;
-
- if (VG_(clo_log_name) !=3D NULL) {
- coreext =3D ".core";
- basename =3D VG_(clo_log_name);
- }
-
- for(;;) {
- if (seq =3D=3D 0)
- VG_(sprintf)(buf, "%s%s.pid%d",
- basename, coreext, VG_(getpid)());
- else
- VG_(sprintf)(buf, "%s%s.pid%d.%d",
- basename, coreext, VG_(getpid)(), seq);
- seq++;
-
- core_fd =3D VG_(open)(buf, =20
- VKI_O_CREAT|VKI_O_WRONLY|VKI_O_EXCL|VKI_O_TRUNC,=20
- VKI_S_IRUSR|VKI_S_IWUSR);
- if (core_fd >=3D 0)
- break;
-
- if (core_fd !=3D -VKI_EEXIST)
- return; /* can't create file */
- }
-
- /* First, count how many memory segments to dump */
- num_phdrs =3D 1; /* start with notes */
- for(seg =3D VG_(first_segment)();
- seg !=3D NULL;
- seg =3D VG_(next_segment)(seg)) {
- if (!may_dump(seg))
- continue;
-
- num_phdrs++;
- }
-
- fill_ehdr(&ehdr, num_phdrs);
-
- notelist =3D NULL;
-
- /* Second, work out their layout */
- phdrs =3D VG_(arena_malloc)(VG_AR_CORE, sizeof(*phdrs) * num_phdrs);
-
- for(i =3D 1; i < VG_N_THREADS; i++) {
- vki_elf_fpregset_t fpu;
- vki_elf_fpxregset_t xfpu;
-
- if (VG_(threads)[i].status =3D=3D VgTs_Empty)
- continue;
-
- fill_xfpu(&VG_(threads)[i], &xfpu);
- add_note(¬elist, "LINUX", NT_PRXFPREG, &xfpu, sizeof(xfpu));
-
- fill_fpu(&VG_(threads)[i], &fpu);
- add_note(¬elist, "CORE", NT_FPREGSET, &fpu, sizeof(fpu));
-
- fill_prstatus(&VG_(threads)[i], &prstatus, si);
- add_note(¬elist, "CORE", NT_PRSTATUS, &prstatus, sizeof(prstatu=
s));
- }
-
- fill_prpsinfo(&VG_(threads)[tid], &prpsinfo);
- add_note(¬elist, "CORE", NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo))=
;
-
- for(note =3D notelist, notesz =3D 0; note !=3D NULL; note =3D note->n=
ext)
- notesz +=3D note_size(note);
-
- off =3D sizeof(ehdr) + sizeof(*phdrs) * num_phdrs;
-
- phdrs[0].p_type =3D PT_NOTE;
- phdrs[0].p_offset =3D off;
- phdrs[0].p_vaddr =3D 0;
- phdrs[0].p_paddr =3D 0;
- phdrs[0].p_filesz =3D notesz;
- phdrs[0].p_memsz =3D 0;
- phdrs[0].p_flags =3D 0;
- phdrs[0].p_align =3D 0;
-
- off +=3D notesz;
-
- off =3D VG_PGROUNDUP(off);
-
- for(seg =3D VG_(first_segment)(), idx =3D 1;
- seg !=3D NULL;
- seg =3D VG_(next_segment)(seg)) {
- if (!may_dump(seg))
- continue;
-
- fill_phdr(&phdrs[idx], seg, off, (seg->len + off) < max_size);
- =20
- off +=3D phdrs[idx].p_filesz;
-
- idx++;
- }
-
- /* write everything out */
- VG_(write)(core_fd, &ehdr, sizeof(ehdr));
- VG_(write)(core_fd, phdrs, sizeof(*phdrs) * num_phdrs);
-
- for(note =3D notelist; note !=3D NULL; note =3D note->next)
- write_note(core_fd, note);
- =20
- VG_(lseek)(core_fd, phdrs[1].p_offset, VKI_SEEK_SET);
-
- for(seg =3D VG_(first_segment)(), idx =3D 1;
- seg !=3D NULL;
- seg =3D VG_(next_segment)(seg)) {
- if (!should_dump(seg))
- continue;
-
- if (phdrs[idx].p_filesz > 0) {
- Int ret;
-
- vg_assert(VG_(lseek)(core_fd, phdrs[idx].p_offset, VKI_SEEK_SET) =3D=3D=
phdrs[idx].p_offset);
- vg_assert(seg->len >=3D phdrs[idx].p_filesz);
-
- ret =3D VG_(write)(core_fd, (void *)seg->addr, phdrs[idx].p_filesz);
- }
- idx++;
- }
-
- VG_(close)(core_fd);
-}
-#endif
-
-void VG_(make_coredump)(ThreadId tid, const vki_siginfo_t *si, UInt max_=
size)
-{
- I_die_here;
-}
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_libcfile.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_libcfile.c 2005-10-26 16:17:46 UTC (rev 4969)
+++ trunk/coregrind/m_libcfile.c 2005-10-31 17:05:21 UTC (rev 4970)
@@ -114,7 +114,7 @@
OffT VG_(lseek) ( Int fd, OffT offset, Int whence )
{
SysRes res =3D VG_(do_syscall3)(__NR_lseek, fd, offset, whence);
- return res.isError ? (-1) : 0;
+ return res.isError ? (-1) : res.val;
/* if you change the error-reporting conventions of this, also
change VG_(pread) and all other usage points. */
}
@@ -278,7 +278,7 @@
SysRes VG_(pread) ( Int fd, void* buf, Int count, Int offset )
{
OffT off =3D VG_(lseek)( fd, (OffT)offset, VKI_SEEK_SET);
- if (off !=3D 0)
+ if (off < 0)
return VG_(mk_SysRes_Error)( VKI_EINVAL );
return VG_(do_syscall3)(__NR_read, fd, (UWord)buf, count );
}
Modified: trunk/coregrind/m_sigframe/sigframe-amd64-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_sigframe/sigframe-amd64-linux.c 2005-10-26 16:17:46=
UTC (rev 4969)
+++ trunk/coregrind/m_sigframe/sigframe-amd64-linux.c 2005-10-31 17:05:21=
UTC (rev 4970)
@@ -615,68 +615,6 @@
VG_TRACK( post_deliver_signal, tid, sigNo );
}
=20
-//:: /*------------------------------------------------------------*/
-//:: /*--- Making coredumps ---*/
-//:: /*------------------------------------------------------------*/
-//::=20
-//:: void VG_(fill_elfregs_from_tst)(struct vki_user_regs_struct* regs,=20
-//:: const arch_thread_t* arch)
-//:: {
-//:: regs->rflags =3D arch->m_rflags;
-//:: regs->rsp =3D arch->m_rsp;
-//:: regs->rip =3D arch->m_rip;
-//::
-//:: regs->rbx =3D arch->m_rbx;
-//:: regs->rcx =3D arch->m_rcx;
-//:: regs->rdx =3D arch->m_rdx;
-//:: regs->rsi =3D arch->m_rsi;
-//:: regs->rdi =3D arch->m_rdi;
-//:: regs->rbp =3D arch->m_rbp;
-//:: regs->rax =3D arch->m_rax;
-//:: regs->r8 =3D arch->m_r8;
-//:: regs->r9 =3D arch->m_r9;
-//:: regs->r10 =3D arch->m_r10;
-//:: regs->r11 =3D arch->m_r11;
-//:: regs->r12 =3D arch->m_r12;
-//:: regs->r13 =3D arch->m_r13;
-//:: regs->r14 =3D arch->m_r14;
-//:: regs->r15 =3D arch->m_r15;
-//::=20
-//:: regs->cs =3D arch->m_cs;
-//:: regs->fs =3D arch->m_fs;
-//:: regs->gs =3D arch->m_gs;
-//:: }
-//::=20
-//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const Char *from)
-//:: {
-//:: if (VG_(have_ssestate)) {
-//:: UShort *to;
-//:: Int i;
-//::=20
-//:: /* This is what the kernel does */
-//:: VG_(memcpy)(fpu, from, 7*sizeof(long));
-//:: =20
-//:: to =3D (UShort *)&fpu->st_space[0];
-//:: from +=3D 18 * sizeof(UShort);
-//::=20
-//:: for (i =3D 0; i < 8; i++, to +=3D 5, from +=3D 8)=20
-//:: VG_(memcpy)(to, from, 5*sizeof(UShort));
-//:: } else
-//:: VG_(memcpy)(fpu, from, sizeof(*fpu));
-//:: }
-//::=20
-//:: void VG_(fill_elffpregs_from_tst)( vki_elf_fpregset_t* fpu,
-//:: const arch_thread_t* arch)
-//:: {
-//:: fill_fpu(fpu, (const Char *)&arch->m_sse);
-//:: }
-//::=20
-//:: void VG_(fill_elffpxregs_from_tst) ( vki_elf_fpxregset_t* xfpu,
-//:: const arch_thread_t* arch )
-//:: {
-//:: VG_(memcpy)(xfpu, arch->m_sse.state, sizeof(*xfpu));
-//:: }
-
/*--------------------------------------------------------------------*/
/*--- end sigframe-amd64-linux.c ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_sigframe/sigframe-ppc32-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_sigframe/sigframe-ppc32-linux.c 2005-10-26 16:17:46=
UTC (rev 4969)
+++ trunk/coregrind/m_sigframe/sigframe-ppc32-linux.c 2005-10-31 17:05:21=
UTC (rev 4970)
@@ -951,63 +951,6 @@
//.. VG_TRACK( post_deliver_signal, tid, sigNo );
}
=20
-//:: /*------------------------------------------------------------*/
-//:: /*--- Making coredumps ---*/
-//:: /*------------------------------------------------------------*/
-//::=20
-//:: void VG_(fill_elfregs_from_tst)(struct vki_user_regs_struct* regs,=20
-//:: const arch_thread_t* arch)
-//:: {
-//:: regs->eflags =3D arch->m_eflags;
-//:: regs->esp =3D arch->m_esp;
-//:: regs->eip =3D arch->m_eip;
-//::=20
-//:: regs->ebx =3D arch->m_ebx;
-//:: regs->ecx =3D arch->m_ecx;
-//:: regs->edx =3D arch->m_edx;
-//:: regs->esi =3D arch->m_esi;
-//:: regs->edi =3D arch->m_edi;
-//:: regs->ebp =3D arch->m_ebp;
-//:: regs->eax =3D arch->m_eax;
-//::=20
-//:: regs->cs =3D arch->m_cs;
-//:: regs->ds =3D arch->m_ds;
-//:: regs->ss =3D arch->m_ss;
-//:: regs->es =3D arch->m_es;
-//:: regs->fs =3D arch->m_fs;
-//:: regs->gs =3D arch->m_gs;
-//:: }
-//::=20
-//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const Char *from)
-//:: {
-//:: if (VG_(have_ssestate)) {
-//:: UShort *to;
-//:: Int i;
-//::=20
-//:: /* This is what the kernel does */
-//:: VG_(memcpy)(fpu, from, 7*sizeof(long));
-//:: =20
-//:: to =3D (UShort *)&fpu->st_space[0];
-//:: from +=3D 18 * sizeof(UShort);
-//::=20
-//:: for (i =3D 0; i < 8; i++, to +=3D 5, from +=3D 8)=20
-//:: VG_(memcpy)(to, from, 5*sizeof(UShort));
-//:: } else
-//:: VG_(memcpy)(fpu, from, sizeof(*fpu));
-//:: }
-//::=20
-//:: void VG_(fill_elffpregs_from_tst)( vki_elf_fpregset_t* fpu,
-//:: const arch_thread_t* arch)
-//:: {
-//:: fill_fpu(fpu, (const Char *)&arch->m_sse);
-//:: }
-//::=20
-//:: void VG_(fill_elffpxregs_from_tst) ( vki_elf_fpxregset_t* xfpu,
-//:: const arch_thread_t* arch )
-//:: {
-//:: VG_(memcpy)(xfpu, arch->m_sse.state, sizeof(*xfpu));
-//:: }
-
/*--------------------------------------------------------------------*/
/*--- end sigframe-ppc32-linux.c ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_sigframe/sigframe-x86-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_sigframe/sigframe-x86-linux.c 2005-10-26 16:17:46 U=
TC (rev 4969)
+++ trunk/coregrind/m_sigframe/sigframe-x86-linux.c 2005-10-31 17:05:21 U=
TC (rev 4970)
@@ -695,63 +695,6 @@
VG_TRACK( post_deliver_signal, tid, sigNo );
}
=20
-//:: /*------------------------------------------------------------*/
-//:: /*--- Making coredumps ---*/
-//:: /*------------------------------------------------------------*/
-//::=20
-//:: void VG_(fill_elfregs_from_tst)(struct vki_user_regs_struct* regs,=20
-//:: const arch_thread_t* arch)
-//:: {
-//:: regs->eflags =3D arch->m_eflags;
-//:: regs->esp =3D arch->m_esp;
-//:: regs->eip =3D arch->m_eip;
-//::=20
-//:: regs->ebx =3D arch->m_ebx;
-//:: regs->ecx =3D arch->m_ecx;
-//:: regs->edx =3D arch->m_edx;
-//:: regs->esi =3D arch->m_esi;
-//:: regs->edi =3D arch->m_edi;
-//:: regs->ebp =3D arch->m_ebp;
-//:: regs->eax =3D arch->m_eax;
-//::=20
-//:: regs->cs =3D arch->m_cs;
-//:: regs->ds =3D arch->m_ds;
-//:: regs->ss =3D arch->m_ss;
-//:: regs->es =3D arch->m_es;
-//:: regs->fs =3D arch->m_fs;
-//:: regs->gs =3D arch->m_gs;
-//:: }
-//::=20
-//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const Char *from)
-//:: {
-//:: if (VG_(have_ssestate)) {
-//:: UShort *to;
-//:: Int i;
-//::=20
-//:: /* This is what the kernel does */
-//:: VG_(memcpy)(fpu, from, 7*sizeof(long));
-//:: =20
-//:: to =3D (UShort *)&fpu->st_space[0];
-//:: from +=3D 18 * sizeof(UShort);
-//::=20
-//:: for (i =3D 0; i < 8; i++, to +=3D 5, from +=3D 8)=20
-//:: VG_(memcpy)(to, from, 5*sizeof(UShort));
-//:: } else
-//:: VG_(memcpy)(fpu, from, sizeof(*fpu));
-//:: }
-//::=20
-//:: void VG_(fill_elffpregs_from_tst)( vki_elf_fpregset_t* fpu,
-//:: const arch_thread_t* arch)
-//:: {
-//:: fill_fpu(fpu, (const Char *)&arch->m_sse);
-//:: }
-//::=20
-//:: void VG_(fill_elffpxregs_from_tst) ( vki_elf_fpxregset_t* xfpu,
-//:: const arch_thread_t* arch )
-//:: {
-//:: VG_(memcpy)(xfpu, arch->m_sse.state, sizeof(*xfpu));
-//:: }
-
/*--------------------------------------------------------------------*/
/*--- end sigframe-x86-linux.c ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_signals.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_signals.c 2005-10-26 16:17:46 UTC (rev 4969)
+++ trunk/coregrind/m_signals.c 2005-10-31 17:05:21 UTC (rev 4970)
@@ -1068,7 +1068,6 @@
}
=20
// See comment above about this temporary disabling of core dumps.
- #if 0
if (core) {
const static struct vki_rlimit zero =3D { 0, 0 };
=20
@@ -1078,7 +1077,6 @@
coredump when we finally exit */
VG_(setrlimit)(VKI_RLIMIT_CORE, &zero);
}
- #endif
=20
/* stash fatal signal in main thread */
// what's this for?
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2005-10-26 16:17:46 UTC (=
rev 4969)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2005-10-31 17:05:21 UTC (=
rev 4970)
@@ -4662,7 +4662,7 @@
SET_STATUS_from_SysRes( sres );
if (!sres.isError) {
OffT off =3D VG_(lseek)( sres.val, 0, VKI_SEEK_SET );
- if (off)
+ if (off < 0)
SET_STATUS_Failure( VKI_EMFILE );
}
return;
Modified: trunk/include/pub_tool_aspacemgr.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/pub_tool_aspacemgr.h 2005-10-26 16:17:46 UTC (rev 4969)
+++ trunk/include/pub_tool_aspacemgr.h 2005-10-31 17:05:21 UTC (rev 4970)
@@ -101,6 +101,7 @@
/* Associated file (SkFile{C,V} only) */
UWord dev;
UWord ino;
+ UInt mode;
ULong offset;
Int fnIdx; // file name table index, if name is known
/* Permissions (SkAnon{C,V}, SkFile{C,V} only) */
Modified: trunk/include/vki-amd64-linux.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/vki-amd64-linux.h 2005-10-26 16:17:46 UTC (rev 4969)
+++ trunk/include/vki-amd64-linux.h 2005-10-31 17:05:21 UTC (rev 4970)
@@ -480,6 +480,8 @@
#define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki=
_elf_greg_t))
typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
=20
+typedef struct vki_user_i387_struct vki_elf_fpregset_t;
+
//----------------------------------------------------------------------
// From linux-2.6.9/include/asm-x86_64/ucontext.h
//----------------------------------------------------------------------
|