pub_core_libcfile.h \
pub_core_libcprint.h \
pub_core_libcproc.h \
+ pub_core_libcsetjmp.h \
pub_core_libcsignal.h \
pub_core_mach.h \
pub_core_machine.h \
m_libcfile.c \
m_libcprint.c \
m_libcproc.c \
+ m_libcsetjmp.c \
m_libcsignal.c \
m_machine.c \
m_main.c \
#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_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h"
#include "pub_core_threadstate.h"
#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_debuginfo.h" /* self */
#include "pub_core_demangle.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
+#include "pub_core_libcsetjmp.h" // setjmp facilities
#include "pub_core_options.h"
#include "pub_core_tooliface.h" /* VG_(needs) */
#include "pub_core_xarray.h"
/*--- ---*/
/*------------------------------------------------------------*/
-/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#include <setjmp.h> /* For jmp_buf */
-/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-
-static Bool d3rd_jmpbuf_valid = False;
-static HChar* d3rd_jmpbuf_reason = NULL;
-static jmp_buf d3rd_jmpbuf;
+static Bool d3rd_jmpbuf_valid = False;
+static HChar* d3rd_jmpbuf_reason = NULL;
+static VG_MINIMAL_JMP_BUF d3rd_jmpbuf;
static __attribute__((noreturn)) void barf ( HChar* reason ) {
vg_assert(d3rd_jmpbuf_valid);
d3rd_jmpbuf_reason = reason;
- __builtin_longjmp(&d3rd_jmpbuf, 1);
+ VG_MINIMAL_LONGJMP(d3rd_jmpbuf);
/*NOTREACHED*/
vg_assert(0);
}
vg_assert(d3rd_jmpbuf_reason == NULL);
d3rd_jmpbuf_valid = True;
- jumped = __builtin_setjmp(&d3rd_jmpbuf);
+ jumped = VG_MINIMAL_SETJMP(d3rd_jmpbuf);
if (jumped == 0) {
/* try this ... */
new_dwarf3_reader_wrk( di, barf,
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h"
#include "pub_core_threadstate.h" // For VG_N_THREADS
#include "pub_core_debugger.h"
#include "pub_core_debuginfo.h"
#include "pub_core_stacktrace.h"
#include "pub_core_machine.h" // VG_(get_IP)
#include "pub_core_vki.h" // To keep pub_core_threadstate.h happy
+#include "pub_core_libcsetjmp.h" // Ditto
#include "pub_core_threadstate.h" // VG_(is_valid_tid)
#include "pub_core_execontext.h" // self
#include "pub_core_options.h"
#include "pub_core_syscall.h"
#include "pub_core_tooliface.h" /* VG_TRACK */
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h" /* ThreadArchState */
#include "priv_initimg_pathscan.h"
#include "pub_core_initimg.h" /* self */
#include "pub_core_ume.h"
#include "pub_core_options.h"
#include "pub_core_tooliface.h" /* VG_TRACK */
-#include "pub_core_threadstate.h" /* ThreadArchState */
#include "pub_core_initimg.h" /* self */
#include "priv_initimg_pathscan.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
--- /dev/null
+
+/*--------------------------------------------------------------------*/
+/*--- A minimal setjmp/longjmp implementation. m_libcsetjmp.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2010-2010 Mozilla Inc
+
+ 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.
+*/
+
+/* Contributed by Julian Seward <jseward@acm.org> */
+
+
+#include "pub_core_basics.h"
+#include "pub_core_libcsetjmp.h" /* self */
+
+
+/* See include/pub_tool_libcsetjmp.h for background and rationale. */
+
+/* No alternative implementations at present. */
+
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h" // setjmp facilities
#include "pub_core_threadstate.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcbase.h"
/* fixs390: anything for s390x here ? */
/* For hwcaps detection on ppc32/64 and arm we'll need to do SIGILL
- testing, so we need a jmp_buf. */
-#if defined(VGA_ppc32) || defined(VGA_ppc64) || defined(VGA_arm) || defined(VGA_s390x)
-#include <setjmp.h> // For jmp_buf
-static jmp_buf env_unsup_insn;
-static void handler_unsup_insn ( Int x ) { __builtin_longjmp(env_unsup_insn,1); }
+ testing, so we need a VG_MINIMAL_JMP_BUF. */
+#if defined(VGA_ppc32) || defined(VGA_ppc64) \
+ || defined(VGA_arm) || defined(VGA_s390x)
+#include "pub_tool_libcsetjmp.h"
+static VG_MINIMAL_JMP_BUF env_unsup_insn;
+static void handler_unsup_insn ( Int x ) {
+ VG_MINIMAL_LONGJMP(env_unsup_insn);
+}
#endif
vg_assert(dcbz_szB == 32 || dcbz_szB == 64 || dcbz_szB == 128);
/* dcbzl clears 128B on G5/PPC970, and usually 32B on other platforms */
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
dcbzl_szB = 0; /* indicates unsupported */
}
else {
/* standard FP insns */
have_F = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_F = False;
} else {
__asm__ __volatile__(".long 0xFC000090"); /*fmr 0,0 */
/* Altivec insns */
have_V = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_V = False;
} else {
/* Unfortunately some older assemblers don't speak Altivec (or
/* General-Purpose optional (fsqrt, fsqrts) */
have_FX = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_FX = False;
} else {
__asm__ __volatile__(".long 0xFC00002C"); /*fsqrt 0,0 */
/* Graphics optional (stfiwx, fres, frsqrte, fsel) */
have_GX = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_GX = False;
} else {
__asm__ __volatile__(".long 0xFC000034"); /* frsqrte 0,0 */
/* standard FP insns */
have_F = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_F = False;
} else {
__asm__ __volatile__("fmr 0,0");
/* Altivec insns */
have_V = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_V = False;
} else {
__asm__ __volatile__(".long 0x10000484"); /*vor 0,0,0*/
/* General-Purpose optional (fsqrt, fsqrts) */
have_FX = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_FX = False;
} else {
__asm__ __volatile__(".long 0xFC00002C"); /*fsqrt 0,0*/
/* Graphics optional (stfiwx, fres, frsqrte, fsel) */
have_GX = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_GX = False;
} else {
__asm__ __volatile__(".long 0xFC000034"); /*frsqrte 0,0*/
is not supported on z900. */
have_LDISP = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_LDISP = False;
} else {
/* BASR loads the address of the next insn into r1. Needed to avoid
}
have_EIMM = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_EIMM = False;
} else {
__asm__ __volatile__(".long 0xc0090000\n\t" /* iilf r0,0 */
}
have_GIE = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_GIE = False;
} else {
__asm__ __volatile__(".long 0xc2010000\n\t" /* msfi r0,0 */
}
have_DFP = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_DFP = False;
} else {
__asm__ __volatile__(".long 0xb3d20000"
/* VFP insns */
have_VFP = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_VFP = False;
} else {
__asm__ __volatile__(".word 0xEEB02B42"); /* VMOV.F64 d2, d2 */
/* NEON insns */
have_NEON = True;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
have_NEON = False;
} else {
__asm__ __volatile__(".word 0xF2244154"); /* VMOV q2, q2 */
archlevel = 5; /* v5 will be base level */
if (archlevel < 7) {
archlevel = 7;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
archlevel = 5;
} else {
__asm__ __volatile__(".word 0xF45FF000"); /* PLI [PC,#-0] */
}
if (archlevel < 6) {
archlevel = 6;
- if (__builtin_setjmp(env_unsup_insn)) {
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
archlevel = 5;
} else {
__asm__ __volatile__(".word 0xE6822012"); /* PKHBT r2, r2, r2 */
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
#include "pub_core_libcprint.h"
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h" // For VG_INVALID_THREADID
#include "pub_core_tooliface.h"
#include "valgrind.h"
#include "pub_core_debuglog.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h" // __NR_sched_yield
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_clreq.h" // for VG_USERREQ__*
do { \
ThreadState * volatile _qq_tst = VG_(get_ThreadState)(tid); \
\
- (jumped) = __builtin_setjmp(_qq_tst->sched_jmpbuf); \
+ (jumped) = VG_MINIMAL_SETJMP(_qq_tst->sched_jmpbuf); \
if ((jumped) == 0) { \
vg_assert(!_qq_tst->sched_jmpbuf_valid); \
_qq_tst->sched_jmpbuf_valid = True; \
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h" /* find_segment */
#include "pub_core_libcbase.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
#include "pub_core_debuglog.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_xarray.h"
#include "pub_core_clientstate.h"
if (tst->sched_jmpbuf_valid) {
/* Can't continue; must longjmp back to the scheduler and thus
enter the sighandler immediately. */
- __builtin_longjmp(tst->sched_jmpbuf, True);
+ VG_MINIMAL_LONGJMP(tst->sched_jmpbuf);
}
}
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_debuginfo.h" // XXX: circular dependency
#include "pub_core_aspacemgr.h" // For VG_(is_addressable)()
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debuglog.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debuglog.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_debuginfo.h" // VG_(di_notify_*)
#include "pub_core_aspacemgr.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debuginfo.h" // VG_(di_notify_*)
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debuginfo.h" // VG_(di_notify_*)
#include "pub_core_aspacemgr.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
sci->status.what = SsIdle;
vg_assert(tst->sched_jmpbuf_valid);
- __builtin_longjmp(tst->sched_jmpbuf, True);
+ VG_MINIMAL_LONGJMP(tst->sched_jmpbuf, True);
/* NOTREACHED */
vg_assert(0);
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debuglog.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debuglog.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debuglog.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_debuglog.h"
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
#include "pub_core_libcassert.h"
#include "pub_core_dispatch.h" // VG_(run_innerloop__dispatch_{un}profiled)
// VG_(run_a_noredir_translation__return_point)
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h" // VexGuestArchState
#include "pub_core_trampoline.h" // VG_(ppctoc_magic_redirect_return_stub)
# error Unknown arch
#endif
-// For jmp_buf
-#include <setjmp.h>
-
/* ---------------------------------------------------------------------
A struct to hold starting values for stack unwinding.
--- /dev/null
+
+/*--------------------------------------------------------------------*/
+/*--- A minimal setjmp/longjmp facility. pub_core_libcsetjmp.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2010-2010 Mozilla Inc
+
+ 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.
+*/
+
+/* Contributed by Julian Seward <jseward@acm.org> */
+
+#ifndef __PUB_CORE_LIBCSETJMP_H
+#define __PUB_CORE_LIBCSETJMP_H
+
+//--------------------------------------------------------------------
+// PURPOSE: Provides a minimal setjmp/longjmp facility, that saves/
+// restores integer registers, but not necessarily anything more.
+//--------------------------------------------------------------------
+
+// No core-only exports; everything in this module is visible to both
+// the core and tools.
+
+#include "pub_tool_libcsetjmp.h"
+
+#endif // __PUB_CORE_LIBCSETJMP_H
+
+/*--------------------------------------------------------------------*/
+/*--- end pub_core_libcsetjmp.h ---*/
+/*--------------------------------------------------------------------*/
ThreadOSstate os_state;
/* Per-thread jmp_buf to resume scheduler after a signal */
- Bool sched_jmpbuf_valid;
- jmp_buf sched_jmpbuf;
+ Bool sched_jmpbuf_valid;
+ VG_MINIMAL_JMP_BUF sched_jmpbuf;
}
ThreadState;
pub_tool_libcfile.h \
pub_tool_libcprint.h \
pub_tool_libcproc.h \
+ pub_tool_libcsetjmp.h \
pub_tool_libcsignal.h \
pub_tool_machine.h \
pub_tool_mallocfree.h \
--- /dev/null
+
+/*--------------------------------------------------------------------*/
+/*--- A minimal setjmp/longjmp facility. pub_tool_libcsetjmp.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2010-2010 Mozilla Inc
+
+ 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.
+*/
+
+/* Contributed by Julian Seward <jseward@acm.org> */
+
+#ifndef __PUB_TOOL_LIBCSETJMP_H
+#define __PUB_TOOL_LIBCSETJMP_H
+
+//--------------------------------------------------------------------
+// PURPOSE: Provides a minimal setjmp/longjmp facility, that saves/
+// restores integer registers, but not necessarily anything more.
+//--------------------------------------------------------------------
+
+
+/* This provides an extremely minimal setjmp/longjmp facility, in
+ which only the host's integer registers are saved/restored. Or at
+ least, that is the minimal guaranteed functionality.
+
+ Until Apr 2011 we used __builtin_setjmp and __builtin_longjmp, but
+ it appears that that is not always correctly implemented. See
+ https://bugs.kde.org/show_bug.cgi?id=259977. So this module wraps
+ those functions up and facilitates replacing them with our own
+ implementations where necessary.
+*/
+
+/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
+#include <setjmp.h>
+/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
+
+
+/* Don't use jmp_buf, __builtin_setjmp or __builtin_longjmp directly.
+ They don't always work reliably. Instead use these macros, which
+ provide the opportunity to supply alternative implementations as
+ necessary.
+
+ Note that the abstraction is done with macros (ick) rather than
+ functions and typedefs, since wrapping __builtin_setjmp up in a
+ second function (eg, VG_(minimal_setjmp)) doesn't seem to work for
+ whatever reason -- returns via a VG_(minimal_longjmp) go wrong.
+*/
+#define VG_MINIMAL_JMP_BUF jmp_buf
+#define VG_MINIMAL_SETJMP(_env) __builtin_setjmp((_env))
+#define VG_MINIMAL_LONGJMP(_env) __builtin_longjmp((_env),1)
+
+
+#endif // __PUB_TOOL_LIBCSETJMP_H
+
+/*--------------------------------------------------------------------*/
+/*--- end pub_tool_libcsetjmp.h ---*/
+/*--------------------------------------------------------------------*/
#include "pub_tool_options.h"
#include "pub_tool_oset.h"
#include "pub_tool_signals.h"
+#include "pub_tool_libcsetjmp.h" // setjmp facilities
#include "pub_tool_tooliface.h" // Needed for mc_include.h
#include "mc_include.h"
-#include <setjmp.h> // For jmp_buf
-
/*------------------------------------------------------------*/
/*--- An overview of leak checking. ---*/
/*------------------------------------------------------------*/
}
-static jmp_buf memscan_jmpbuf;
+static VG_MINIMAL_JMP_BUF memscan_jmpbuf;
static
void scan_all_valid_memory_catcher ( Int sigNo, Addr addr )
if (0)
VG_(printf)("OUCH! sig=%d addr=%#lx\n", sigNo, addr);
if (sigNo == VKI_SIGSEGV || sigNo == VKI_SIGBUS)
- __builtin_longjmp(memscan_jmpbuf, 1);
+ VG_MINIMAL_LONGJMP(memscan_jmpbuf);
}
// Scan a block of memory between [start, start+len). This range may
}
}
- if (__builtin_setjmp(memscan_jmpbuf) == 0) {
+ if (VG_MINIMAL_SETJMP(memscan_jmpbuf) == 0) {
if ( MC_(is_valid_aligned_word)(ptr) ) {
lc_scanned_szB += sizeof(Addr);
addr = *(Addr *)ptr;