|
From: Jeremy F. <je...@go...> - 2005-03-07 22:06:51
|
CVS commit by fitzhardinge:
BUGFIX: process_cmd_line_options mangles options with the syntax
--TOOLNAME:option=foo. If you use --trace-children=yes, the child
Valgrinds are passed the mangled options and fail as a result.
This patch makes sure that process_cmd_line_options makes a copy of
the option before mangling it.
M +8 -5 vg_main.c 1.263
--- valgrind/coregrind/vg_main.c #1.262:1.263
@@ -1626,5 +1626,5 @@ static void process_cmd_line_options( UI
if (0)
VG_(printf)("tool-specific arg: %s\n", arg);
- arg += toolname_len + 1;
+ arg = strdup(arg + toolname_len + 1);
arg[0] = '-';
arg[1] = '-';
@@ -1638,12 +1638,12 @@ static void process_cmd_line_options( UI
/* Ignore these options - they've already been handled */
if (VG_CLO_STREQN(7, arg, "--tool="))
- continue;
+ goto skip_arg;
if (VG_CLO_STREQN(7, arg, "--exec="))
- continue;
+ goto skip_arg;
if (VG_CLO_STREQN(20, arg, "--command-line-only="))
- continue;
+ goto skip_arg;
if ( VG_CLO_STREQ(arg, "--"))
- continue;
+ goto skip_arg;
else if (VG_CLO_STREQ(arg, "-v") ||
@@ -1756,4 +1756,7 @@ static void process_cmd_line_options( UI
VG_(bad_option)(arg);
}
+ skip_arg:
+ if (arg != vg_argv[i])
+ free(arg);
}
|
|
From: Jeremy F. <je...@go...> - 2005-03-10 02:04:11
|
CVS commit by fitzhardinge:
Only try matching if the pointer could be resolved to a name.
M +4 -2 vg_errcontext.c 1.73
--- valgrind/coregrind/vg_errcontext.c #1.72:1.73
@@ -980,10 +980,12 @@ Bool supp_matches_callers(Error* err, Su
switch (su->callers[i].ty) {
case ObjName:
- (void)VG_(get_objname)(a, caller_name, M_VG_ERRTXT);
+ if (!VG_(get_objname)(a, caller_name, M_VG_ERRTXT))
+ return False;
break;
case FunName:
// Nb: mangled names used in suppressions
- (void)VG_(get_fnname_nodemangle)(a, caller_name, M_VG_ERRTXT);
+ if (!VG_(get_fnname_nodemangle)(a, caller_name, M_VG_ERRTXT))
+ return False;
break;
default: VG_(skin_panic)("supp_matches_callers");
|
|
From: Jeremy F. <je...@go...> - 2005-03-10 09:05:17
|
CVS commit by fitzhardinge:
Get more useful stack traces for internal errors/panics which happen
during the exit cleanup. Also, don't report stack growth failures if
the fault is actually way above the stack.
M +5 -2 vg_signals.c 1.136
--- valgrind/coregrind/vg_signals.c #1.135:1.136
@@ -1812,5 +1812,6 @@ void vg_sync_signalhandler ( Int sigNo,
if (info->si_code == 1 && /* SEGV_MAPERR */
- fault >= esp) {
+ fault >= esp &&
+ fault < VG_(client_end)) {
/* If the fault address is above esp but below the current known
stack segment base, and it was a fault because there was
@@ -1908,5 +1909,7 @@ void vg_sync_signalhandler ( Int sigNo,
VG_(kill_self)(sigNo); /* generate a core dump */
- tst = VG_(get_ThreadState)(VG_(get_lwp_tid)(VG_(gettid)()));
+ if (tid == 0) /* could happen after everyone has exited */
+ tid = VG_(master_tid);
+ tst = VG_(get_ThreadState)(tid);
VG_(core_panic_at)("Killed by fatal signal",
VG_(get_ExeContext2)(UCONTEXT_INSTR_PTR(uc),
|
|
From: Jeremy F. <je...@go...> - 2005-03-11 02:53:00
|
CVS commit by fitzhardinge:
Check for NULL arguments when converting from non-RT to RT sigmasks.
M +4 -2 vg_syscalls.c 1.258
--- valgrind/coregrind/vg_syscalls.c #1.257:1.258
@@ -5514,4 +5514,5 @@ PRE(sys_sigsuspend, MayBlock)
int, history0, int, history1,
vki_old_sigset_t, mask);
+ if (arg3)
convert_sigset_to_rt((const vki_old_sigset_t *)arg3, &tst->tmp_sig_mask);
}
@@ -5687,4 +5688,5 @@ PRE(sys_sigprocmask, Special)
vki_sigset_t bigger_oldset;
+ if (set)
convert_sigset_to_rt(set, &bigger_set);
|
|
From: Jeremy F. <je...@go...> - 2005-03-11 02:54:42
|
CVS commit by fitzhardinge:
Memset the whole ehdr structure (though this will only initialize the padding).
M +1 -1 vg_signals.c 1.137
--- valgrind/coregrind/vg_signals.c #1.136:1.137
@@ -922,5 +922,5 @@ static Bool should_dump(const Segment *s
static void fill_ehdr(Elf32_Ehdr *ehdr, Int num_phdrs)
{
- VG_(memset)(ehdr, 0, sizeof(ehdr));
+ VG_(memset)(ehdr, 0, sizeof(*ehdr));
VG_(memcpy)(ehdr->e_ident, ELFMAG, SELFMAG);
|
|
From: Jeremy F. <je...@go...> - 2005-03-11 04:19:06
|
CVS commit by fitzhardinge:
Fix a couple of printf formatting inconsistencies.
M +1 -1 vg_main.c 1.264
M +1 -1 vg_syscalls.c 1.259
--- valgrind/coregrind/vg_main.c #1.263:1.264
@@ -178,5 +178,5 @@ static void print_all_stats ( void )
VG_(bb_enchain_count), VG_(bb_dechain_count) );
VG_(message)(Vg_DebugMsg,
- " dispatch: %llu jumps (bb entries); of them %u (%lu%%) unchained.",
+ " dispatch: %llu jumps (bb entries); of them %u (%llu%%) unchained.",
VG_(bbs_done),
VG_(unchained_jumps_done),
--- valgrind/coregrind/vg_syscalls.c #1.258:1.259
@@ -6167,5 +6167,5 @@ void VG_(client_syscall) ( ThreadId tid
machinery. */
VG_(set_running)(tid);
- PRINT("SYSCALL[%d,%d](%3d) --> %ld (0x%lx)\n",
+ PRINT("SYSCALL[%d,%d](%3d) --> %lld (0x%llx)\n",
VG_(getpid)(), tid, syscallno, (Long)(Word)SYSRES, (ULong)SYSRES);
} else {
|
|
From: Jeremy F. <je...@go...> - 2005-03-11 22:38:58
|
CVS commit by fitzhardinge:
When a multi-threaded program forks(), only the thread actually
calling fork() appears in the child. The child Valgrind will inherit a
VG_(threads) array which still describes the other threads. The code in
vg_scheduler:sched_fork_cleanup is responsible for doing this, but it was
only "killing" the other threads by setting their statuses to VgTs_Empty.
This was causing confusion if the child later created other threads
and found partially initialized threads structures. This change
makes sched_fork_cleanup fully reinitialize the other thread slots
in VG_(threads).
M +20 -3 vg_scheduler.c 1.229
--- valgrind/coregrind/vg_scheduler.c #1.228:1.229
@@ -529,6 +529,21 @@ void mostly_clear_thread_record ( Thread
}
-/* Called in the child after fork. Presumably the parent was running,
- so we now we're running. */
+/*
+ Called in the child after fork. If the parent has multiple
+ threads, then we've inhereted a VG_(threads) array describing them,
+ but only the thread which called fork() is actually alive in the
+ child. This functions needs to clean up all those other thread
+ structures.
+
+ Whichever tid in the parent which called fork() becomes the
+ master_tid in the child. That's because the only living slot in
+ VG_(threads) in the child after fork is VG_(threads)[tid], and it
+ would be too hard to try to re-number the thread and relocate the
+ thread state down to VG_(threads)[1].
+
+ This function also needs to reinitialize the run_sema, since
+ otherwise we may end up sharing its state with the parent, which
+ would be deeply confusing.
+*/
static void sched_fork_cleanup(ThreadId me)
{
@@ -543,7 +558,9 @@ static void sched_fork_cleanup(ThreadId
/* clear out all the unused thread slots */
for (tid = 1; tid < VG_N_THREADS; tid++) {
- if (tid != me)
+ if (tid != me) {
+ mostly_clear_thread_record(tid);
VG_(threads)[tid].status = VgTs_Empty;
}
+ }
/* re-init and take the sema */
|
|
From: Jeremy F. <je...@go...> - 2005-03-12 00:24:02
|
CVS commit by fitzhardinge:
For signals which are ignored by default (SIGCONT, CHLD, WINCH and URG),
don't set a signal handler unless the client has. This prevents syscalls
from being spuriously interrupted if one if these signals is received.
BUGS: 101313
M +9 -2 vg_signals.c 1.139
--- valgrind/coregrind/vg_signals.c #1.138:1.139
@@ -252,6 +252,11 @@ void calculate_SKSS_from_SCSS ( SKSS* ds
case VKI_SIGCONT:
- /* Let the kernel handle SIGCONT unless the client is actually
- catching it. */
+ case VKI_SIGCHLD:
+ case VKI_SIGWINCH:
+ case VKI_SIGURG:
+ /* For signals which are have a default action of Ignore,
+ only set a handler if the client has set a signal handler.
+ Otherwise the kernel will interrupt a syscall which
+ wouldn't have otherwise been interrupted. */
if (vg_scss.scss_per_sig[sig].scss_handler == VKI_SIG_DFL)
skss_handler = VKI_SIG_DFL;
@@ -263,4 +268,6 @@ void calculate_SKSS_from_SCSS ( SKSS* ds
default:
+ /* VKI_SIGVG* are runtime variables, so we can't make them
+ switch cases */
if (sig == VKI_SIGVGKILL)
skss_handler = sigvgkill_handler;
|
|
From: Jeremy F. <je...@go...> - 2005-03-12 00:52:10
|
CVS commit by fitzhardinge:
Don't merge segments after mprotect. This was the only change needed
to make rtldi work.
M +1 -1 vg_memory.c 1.95
--- valgrind/coregrind/vg_memory.c #1.94:1.95
@@ -520,5 +520,5 @@ void VG_(mprotect_range)(Addr a, SizeT l
}
- merge_segments(a, len);
+ //merge_segments(a, len);
}
|
|
From: Jeremy F. <je...@go...> - 2005-03-12 08:22:42
|
CVS commit by fitzhardinge:
Fix incorrect parsing of 'R' floating-point types.
M +0 -2 vg_stabs.c 1.23
--- valgrind/coregrind/vg_stabs.c #1.22:1.23
@@ -679,6 +679,4 @@ static SymType *stabtype_parser(SegInfo
bytes = atoi(&p, 0);
EXPECT(';', "FP-TYPE bytes");
- atoi(&p, 0);
- EXPECT(';', "FP-TYPE extra");
type = VG_(st_mkfloat)(def, bytes);
|
|
From: Nicholas N. <nj...@cs...> - 2005-03-13 05:13:10
|
CVS commit by nethercote:
Add missing argument to a printf.
M +1 -1 vg_scheduler.c 1.230
--- valgrind/coregrind/vg_scheduler.c #1.229:1.230
@@ -1081,5 +1081,5 @@ void scheduler_sanity ( ThreadId tid )
VG_(message)(Vg_DebugMsg,
"Thread %d supposed to be in LWP %d, but we're actually %d\n",
- VG_(threads)[tid].os_state.lwpid, VG_(gettid)());
+ tid, VG_(threads)[tid].os_state.lwpid, VG_(gettid)());
bad = True;
}
|
|
From: Jeremy F. <je...@go...> - 2005-03-18 07:39:31
|
CVS commit by fitzhardinge:
sigsuspend was not sanitizing the temporary signal mask, which allowed
SIGVGKILL to be blocked. This could cause process-exit to hang
indefinitely while threads ignore their requests to exit.
This patch sanitizes a copy of the temp sig mask, and points the syscall
to the sanitized version.
M +21 -3 vg_syscalls.c 1.261
--- valgrind/coregrind/vg_syscalls.c #1.260:1.261
@@ -5501,5 +5501,6 @@ PRE(sys_pause, MayBlock)
PRE(sys_sigsuspend, MayBlock)
{
- /* The C library interface to sigsuspend just takes a pointer to
+ /*
+ The C library interface to sigsuspend just takes a pointer to
a signal mask but this system call has three arguments - the first
two don't appear to be used by the kernel and are always passed as
@@ -5509,4 +5510,10 @@ PRE(sys_sigsuspend, MayBlock)
In fact glibc normally uses rt_sigsuspend if it is available as
that takes a pointer to the signal mask so supports more signals.
+
+ NOTE: (non-RT) sigsuspend can't block RT signals like
+ VKI_SIGVGKILL, so we don't need to worry about sanitizing its
+ mask, like we do with rt_sigsuspend. We still need
+ tst->tmp_sig_mask to be set, since this is the effective signal
+ mask for any signal handlers which run during this syscall.
*/
PRINT("sys_sigsuspend ( %d, %d, %d )", arg1,arg2,arg3 );
@@ -5520,5 +5527,6 @@ PRE(sys_sigsuspend, MayBlock)
PRE(sys_rt_sigsuspend, MayBlock)
{
- /* The C library interface to sigsuspend just takes a pointer to
+ /*
+ The C library interface to sigsuspend just takes a pointer to
a signal mask but this system call has two arguments - a pointer
to the mask and the number of bytes used by it. The kernel insists
@@ -5527,8 +5535,18 @@ PRE(sys_rt_sigsuspend, MayBlock)
*/
PRINT("sys_rt_sigsuspend ( %p, %d )", arg1,arg2 );
- PRE_REG_READ2(int, "rt_sigsuspend", vki_sigset_t *, mask, vki_size_t, size);
+ PRE_REG_READ2(int, "rt_sigsuspend",
+ vki_sigset_t *, mask, vki_size_t, size);
if (arg1 != (Addr)NULL) {
SYS_PRE_MEM_READ( "rt_sigsuspend(mask)", arg1, sizeof(vki_sigset_t) );
+
+ /* We need to make sure that the rt_sigsuspend doesn't mask more
+ signals than it is allowed, so we make a copy of the
+ temporary mask, sanitize that, and point the syscall to use
+ the copy. (We need this copy anyway, because its the
+ effective signal mask during any signal handlers which are
+ called during this syscall.) */
tst->tmp_sig_mask = *(vki_sigset_t *)arg1;
+ VG_(sanitize_client_sigmask)(tid, &tst->tmp_sig_mask);
+ arg1 = (Addr)&tst->tmp_sig_mask;
}
}
|
|
From: Jeremy F. <je...@go...> - 2005-03-20 18:40:59
|
CVS commit by fitzhardinge:
Skip a stab if it has no ':' at all.
M +11 -1 vg_stabs.c 1.24
--- valgrind/coregrind/vg_stabs.c #1.23:1.24
@@ -1029,6 +1029,16 @@ static Bool initSym(SegInfo *si, Sym *sy
si, si->stab_typetab, sym, kind, name, name, val);
+ /* Find first ':' */
ty = VG_(strchr)(name, ':');
- while (ty && ty[1] == ':') ty = VG_(strchr)(ty + 2, ':');
+
+ /* Skip '::' */
+ while (ty && ty[1] == ':')
+ ty = VG_(strchr)(ty + 2, ':');
+
+ if (ty == NULL) {
+ /* there was no ':' */
+ *namep += VG_(strlen)(name);
+ return True; /* skip */
+ }
len = ty - name;
|
|
From: Julian S. <js...@ac...> - 2005-03-21 20:11:07
|
CVS commit by jseward:
Patch from Jeremy: modify the handling of sys_get_ppid so as to
resolve deadlocks of threaded programs at exit under LinuxThreads.
If the master thread has already exited, and it is this thread's
parent, then force getppid to return 1 (init) rather than the real
ppid, so that it thinks its parent has exited. This is necessary
because the master thread is artificially kept alive by V until all
other threads have exited, even after it asks to exit. If any other
thread is waiting for the master thread to exit, and is checking for
that event by polling with get_ppid, it will never observe the master
thread exiting, and so will never itself exit. But since the master
thread is waiting for all others to exit, we get a deadlock.
This patch adjusts sys_get_ppid so it answers "yes, the master thread
has exited" once the master thread has done sys_exit, even if in fact
it is still alive. That makes observations from get_ppid consistent
with the exit-state of threads and breaks the deadlock.
M +10 -0 vg_syscalls.c 1.262
M +1 -1 x86-linux/syscalls.c 1.28
--- valgrind/coregrind/vg_syscalls.c #1.261:1.262
@@ -2290,4 +2290,14 @@ PRE(sys_getppid, 0)
}
+POST(sys_getppid)
+{
+ /* If the master thread has already exited, and it is this thread's
+ parent, then force getppid to return 1 (init) rather than the
+ real ppid, so that it thinks its parent has exited. */
+ if (VG_(threads)[VG_(master_tid)].os_state.lwpid == SYSRES &&
+ VG_(is_exiting)(VG_(master_tid)))
+ SYSRES = 1;
+}
+
PRE(sys_gettid, 0)
{
--- valgrind/coregrind/x86-linux/syscalls.c #1.27:1.28
@@ -775,5 +775,5 @@ const struct SyscallTableEntry VGA_(sysc
// (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated
GENXY(__NR_dup2, sys_dup2), // 63
- GENX_(__NR_getppid, sys_getppid), // 64
+ GENXY(__NR_getppid, sys_getppid), // 64
GENX_(__NR_getpgrp, sys_getpgrp), // 65
|
|
From: Julian S. <js...@ac...> - 2005-03-21 20:26:41
|
CVS commit by jseward:
A second patch from Jeremy, which is also required to solve the
OOo-on-LinuxThreads hangs at exit problem. This patch goes along
with (vg_syscalls.c 1.262, x86-linux/syscalls.c 1.28).
If we're sending a SIGKILL to one of our own threads, then simulate it
rather than really sending the signal, so that the target thread gets
a chance to clean up. Returns True if we did the killing (or no
killing is necessary), and False if the caller should use the normal
kill syscall.
M +83 -15 vg_syscalls.c 1.263
M +3 -3 x86-linux/syscalls.c 1.29
--- valgrind/coregrind/vg_syscalls.c #1.262:1.263
@@ -4205,15 +4205,71 @@ POST(sys_ioctl)
}
-PRE(sys_tkill, 0)
+/*
+ If we're sending a SIGKILL to one of our own threads, then simulate
+ it rather than really sending the signal, so that the target thread
+ gets a chance to clean up. Returns True if we did the killing (or
+ no killing is necessary), and False if the caller should use the
+ normal kill syscall.
+
+ "pid" is any pid argument which can be passed to kill; group kills
+ (< -1, 0), and owner kills (-1) are ignored, on the grounds that
+ they'll most likely hit all the threads and we won't need to worry
+ about cleanup. In truth, we can't fully emulate these multicast
+ kills.
+
+ "tgid" is a thread group id. If it is not -1, then the target
+ thread must be in that thread group.
+ */
+static Bool do_sigkill(Int pid, Int tgid)
+{
+ ThreadState *tst;
+ ThreadId tid;
+
+ if (pid <= 0)
+ return False;
+
+ tid = VG_(get_lwp_tid)(pid);
+ if (tid == VG_INVALID_THREADID)
+ return False; /* none of our threads */
+
+ tst = VG_(get_ThreadState)(tid);
+ if (tst == NULL || tst->status == VgTs_Empty)
+ return False; /* hm, shouldn't happen */
+
+ if (tgid != -1 && tst->os_state.threadgroup != tgid)
+ return False; /* not the right thread group */
+
+ /* Check to see that the target isn't already exiting. */
+ if (!VG_(is_exiting)(tid)) {
+ if (VG_(clo_trace_signals))
+ VG_(message)(Vg_DebugMsg, "Thread %d being killed with SIGKILL", tst->tid);
+
+ tst->exitreason = VgSrc_FatalSig;
+ tst->os_state.fatalsig = VKI_SIGKILL;
+
+ if (!VG_(is_running_thread)(tid))
+ VG_(kill_thread)(tid);
+ }
+
+ return True;
+}
+
+PRE(sys_tkill, Special)
{
/* int tkill(pid_t tid, int sig); */
PRINT("sys_tkill ( %d, %d )", arg1,arg2);
PRE_REG_READ2(long, "tkill", int, tid, int, sig);
- if (!VG_(client_signal_OK)(arg2))
+ if (!VG_(client_signal_OK)(arg2)) {
set_result( -VKI_EINVAL );
-}
+ return;
+ }
+
+ /* If we're sending SIGKILL, check to see if the target is one of
+ our threads and handle it specially. */
+ if (arg2 == VKI_SIGKILL && do_sigkill(arg1, -1))
+ set_result(0);
+ else
+ set_result(VG_(do_syscall)(SYSNO, arg1, arg2));
-POST(sys_tkill)
-{
if (VG_(clo_trace_signals))
VG_(message)(Vg_DebugMsg, "tkill: sent signal %d to pid %d",
@@ -4223,15 +4279,21 @@ POST(sys_tkill)
}
-PRE(sys_tgkill, 0)
+PRE(sys_tgkill, Special)
{
/* int tgkill(pid_t tgid, pid_t tid, int sig); */
PRINT("sys_tgkill ( %d, %d, %d )", arg1,arg2,arg3);
PRE_REG_READ3(long, "tgkill", int, tgid, int, tid, int, sig);
- if (!VG_(client_signal_OK)(arg3))
+ if (!VG_(client_signal_OK)(arg3)) {
set_result( -VKI_EINVAL );
-}
+ return;
+ }
+
+ /* If we're sending SIGKILL, check to see if the target is one of
+ our threads and handle it specially. */
+ if (arg3 == VKI_SIGKILL && do_sigkill(arg2, arg1))
+ set_result(0);
+ else
+ set_result(VG_(do_syscall)(SYSNO, arg1, arg2, arg3));
-POST(sys_tgkill)
-{
if (VG_(clo_trace_signals))
VG_(message)(Vg_DebugMsg, "tgkill: sent signal %d to pid %d/%d",
@@ -4241,15 +4303,21 @@ POST(sys_tgkill)
}
-PRE(sys_kill, 0)
+PRE(sys_kill, Special)
{
/* int kill(pid_t pid, int sig); */
PRINT("sys_kill ( %d, %d )", arg1,arg2);
PRE_REG_READ2(long, "kill", int, pid, int, sig);
- if (!VG_(client_signal_OK)(arg2))
+ if (!VG_(client_signal_OK)(arg2)) {
set_result( -VKI_EINVAL );
-}
+ return;
+ }
+
+ /* If we're sending SIGKILL, check to see if the target is one of
+ our threads and handle it specially. */
+ if (arg2 == VKI_SIGKILL && do_sigkill(arg1, -1))
+ set_result(0);
+ else
+ set_result(VG_(do_syscall)(SYSNO, arg1, arg2));
-POST(sys_kill)
-{
if (VG_(clo_trace_signals))
VG_(message)(Vg_DebugMsg, "kill: sent signal %d to pid %d",
--- valgrind/coregrind/x86-linux/syscalls.c #1.28:1.29
@@ -743,5 +743,5 @@ const struct SyscallTableEntry VGA_(sysc
GENX_(__NR_ftime, sys_ni_syscall), // 35
GENX_(__NR_sync, sys_sync), // 36
- GENXY(__NR_kill, sys_kill), // 37
+ GENX_(__NR_kill, sys_kill), // 37
GENX_(__NR_rename, sys_rename), // 38
GENX_(__NR_mkdir, sys_mkdir), // 39
@@ -987,5 +987,5 @@ const struct SyscallTableEntry VGA_(sysc
GENX_(__NR_lremovexattr, sys_lremovexattr), // 236
GENX_(__NR_fremovexattr, sys_fremovexattr), // 237
- GENXY(__NR_tkill, sys_tkill), // 238 Linux
+ GENX_(__NR_tkill, sys_tkill), // 238 Linux
LINXY(__NR_sendfile64, sys_sendfile64), // 239
@@ -1026,5 +1026,5 @@ const struct SyscallTableEntry VGA_(sysc
GENXY(__NR_fstatfs64, sys_fstatfs64), // 269
- GENXY(__NR_tgkill, sys_tgkill), // 270
+ GENX_(__NR_tgkill, sys_tgkill), // 270
GENX_(__NR_utimes, sys_utimes), // 271
// (__NR_fadvise64_64, sys_fadvise64_64), // 272 */(Linux?)
|
|
From: Jeremy F. <je...@go...> - 2005-03-23 03:29:33
|
CVS commit by fitzhardinge:
Avoid divide by 0 if there are no ccalls.
M +5 -0 vg_from_ucode.c 1.93
--- valgrind/coregrind/vg_from_ucode.c #1.92:1.93
@@ -155,4 +155,9 @@ static Histogram histogram[100];
void VG_(print_ccall_stats)(void)
{
+ if (ccalls == 0) {
+ VG_(message)(Vg_DebugMsg, " No ccalls");
+ return;
+ }
+
VG_(message)(Vg_DebugMsg,
" ccalls: %u C calls, %u%% saves+restores avoided"
|
|
From: Jeremy F. <je...@go...> - 2005-03-23 03:30:32
|
CVS commit by fitzhardinge:
Handle a couple kinds of executable mutation: a read-only bss, and a
zero-length segment.
M +9 -7 ume.c 1.42
--- valgrind/coregrind/ume.c #1.41:1.42
@@ -244,4 +244,5 @@ ESZ(Addr) mapelf(struct elfinfo *e, ESZ(
brkaddr = addr+memsz;
+ if (ROUNDUP(bss, align)-ROUNDDN(addr, align) > 0) {
res = mmap((char *)ROUNDDN(addr, align),
ROUNDUP(bss, align)-ROUNDDN(addr, align),
@@ -249,4 +250,5 @@ ESZ(Addr) mapelf(struct elfinfo *e, ESZ(
check_mmap(res, (char*)ROUNDDN(addr,align),
ROUNDUP(bss, align)-ROUNDDN(addr, align));
+ }
/* if memsz > filesz, then we need to fill the remainder with zeroed pages */
@@ -262,5 +264,5 @@ ESZ(Addr) mapelf(struct elfinfo *e, ESZ(
bytes = bss & (VKI_PAGE_SIZE - 1);
- if (bytes > 0) {
+ if ((prot & PROT_WRITE) && (bytes > 0)) {
bytes = VKI_PAGE_SIZE - bytes;
memset((char *)bss, 0, bytes);
|
|
From: Tom H. <th...@cy...> - 2005-05-11 18:44:37
|
SVN commit 412455 by thughes:
Fix stabs parsing bug introduced by fix to bug 90128 which meant
that structDef() didn't always call VG_(st_setname) as it should.
M +1 -1 trunk/valgrind/coregrind/vg_stabs.c =20
--- trunk/valgrind/coregrind/vg_stabs.c #412454:412455
@@ -185,8 +185,8 @@
isstruct ? "struct" : "union", name, ref, def);
=20
def =3D VG_(st_mktypedef)(ref, name, VG_(st_basetype)(def, False))=
;
- VG_(st_setname)(def, name);
}
+ VG_(st_setname)(def, name);
return def;
}
=20
|
|
From: Nicholas N. <nj...@cs...> - 2005-05-20 20:40:04
|
SVN commit 416181 by nethercote:
Small but critical performance fix from Pete Moceyunas: give
each small allocation size its own list. Otherwise there can
be very long searches along lists looking for a block of the
right size.
MERGED FROM 3.0 REPOSITORY
M +23 -17 trunk/valgrind/coregrind/vg_malloc2.c =20
--- trunk/valgrind/coregrind/vg_malloc2.c #416180:416181
@@ -40,7 +40,7 @@
/*--- Main types ---*/
/*------------------------------------------------------------*/
=20
-#define VG_N_MALLOC_LISTS 16 // do not change this
+#define VG_N_MALLOC_LISTS 18 // do not change this
=20
// The amount you can ask for is limited only by sizeof(SizeT)...
#define MAX_PSZB (~((SizeT)0x0))
@@ -578,22 +578,28 @@
{
vg_assert(0 =3D=3D pszB % VG_MIN_MALLOC_SZB);
pszB /=3D VG_MIN_MALLOC_SZB;
- if (pszB <=3D 2) return 0;
- if (pszB <=3D 3) return 1;
- if (pszB <=3D 4) return 2;
- if (pszB <=3D 5) return 3;
- if (pszB <=3D 6) return 4;
- if (pszB <=3D 7) return 5;
- if (pszB <=3D 8) return 6;
- if (pszB <=3D 9) return 7;
- if (pszB <=3D 10) return 8;
- if (pszB <=3D 11) return 9;
- if (pszB <=3D 12) return 10;
- if (pszB <=3D 16) return 11;
- if (pszB <=3D 32) return 12;
- if (pszB <=3D 64) return 13;
- if (pszB <=3D 128) return 14;
- return 15;
+ switch (pszB) {
+ case 0: return 0;
+ case 1: return 1;
+ case 2: return 2;
+ case 3: return 3;
+ case 4: return 4;
+ case 5: return 5;
+ case 6: return 6;
+ case 7: return 7;
+ case 8: return 8;
+ case 9: return 9;
+ case 10: return 10;
+ case 11: return 11;
+ case 12: return 12;
+ default: break;
+ }
+ if (pszB <=3D 16) return 13;
+ if (pszB <=3D 32) return 14;
+ if (pszB <=3D 64) return 15;
+ if (pszB <=3D 128) return 16;
+ return 17;
+
}
=20
// What is the minimum payload size for a given list?
|
|
From: Nicholas N. <nj...@cs...> - 2005-06-19 16:05:19
|
SVN commit 427112 by nethercote:
Fixed a bug in .valgrindrc reading I introduced recently -- freeing memor=
y
I should not have.
MERGED FROM 3.0 REPOSITORY
M +0 -4 vg_main.c =20
--- trunk/valgrind/coregrind/vg_main.c #427111:427112
@@ -578,10 +578,6 @@
to =3D copy_args(env_clo, to);
to =3D copy_args(f2_clo, to);
=20
- // Free memory
- free(f1_clo);
- free(f2_clo);
-
/* copy original arguments, stopping at command or -- */
while (*from) {
if (**from !=3D '-')
|
|
From: Dirk M. <mu...@kd...> - 2005-07-03 02:48:02
|
SVN commit 431041 by mueller:
remove nonsensical version script
M +1 -5 Makefile.am =20
D valgrind.vs =20
--- trunk/valgrind/coregrind/Makefile.am #431040:431041
@@ -28,7 +28,6 @@
vg_toolint.h
=20
EXTRA_DIST =3D \
- valgrind.vs \
gen_toolint.pl toolfuncs.def \
gen_intercepts.pl vg_replace_malloc.c.base
=20
@@ -90,18 +89,15 @@
if USE_PIE
stage2_CFLAGS =3D $(AM_CFLAGS) -fpie
stage2_DEPENDENCIES =3D \
- $(srcdir)/valgrind.vs \
$(stage2_extra)
stage2_LDFLAGS =3D -Wl,--export-dynamic -g \
- -Wl,-version-script $(srcdir)/valgrind.vs \
-pie
else
stage2_CFLAGS =3D $(AM_CFLAGS)
stage2_DEPENDENCIES =3D \
- $(srcdir)/valgrind.vs ${VG_ARCH}/stage2.lds \
+ ${VG_ARCH}/stage2.lds \
$(stage2_extra)
stage2_LDFLAGS =3D -Wl,--export-dynamic -g \
- -Wl,-version-script $(srcdir)/valgrind.vs \
-Wl,-defsym,kickstart_base=3D@KICKSTART_BASE@ -Wl,-T,${VG_ARCH}/stage2.=
lds
endif
=20
|
|
From: Dirk M. <mu...@kd...> - 2005-07-18 10:49:54
|
SVN commit 435838 by mueller:
backport 4146 from valgrind 3.0 repository:=20
Fixed bug #88678 -- debug info is now correctly gathered for files
containing spaces.
M +10 -5 vg_procselfmaps.c =20
--- trunk/valgrind/coregrind/vg_procselfmaps.c #435837:435838
@@ -231,12 +231,17 @@
read_line_ok:
=20
/* Try and find the name of the file mapped to this segment, if
- it exists. */
- while (procmap_buf[i] !=3D '\n' && i < buf_n_tot-1) i++;
+ it exists. Note that files can contains spaces. */
+
+ // Move i to the next non-space char, which should be either a '/'=
or
+ // a newline.
+ while (procmap_buf[i] =3D=3D ' ' && i < buf_n_tot-1) i++;
+ =20
+ // Move i_eol to the end of the line.
i_eol =3D i;
- i--;
- while (!VG_(isspace)(procmap_buf[i]) && i >=3D 0) i--;
- i++;
+ while (procmap_buf[i_eol] !=3D '\n' && i_eol < buf_n_tot-1) i_eol+=
+;
+
+ // If there's a filename...
if (i < i_eol-1 && procmap_buf[i] =3D=3D '/') {
/* Minor hack: put a '\0' at the filename end for the call to
`record_mapping', then restore the old char with `tmp'. */
|
|
From: Tom H. <th...@cy...> - 2005-07-18 14:15:56
|
SVN commit 435882 by thughes:
Fix typo.
M +1 -1 core.h =20
--- trunk/valgrind/coregrind/core.h #435881:435882
@@ -887,7 +887,7 @@
const Char *val );
extern void VG_(env_unsetenv) ( Char **env, const Char *varname );
extern void VG_(env_remove_valgrind_env_stuff) ( Char** env );=20
-extern Char **VG_(env_clone) ( Vhar **envp );
+extern Char **VG_(env_clone) ( Char **envp );
=20
extern void VG_(nanosleep)(struct vki_timespec *);
/* ---------------------------------------------------------------------
|
|
From: Tom H. <th...@cy...> - 2005-07-18 23:24:09
|
SVN commit 436074 by thughes:
Fix crash when no environment is given to execve.
M +3 -4 vg_syscalls.c =20
--- trunk/valgrind/coregrind/vg_syscalls.c #436073:436074
@@ -1697,7 +1697,7 @@
PRE(sys_execve, Special)
{
Char *path; /* path to executable */
- Char **envp; /* environment */
+ Char **envp =3D NULL; /* environment */
=20
PRINT("sys_execve ( %p(%s), %p, %p )", arg1, arg1, arg2, arg3);
PRE_REG_READ3(vki_off_t, "execve",
@@ -1751,9 +1751,8 @@
// child doesn't get vg_inject.so, vgpreload.so, etc. This is
// done unconditionally, since if we are tracing the child,
// stage1/2 will set up the appropriate client environment.
- envp =3D VG_(env_clone)( (Char**)arg3 );
-
- if (envp !=3D NULL) {
+ if (arg3 !=3D NULL) {
+ envp =3D VG_(env_clone)( (Char**)arg3 );
VG_(env_remove_valgrind_env_stuff)( envp );=20
}
=20
|
|
From: Dirk M. <mu...@kd...> - 2005-07-20 21:45:30
|
SVN commit 437076 by mueller:
fix stabs reading for freepascal, backport of SVN-3.0 -r4218
M +1 -0 vg_stabs.c =20
--- trunk/valgrind/coregrind/vg_stabs.c #437075:437076
@@ -646,6 +646,7 @@
case -27: type =3D VG_(st_mkint)(def, 1, True); break;
case -28: type =3D VG_(st_mkint)(def, 2, True); break;
case -29: type =3D VG_(st_mkint)(def, 4, True); break;
+ case -30: type =3D ML_(st_mkint)(def, 2, False); break;
case -31: type =3D VG_(st_mkint)(def, 8, True); break;
case -32: type =3D VG_(st_mkint)(def, 8, False); break;
case -33: type =3D VG_(st_mkint)(def, 8, False); break;
|