|
From: Jeremy F. <je...@go...> - 2003-10-30 07:45:27
|
CVS commit by fitzhardinge: Add a --assume-2.4=yes|no CLO. This overrides the normal check to see if the kernel has enough capabilities to run in 2.6 mode (ie, futex, the right kind of clone, correct signal handling properties), and always uses 2.4 mode. This will often not work on a 2.6 or RH9 2.4 kernel, but it does help avoid a bug in the SuSE 8.2 (and possibly 9) kernels, which look like they support enough to run in 2.6 mode, but get it wrong. TODO: make the startup script/configure actually use this option. Also some cleanup in printing debugging messages from vg_proxylwp.c, and a small fix in the handling of ERESTARTSYS (assume that every syscall will get interrupted from the outset, until it actually completes). M +2 -0 vg_include.h 1.151 M +9 -0 vg_main.c 1.118 M +24 -13 vg_proxylwp.c 1.2 |
|
From: Nicholas N. <nj...@ca...> - 2003-10-30 09:38:17
|
CVS commit by nethercote:
Previously, if the command given to Valgrind didn't exist, the 'stat -c'
suid/sgid test failed, and the startup script aborted with an ugly message.
I've changed it so that it first checks that the program exists in the user's
path (as determined by 'which'), and aborts if not.
This was quite fiddly to get right; yell if I've broken anything.
M +37 -24 valgrind.in 1.34
--- valgrind/coregrind/valgrind.in #1.33:1.34
@@ -110,26 +110,38 @@
fi
-which_prog="`which $1`"
+# Check that the program looks ok
+is_prog=0
-# Ensure the program isn't statically linked.
if [ $# != 0 ] ; then
- case `file "$which_prog"` in
- *"statically linked"*)
- echo "\`$which_prog' is statically linked"
- echo "Valgrind only works on dynamically linked executables; your"
- echo "program must rely on at least one shared object for Valgrind"
- echo "to work with it. Read FAQ #5 for more information."
- exit 1 ;;
- esac
-fi
-# Ensure that there is no suid or sgid flag
-if [ `stat -c %a "$which_prog"` -gt 2000 ] ; then
- echo "\`$which_prog' is suid/sgid."
- echo "Valgrind can't handle these executables, as it"
- echo "requires the LD_PRELOAD feature in order to work."
- echo ""
- echo "Remove those flags and try again."
- exit 1
+ # Ensure the program exists. Ignore any error messages from 'which'.
+ which_prog=`which $1 2> /dev/null`
+ if [ z$which_prog = z ] ; then
+ echo "'$1' not found in \$PATH, aborting."
+ exit
+ fi
+
+ # Ensure the program isn't statically linked.
+ if [ $# != 0 ] ; then
+ case `file "$which_prog"` in
+ *"statically linked"*)
+ echo "\`$which_prog' is statically linked"
+ echo "Valgrind only works on dynamically linked executables; your"
+ echo "program must rely on at least one shared object for Valgrind"
+ echo "to work with it. Read FAQ #5 for more information."
+ exit 1 ;;
+ esac
+ fi
+
+ # Ensure that there is no suid or sgid flag
+ if [ `stat -c %a "$which_prog"` -gt 2000 ] ; then
+ echo "\`$which_prog' is suid/sgid."
+ echo "Valgrind can't handle these executables, as it"
+ echo "requires the LD_PRELOAD feature in order to work."
+ echo ""
+ echo "Remove those flags and try again."
+ exit 1
+ fi
+ is_prog=1
fi
@@ -150,11 +162,12 @@
#export LD_DEBUG
-# If no command given, act like -h was given so vg_main.c prints out
-# the usage string. And pass to 'exec' tha name of any program -- it doesn't
-# matter which -- because it won't be run anyway (we use 'true').
-if [ $# != 0 ] ; then
+# Actually run the program, under Valgrind's control
+if [ $is_prog = 1 ] ; then
exec "$@"
else
- VG_ARGS="$VG_ARGS -h"
+ # If no command given, act like -h was given so vg_main.c prints out the
+ # usage string. And pass to 'exec' the name of any program -- it doesn't
+ # matter which -- because it won't be run anyway (we use 'true').
+ VG_ARGS="$VG_ARGS -h"
exec true
fi
|
|
From: Jeremy F. <je...@go...> - 2003-10-31 07:14:11
|
CVS commit by fitzhardinge:
Fix --trace-malloc=yes, by using client-side VALGRIND_INTERNAL_PRINTF
to print the allocation traces rather than trying to directly use
VG_(printf).
M +8 -8 vg_replace_malloc.c 1.12
--- valgrind/coregrind/vg_replace_malloc.c #1.11:1.12
@@ -134,5 +134,5 @@ void VG_(replacement_malloc_print_debug_
#define MALLOC_TRACE(format, args...) \
if (VG_(clo_trace_malloc)) \
- VG_(printf)(format, ## args )
+ VALGRIND_INTERNAL_PRINTF(format, ## args )
#define MAYBE_SLOPPIFY(n) \
@@ -158,5 +158,5 @@ void* fff ( Int n ) \
v = VG_(arena_malloc)(VG_AR_CLIENT, n); \
} \
- MALLOC_TRACE(" = %p\n", v ); \
+ MALLOC_TRACE(" = %p", v ); \
return v; \
}
@@ -177,5 +177,5 @@ ALLOC( _ZnajRKSt9nothrow_t, SK_(__builti
void fff ( void* p ) \
{ \
- MALLOC_TRACE(#fff "[simd=%d](%p)\n", \
+ MALLOC_TRACE(#fff "[simd=%d](%p)", \
(UInt)VG_(is_running_on_simd_CPU)(), p ); \
if (p == NULL) \
@@ -206,5 +206,5 @@ void* calloc ( UInt nmemb, UInt size )
v = VG_(arena_calloc)(VG_AR_CLIENT, VG_(clo_alignment), nmemb, size);
}
- MALLOC_TRACE(" = %p\n", v );
+ MALLOC_TRACE(" = %p", v );
return v;
}
@@ -224,5 +224,5 @@ void* realloc ( void* ptrV, Int new_size
free(ptrV);
if (VG_(clo_trace_malloc))
- VG_(printf)(" = 0\n" );
+ VG_(printf)(" = 0" );
return NULL;
}
@@ -232,5 +232,5 @@ void* realloc ( void* ptrV, Int new_size
v = VG_(arena_realloc)(VG_AR_CLIENT, ptrV, VG_(clo_alignment), new_size);
}
- MALLOC_TRACE(" = %p\n", v );
+ MALLOC_TRACE(" = %p", v );
return v;
}
@@ -250,5 +250,5 @@ void* memalign ( Int alignment, Int n )
v = VG_(arena_malloc_aligned)(VG_AR_CLIENT, alignment, n);
}
- MALLOC_TRACE(" = %p\n", v );
+ MALLOC_TRACE(" = %p", v );
return v;
}
@@ -309,5 +309,5 @@ Int malloc_usable_size ( void* p )
pszB = VG_(arena_payload_szB)(VG_AR_CLIENT, p);
}
- MALLOC_TRACE(" = %d\n", pszB );
+ MALLOC_TRACE(" = %d", pszB );
return pszB;
|
|
From: Nicholas N. <nj...@ca...> - 2003-11-01 14:04:07
|
CVS commit by nethercote:
Add missing printf and pre_mem_read to rt_sigtimedwait(), thanks to Thomas
Lussnig <lu...@sm...>.
MERGE TO STABLE
M +4 -0 vg_syscalls.c 1.52
--- valgrind/coregrind/vg_syscalls.c #1.51:1.52
@@ -3958,4 +3958,8 @@ PRE(rt_sigtimedwait)
/* int sigtimedwait(const sigset_t *set, siginfo_t *info,
const struct timespec timeout); */
+ MAYBE_PRINTF("sigtimedwait ( %p, %p, timeout )\n", arg1, arg2);
+ if (arg1 != (UInt)NULL)
+ SYSCALL_TRACK( pre_mem_read, tid, "sigtimedwait(set)", arg1,
+ sizeof(vki_ksigset_t));
if (arg2 != (UInt)NULL)
SYSCALL_TRACK( pre_mem_write, tid, "sigtimedwait(info)", arg2,
|
|
From: Nicholas N. <nj...@ca...> - 2003-11-01 14:51:08
|
CVS commit by nethercote:
Make the startup static and suid checks follow symlinks.
Also a couple of minor formatting changes.
M +6 -6 valgrind.in 1.37
--- valgrind/coregrind/valgrind.in #1.36:1.37
@@ -118,11 +118,11 @@
which_prog=`which $1 2> /dev/null`
if [ z$which_prog = z ] ; then
- echo "'$1' not found in \$PATH, aborting."
- exit
+ echo "'$1' not found in \$PATH, aborting."
+ exit
fi
- # Ensure the program isn't statically linked.
if [ $# != 0 ] ; then
- case `file "$which_prog"` in
+ case `file -L "$which_prog"` in # must follow symlinks, hence -L
+ # Ensure the program isn't statically linked.
*"statically linked"*)
echo "\`$which_prog' is statically linked"
@@ -131,7 +131,7 @@
echo "to work with it. Read FAQ #5 for more information."
exit 1 ;;
- # ensure that there are no setuid or gid flags
+ # Ensure that there are no setuid or gid flags
*:\ set?id\ ELF*)
- echo "\`$which_prog' is suid/sgid."
+ echo "\`$which_prog' is suid/sgid."
echo "Valgrind can't handle these executables, as it"
echo "requires the LD_PRELOAD feature in order to work."
|
|
From: Dirk M. <mu...@kd...> - 2003-10-30 13:31:49
|
CVS commit by mueller:
make it really silent
M +1 -1 valgrind.in 1.35
--- valgrind/coregrind/valgrind.in #1.34:1.35
@@ -105,5 +105,5 @@
# an environment variable.
-if getconf GNU_LIBPTHREAD_VERSION | grep -qi NPTL 2>/dev/null; then
+if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null | grep -qi NPTL 2>/dev/null; then
LD_ASSUME_KERNEL=2.4.1
export LD_ASSUME_KERNEL
|
|
From: Dirk M. <mu...@kd...> - 2003-10-30 13:42:05
|
CVS commit by mueller: for some reason I need that to make it compile on suse 9 MERGE TO STABLE M +1 -1 vg_unsafe.h 1.18 --- valgrind/coregrind/vg_unsafe.h #1.17:1.18 @@ -38,5 +38,5 @@ #include <sys/utsname.h> /* for uname */ #include <sys/time.h> /* for struct timeval & struct timezone */ -#ifdef KERNEL_2_6 +#if defined(KERNEL_2_6) || defined(KERNEL_2_4) /* ugly hack to avoid that kernel headers redefine stuff from sys/time.h */ #define _LINUX_TIME_H |
|
From: Dirk M. <mu...@kd...> - 2003-10-30 13:50:07
|
CVS commit by mueller:
there have been reports that "stat" is not portable enough.
MERGE TO STABLE
M +10 -9 valgrind.in 1.36
--- valgrind/coregrind/valgrind.in #1.35:1.36
@@ -131,16 +131,17 @@
echo "to work with it. Read FAQ #5 for more information."
exit 1 ;;
+ # ensure that there are no setuid or gid flags
+ *:\ set?id\ ELF*)
+ echo "\`$which_prog' is suid/sgid."
+ echo "Valgrind can't handle these executables, as it"
+ echo "requires the LD_PRELOAD feature in order to work."
+ echo ""
+ echo "Remove those flags and try again."
+ echo ""
+ exit 1
+ ;;
esac
fi
- # Ensure that there is no suid or sgid flag
- if [ `stat -c %a "$which_prog"` -gt 2000 ] ; then
- echo "\`$which_prog' is suid/sgid."
- echo "Valgrind can't handle these executables, as it"
- echo "requires the LD_PRELOAD feature in order to work."
- echo ""
- echo "Remove those flags and try again."
- exit 1
- fi
is_prog=1
fi
|
|
From: Dirk M. <mu...@kd...> - 2003-11-01 01:59:54
|
CVS commit by mueller:
fix 'make dist'.
M +1 -0 Makefile.am 1.59
--- valgrind/coregrind/Makefile.am #1.58:1.59
@@ -89,4 +89,5 @@
vg_constants.h \
vg_symtab2.h \
+ vg_unistd.h \
vg_symtypes.h \
vg_unsafe.h
|
|
From: Nicholas N. <nj...@ca...> - 2003-11-02 17:00:54
|
CVS commit by nethercote:
Implemented PUSH/POP %{FS,GS}, and PUSH %CS (Nb: there is no POP %CS). Based
on patches from Adam Gundy and Tom Hughes.
MERGE TO STABLE
M +51 -44 vg_to_ucode.c 1.106
|
|
From: Nicholas N. <nj...@ca...> - 2003-11-03 12:10:06
|
CVS commit by nethercote:
Move var declarations to start of block, for older versions of gcc.
MERGE TO STABLE
M +2 -2 vg_to_ucode.c 1.107
--- valgrind/coregrind/vg_to_ucode.c #1.106:1.107
@@ -3597,6 +3597,6 @@ static
void dis_push_segreg ( UCodeBlock* cb, UInt sreg, Int sz )
{
- vg_assert(sz == 4);
Int t1 = newTemp(cb), t2 = newTemp(cb);
+ vg_assert(sz == 4);
uInstr2(cb, GETSEG, 2, ArchRegS, sreg, TempReg, t1);
uInstr2(cb, GET, 4, ArchReg, R_ESP, TempReg, t2);
@@ -3612,6 +3612,6 @@ static
void dis_pop_segreg ( UCodeBlock* cb, UInt sreg, Int sz )
{
- vg_assert(sz == 4);
Int t1 = newTemp(cb), t2 = newTemp(cb);
+ vg_assert(sz == 4);
uInstr2(cb, GET, 4, ArchReg, R_ESP, TempReg, t2);
uInstr2(cb, LOAD, 2, TempReg, t2, TempReg, t1);
|
|
From: Julian S. <js...@ac...> - 2003-11-04 07:13:53
|
CVS commit by jseward:
If we bomb out due to not finding the executable, print our invokation
name. Before:
'ssss' not found in $PATH, aborting.
After:
./Inst/bin/valgrind: 'ssss' not found in $PATH, aborting.
(Already in STABLE).
M +1 -1 valgrind.in 1.38
--- valgrind/coregrind/valgrind.in #1.37:1.38
@@ -118,5 +118,5 @@
which_prog=`which $1 2> /dev/null`
if [ z$which_prog = z ] ; then
- echo "'$1' not found in \$PATH, aborting."
+ echo "$0: '$1' not found in \$PATH, aborting."
exit
fi
|
|
From: Helio C. de C. <he...@co...> - 2003-11-04 12:34:01
|
CVS commit by helio: - Fix for kernel 2.6. __user need definition. M +3 -0 vg_intercept.c 1.23 --- valgrind/coregrind/vg_intercept.c #1.22:1.23 @@ -62,4 +62,7 @@ #include <sys/ipc.h> #include <sys/msg.h> +#ifdef KERNEL_2_6 +#include <linux/compiler.h> +#endif #include <asm/ipc.h> /* for ipc_kludge */ #include <sys/poll.h> |
|
From: Helio C. de C. <he...@co...> - 2003-11-04 12:54:29
|
CVS commit by helio: - Fix for kernel 2.6. __user need definition. M +3 -0 vg_unsafe.h 1.19 --- valgrind/coregrind/vg_unsafe.h #1.18:1.19 @@ -51,4 +51,7 @@ #include <net/if_arp.h> /* for struct arpreq */ #include <net/route.h> /* for struct rtentry */ +#ifdef KERNEL_2_6 +#include <linux/compiler.h> /* for __user definition */ +#endif #include <asm/ipc.h> /* for struct ipc_kludge */ #include <linux/msg.h> /* for struct msgbuf */ |
|
From: Nicholas N. <nj...@ca...> - 2003-11-10 13:27:19
|
CVS commit by nethercote:
Don't print this debug msg if -q is on.
MERGE TO STABLE
M +1 -1 vg_main.c 1.119
--- valgrind/coregrind/vg_main.c #1.118:1.119
@@ -1271,5 +1271,5 @@ static void process_cmd_line_options ( v
}
- if (VG_(clo_log_to) != VgLogTo_Fd) {
+ if (VG_(clo_verbosity) > 0 && VG_(clo_log_to) != VgLogTo_Fd) {
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg,
|
|
From: Jeremy F. <je...@go...> - 2003-11-10 21:21:53
|
CVS commit by fitzhardinge:
Fix some (bone-headed) loose ends left by my last checkin. "make regtest"
actually works this time.
M +11 -15 vg_proxylwp.c 1.4
M +6 -5 vg_syscalls.c 1.55
--- valgrind/coregrind/vg_proxylwp.c #1.3:1.4
@@ -372,20 +372,15 @@ static void proxy_fork_cleanup(ThreadId
}
- /* Create a proxy for calling thread
+ /* Create a proxy for calling thread.
- We need to temporarily set the state back to Runnable for
- proxy_create's benefit.
+ Since fork() is non-blocking, the thread status should already
+ be Runnable.
*/
+ vg_assert(VG_(is_valid_tid)(tid));
+ vg_assert(VG_(threads)[tid].proxy == NULL);
+ vg_assert(VG_(threads)[tid].status == VgTs_Runnable);
- {
- ThreadState *tst = VG_(get_ThreadState)(tid);
-
- vg_assert(tst->proxy == NULL);
- vg_assert(tst->status == VgTs_WaitSys);
- tst->status = VgTs_Runnable;
VG_(proxy_create)(tid);
VG_(proxy_setsigmask)(tid);
- tst->status = VgTs_WaitSys;
- }
}
@@ -443,5 +438,6 @@ void VG_(proxy_handlesig)(const vki_ksig
eax contains the correct syscall return value, and the new
state is effectively PXS_SysDone. */
- vg_assert(px->state == PXS_RunSyscall || px->state == PXS_SysDone);
+ vg_assert(px->state == PXS_RunSyscall ||
+ px->state == PXS_SysDone);
px->state = PXS_SysDone;
px->tst->m_eax = eax;
--- valgrind/coregrind/vg_syscalls.c #1.54:1.55
@@ -4436,5 +4436,8 @@ Bool VG_(pre_syscall) ( ThreadId tid )
syscall_done = True;
} else if (sys->may_block) {
- /* issue to worker */
+ /* Issue to worker. If we're waiting on the syscall because
+ it's in the hands of the ProxyLWP, then set the thread
+ state to WaitSys. */
+ tst->status = VgTs_WaitSys;
VG_(sys_issue)(tid);
} else {
@@ -4453,8 +4456,6 @@ Bool VG_(pre_syscall) ( ThreadId tid )
VGP_POPCC(VgpCoreSysWrap);
- /* If we're waiting on the syscall because it's in the hands of the
- ProxyLWP, then set the thread state to WaitSys. */
- if (!syscall_done)
- tst->status = VgTs_WaitSys;
+ vg_assert(( syscall_done && tst->status == VgTs_Runnable) ||
+ (!syscall_done && tst->status == VgTs_WaitSys ));
return syscall_done;
|
|
From: Nicholas N. <nj...@ca...> - 2003-11-13 16:49:53
|
CVS commit by nethercote:
Be quieter.
M +1 -1 vg_proxylwp.c 1.5
--- valgrind/coregrind/vg_proxylwp.c #1.4:1.5
@@ -1054,5 +1054,5 @@ void VG_(proxy_delete)(ThreadId tid, Boo
res = proxy_wait(proxy, True, &status);
- if (!res || status != 0)
+ if ((!res || status != 0) && VG_(clo_verbosity) > 1)
VG_(printf)("proxy %d for tid %d exited status %d, res %d\n",
lwp, tid, status, res);
|
|
From: Nicholas N. <nj...@ca...> - 2003-11-13 21:51:17
|
CVS commit by nethercote:
Remove local shellshort function, use the standard VG_(ssort).
M +8 -52 vg_symtab2.c 1.56
--- valgrind/coregrind/vg_symtab2.c #1.55:1.56
@@ -384,53 +384,9 @@ void safeCopy ( UChar* dst, UInt maxlen,
/*------------------------------------------------------------*/
-static void shellsort(void *base, UInt nmemb, UInt sz, Int (*compare)(void *a, void *b))
-{
- /* Magic numbers due to Janet Incerpi and Robert Sedgewick. */
- static const Int incs[16] = { 1, 3, 7, 21, 48, 112, 336, 861, 1968,
- 4592, 13776, 33936, 86961, 198768,
- 463792, 1391376 };
- Int lo = 0;
- Int hi = nmemb-1;
- Int bigN;
- Int hp;
- Char *cp = (Char *)base;
- Char tmp[sz];
-
- bigN = hi - lo + 1;
- if (bigN < 2)
- return;
- hp = 0;
- while (hp < 16 && incs[hp] < bigN)
- hp++;
- hp--;
- vg_assert(0 <= hp && hp < 16);
-
- for (; hp >= 0; hp--) {
- Int i, h;
-
- h = incs[hp];
- i = lo + h;
- for (i = lo+h; i <= hi; i++) {
- Int j;
- VG_(memcpy)(&tmp, &cp[i * sz], sz);
-
- j = i;
- while ((*compare)((void *)&cp[(j-h) * sz], (void *)&tmp) > 0) {
- VG_(memcpy)(&cp[j * sz], &cp[(j-h) * sz], sz);
- j = j - h;
- if (j <= (lo + h - 1))
- break;
- }
- VG_(memcpy)(&cp[j * sz], &tmp, sz);
- }
- }
-}
-
/* Sort the symtab by starting address, and emit warnings if any
- symbols have overlapping address ranges. We use that old chestnut,
- shellsort. Mash the table around so as to establish the property
- that addresses are in order and the ranges to not overlap. This
- facilitates using binary search to map addresses to symbols when we
- come to query the table.
+ symbols have overlapping address ranges. Mash the table around so as to
+ establish the property that addresses are in order and the ranges to not
+ overlap. This facilitates using binary search to map addresses to
+ symbols when we come to query the table.
*/
static Int compare_RiSym(void *va, void *vb) {
@@ -453,5 +409,5 @@ void canonicaliseSymtab ( SegInfo* si )
return;
- shellsort(si->symtab, si->symtab_used, sizeof(*si->symtab), compare_RiSym);
+ VG_(ssort)(si->symtab, si->symtab_used, sizeof(*si->symtab), compare_RiSym);
cleanup_more:
@@ -581,5 +537,5 @@ void canonicaliseScopetab ( SegInfo* si
/* Sort by start address. */
- shellsort(si->scopetab, si->scopetab_used, sizeof(*si->scopetab),
+ VG_(ssort)(si->scopetab, si->scopetab_used, sizeof(*si->scopetab),
compare_ScopeRange);
@@ -653,5 +609,5 @@ void canonicaliseLoctab ( SegInfo* si )
/* Sort by start address. */
- shellsort(si->loctab, si->loctab_used, sizeof(*si->loctab), compare_RiLoc);
+ VG_(ssort)(si->loctab, si->loctab_used, sizeof(*si->loctab), compare_RiLoc);
/* If two adjacent entries overlap, truncate the first. */
|
|
From: Nicholas N. <nj...@ca...> - 2003-11-13 22:34:31
|
CVS commit by nethercote: Greatly improved the symbol table reading code. It was a kludgy, accreted mess. Pulled the symbol table reading bit out of vg_read_lib_symbols() into read_symtab(), in the process removing the awful twice-only loop used to read the symbol table and the dynamic symbol table. Factored out the code used to find sections of interest (eg. .strtab, .symtab, .stabs, .plt, etc), replacing nine (yes, nine) individual and slightly differing searches. It's now much easier to understand, 132 lines shorter, and provides a better base for easily doing more complicated debug stuff, eg. when we start reading in all the debugging info (such as .debug_info for dwarf2). M +250 -342 vg_symtab2.c 1.57 |
|
From: Nicholas N. <nj...@ca...> - 2003-11-15 19:24:39
|
CVS commit by nethercote:
Support posix_memalign properly.
M +4 -0 vg_replace_malloc.c 1.14
--- valgrind/coregrind/vg_replace_malloc.c #1.13:1.14
@@ -291,4 +291,8 @@ int __posix_memalign ( void **memptr, UI
}
+# define weak_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
+weak_alias(__posix_memalign, posix_memalign);
+
Int malloc_usable_size ( void* p )
{
|
|
From: Dirk M. <mu...@kd...> - 2003-11-19 00:46:22
|
CVS commit by mueller:
implement statfs64, utimes and clock_gettime
M +42 -1 vg_syscalls.c 1.57
M +2 -1 vg_unsafe.h 1.20
--- valgrind/coregrind/vg_syscalls.c #1.56:1.57
@@ -4053,5 +4053,14 @@ PRE(statfs)
MAYBE_PRINTF("statfs ( %p, %p )\n",arg1,arg2);
SYSCALL_TRACK( pre_mem_read_asciiz, tid, "statfs(path)", arg1 );
- SYSCALL_TRACK( pre_mem_write, tid, "stat(buf)",
+ SYSCALL_TRACK( pre_mem_write, tid, "statfs(buf)",
+ arg2, sizeof(struct statfs) );
+}
+
+PRE(statfs64)
+{
+ /* int statfs64(const char *path, struct statfs *buf); */
+ MAYBE_PRINTF("statfs64 ( %p, %p )\n",arg1,arg2);
+ SYSCALL_TRACK( pre_mem_read_asciiz, tid, "statfs64(path)", arg1 );
+ SYSCALL_TRACK( pre_mem_write, tid, "statfs64(buf)",
arg2, sizeof(struct statfs) );
}
@@ -4062,4 +4071,9 @@ POST(statfs)
}
+POST(statfs64)
+{
+ VG_TRACK( post_mem_write, arg2, sizeof(struct statfs64) );
+}
+
PRE(symlink)
{
@@ -4282,4 +4296,28 @@ POST(adjtimex)
}
+PRE(clock_gettime)
+{
+ /* int clock_gettime(clockid_t clk_id, struct timespec *tp); */
+ MAYBE_PRINTF("clock_gettime(%d, %p)\n" ,arg1,arg2);
+ SYSCALL_TRACK(pre_mem_write, tid, "clock_gettime(tp)",
+ arg2, sizeof(struct timespec));
+}
+
+POST(clock_gettime)
+{
+ if (!VG_(is_kerror)(res) && res == 0)
+ VG_TRACK( post_mem_write, arg2, sizeof(struct timespec) );
+}
+
+PRE(utimes)
+{
+ /* int utimes(const char *filename, struct timeval *tvp); */
+ MAYBE_PRINTF("utimes ( %p, %p )\n", arg1,arg2);
+ SYSCALL_TRACK( pre_mem_read_asciiz, tid, "utimes(filename)", arg1 );
+ if (arg2 != (UInt)NULL)
+ SYSCALL_TRACK( pre_mem_read, tid, "utimes(tvp)", arg2,
+ sizeof(struct timeval) );
+}
+
#define SIGNAL_SIMULATION 1
@@ -4657,4 +4695,5 @@ static const struct sys_info sys_info[]
SYSBA(stat, False),
SYSBA(statfs, False),
+ SYSBA(statfs64, False),
SYSB_(symlink, True),
SYSBA(stat64, False),
@@ -4668,4 +4707,5 @@ static const struct sys_info sys_info[]
SYSBA(uname, False),
SYSB_(utime, True),
+ SYSB_(utimes, False),
SYSBA(waitpid, True),
SYSBA(wait4, True),
@@ -4673,4 +4713,5 @@ static const struct sys_info sys_info[]
SYSB_(prctl, True),
SYSBA(adjtimex, False),
+ SYSBA(clock_gettime, False),
/* new signal handling makes these normal blocking syscalls */
--- valgrind/coregrind/vg_unsafe.h #1.19:1.20
@@ -91,5 +91,6 @@
#include <sys/types.h>
-#include <sys/statfs.h>
+#include <asm/statfs.h>
+#undef statfs
#include <sys/sysinfo.h>
|
|
From: Nicholas N. <nj...@ca...> - 2003-11-19 09:59:30
|
On Wed, 19 Nov 2003, Dirk Mueller wrote: > CVS commit by mueller: > > implement statfs64, utimes and clock_gettime The HEAD now doesn't compile on my machine: vg_syscalls.c: In function `before_statfs64': vg_syscalls.c:4070: sizeof applied to an incomplete type vg_syscalls.c: In function `after_statfs64': vg_syscalls.c:4075: sizeof applied to an incomplete type Also, not printing the "discarding..." message will, I think, break some regression tests. These problems may also apply to the stable branch. Can you fix them? Thanks. And don't forget to run the regression tests before committing :) N |
|
From: Dirk M. <mu...@kd...> - 2003-11-19 10:34:12
|
On Wednesday 19 November 2003 10:59, Nicholas Nethercote wrote: > > implement statfs64, utimes and clock_gettime > vg_syscalls.c: In function `before_statfs64': > vg_syscalls.c:4070: sizeof applied to an incomplete type Ok, same question to you: where is statfs64 defined for you? for me its in asm/statfs.h Its a bit tricky to use this here since normally you're supposed to do this via the D_FILE_OFFSET_BITS define, which we can't do since we want the old 32bit version and the 64bit version. somehow we need a script that calculates the magic values of sizeof() etc and then just import that header file with the list of #define's . Including nonstandard kernel headers is just too unportable, even for valgrind. > > Also, not printing the "discarding..." message will, I think, break some > regression tests. These problems may also apply to the stable branch. Well, make regtest prints 0 failures for me. do you see some? where? > Can you fix them? Thanks. And don't forget to run the regression tests > before committing :) Of course I did that. 0 failures in branch, all failed in HEAD, but thats because HEAD does not even work on /bin/true for me. |
|
From: Nicholas N. <nj...@ca...> - 2003-11-19 15:18:10
|
On Wed, 19 Nov 2003, Dirk Mueller wrote: > Ok, same question to you: where is statfs64 defined for you? for me its in > asm/statfs.h bits/statfs.h > Its a bit tricky to use this here since normally you're supposed to do this > via the D_FILE_OFFSET_BITS define, which we can't do since we want the old > 32bit version and the 64bit version. > > somehow we need a script that calculates the magic values of sizeof() etc and > then just import that header file with the list of #define's . Including > nonstandard kernel headers is just too unportable, even for valgrind. > > > > Also, not printing the "discarding..." message will, I think, break some > > regression tests. These problems may also apply to the stable branch. > > Well, make regtest prints 0 failures for me. do you see some? where? Sorry, my mistake. > Of course I did that. 0 failures in branch, all failed in HEAD, but thats > because HEAD does not even work on /bin/true for me. Sorry for the mis-accusation. What's the problem with HEAD -- it doesn't work on your machine at all? Have you told Jeremy? (well, I guess he knows now...) N |
|
From: Dirk M. <mu...@kd...> - 2003-11-19 17:11:39
|
On Wednesday 19 November 2003 16:18, Nicholas Nethercote wrote: > What's the problem with HEAD -- it doesn't work on your machine at all? > Have you told Jeremy? (well, I guess he knows now...) This happens: ==25531== Memcheck, a memory error detector for x86-linux. ==25531== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward. ==25531== Using valgrind-HEAD, a program supervision framework for x86-linux. ==25531== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward. ==25531== Estimated CPU clock rate is 1540 MHz ==25531== For more details, rerun with: -v ==25531== ==25531== ==25531== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==25531== malloc/free: in use at exit: 0 bytes in 0 blocks. ==25531== malloc/free: 103 allocs, 103 frees, 7925 bytes allocated. ==25531== For a detailed leak analysis, rerun with: --leak-check=yes ==25531== For counts of detected errors, rerun with: -v --25531-- TID 1: proxy LWP 0 exited with status 0 valgrind: vg_proxylwp.c:1360 (vgPlain_proxy_sanity): Assertion `sane' failed. ==25531== at 0x4017A01E: vgPlain_skin_assert_fail (vg_mylibc.c:1102) ==25531== by 0x4017A01D: assert_fail (vg_mylibc.c:1098) ==25531== by 0x4017A0A8: vgPlain_core_assert_fail (vg_mylibc.c:1109) ==25531== by 0x4017E89B: vgPlain_proxy_sanity (vg_proxylwp.c:1360) ==25531== by 0x40175060: vgPlain_do_sanity_checks (vg_main.c:2051) ==25531== by 0x4017484A: vgPlain_main (vg_main.c:1699) sched status: Thread 1: status = Runnable, associated_mx = 0x0, associated_cv = 0x0 ==25531== at 0x40171A33: vgPlain___libc_freeres_wrapper (vg_intercept.c:177) ==25531== by 0x40271057: __GI_exit (in /lib/i686/libc.so.6) ==25531== by 0x8048A9D: (within /bin/true) ==25531== by 0x4025AD16: __libc_start_main (in /lib/i686/libc.so.6) ==25531== by 0x80488C0: (within /bin/true) Note: see also the FAQ.txt in the source distribution. It contains workarounds to several common problems. If that doesn't help, please report this bug to: js...@ac... In the bug report, send all the above text, the valgrind version, and what Linux distro you are using. Thanks. It works when I use --assume-2.4=yes, but I don't consider this switch to be a good idea. can't we detect whatever weird kernel feature we now need at runtime? |