|
From: Nicholas N. <nj...@ca...> - 2004-09-10 13:59:40
|
CVS commit by nethercote:
To get 32-bit programs working on Opteron, VG_(valgrind_end) was recently
changed to name the last byte in Valgrind's section, rather than one past the
last byte. This was because the last byte is 0xffffffff, and so one past gave
0x0, which screwed things up.
However, when this change was made, all the places where VG_(valgrind_end) is
used weren't adjusted appropriately. So this commit makes those adjustments.
It also renames the variable as VG_(valgrind_last), which makes the difference
between it and the other VG_(*_end) variables much clearer.
MERGED FROM HEAD
M +1 -1 vg_include.h 1.235.2.1
M +10 -17 vg_main.c 1.198.2.1
M +10 -10 vg_memory.c 1.66.2.1
M +3 -3 vg_mylibc.c 1.85.2.1
--- valgrind/coregrind/vg_include.h #1.235:1.235.2.1
@@ -1275,5 +1275,5 @@ extern Addr VG_(shadow_base); /* tool's
extern Addr VG_(shadow_end);
extern Addr VG_(valgrind_base); /* valgrind's address range */
-extern Addr VG_(valgrind_end);
+extern Addr VG_(valgrind_last); // Nb: last byte, rather than one past the end
extern vki_rlimit VG_(client_rlimit_data); /* client's original rlimit data */
--- valgrind/coregrind/vg_main.c #1.198:1.198.2.1
@@ -110,9 +110,7 @@ Addr VG_(shadow_end);
Addr VG_(valgrind_base); /* valgrind's address range */
-// VG_(valgrind_end) has a slightly different meaning to all the other
-// VG_(*_end) vars -- ie. it names the last byte, whereas the others
-// go one byte past the end.
-
-Addr VG_(valgrind_end);
+// Note that VG_(valgrind_last) names the last byte of the section, whereas
+// the VG_(*_end) vars name the byte one past the end of the section.
+Addr VG_(valgrind_last);
vki_rlimit VG_(client_rlimit_data);
@@ -438,10 +436,5 @@ static void layout_remaining_space(Addr
VG_(valgrind_base) = (addr_t)&kickstart_base;
-
- // VG_(valgrind_end) has a slightly different meaning to all the other
- // VG_(*_end) vars -- ie. it names the last byte, whereas the others
- // go one byte past the end.
-
- VG_(valgrind_end) = ROUNDUP(argc_addr, 0x10000) - 1; // stack
+ VG_(valgrind_last) = ROUNDUP(argc_addr, 0x10000) - 1; // stack
// This gives the client the largest possible address space while
@@ -469,5 +462,5 @@ static void layout_remaining_space(Addr
"shadow_end %8x (%dMB)\n"
"valgrind_base %8x (%dMB)\n"
- "valgrind_end %8x\n",
+ "valgrind_last %8x\n",
VG_(client_base), SEGSIZE(client_base, client_mapbase),
VG_(client_mapbase), SEGSIZE(client_mapbase, client_end),
@@ -475,6 +468,6 @@ static void layout_remaining_space(Addr
VG_(shadow_base), SEGSIZE(shadow_base, shadow_end),
VG_(shadow_end), SEGSIZE(shadow_end, valgrind_base),
- VG_(valgrind_base), SEGSIZE(valgrind_base, valgrind_end),
- VG_(valgrind_end)
+ VG_(valgrind_base), SEGSIZE(valgrind_base, valgrind_last),
+ VG_(valgrind_last)
);
@@ -2565,5 +2558,5 @@ static void build_valgrind_map_callback
start allocating more memory (note: heap is OK, it's just mmap
which is the problem here). */
- if (start >= VG_(valgrind_base) && (start+size) <= VG_(valgrind_end)) {
+ if (start >= VG_(valgrind_base) && (start+size-1) <= VG_(valgrind_last)) {
flags |= SF_VALGRIND;
VG_(map_file_segment)(start, size, prot, flags, dev, ino, foffset, filename);
@@ -2598,5 +2591,5 @@ static void build_segment_map_callback
flags |= SF_FILE;
- if (start >= VG_(valgrind_base) && (start+size) <= VG_(valgrind_end))
+ if (start >= VG_(valgrind_base) && (start+size-1) <= VG_(valgrind_last))
flags |= SF_VALGRIND;
@@ -2727,5 +2720,5 @@ void VG_(sanity_check_general) ( Bool fo
- -
| valgrind stack ^^^^^^^^^|
- valgrind_end +-------------------------+
+ valgrind_last +-------------------------+
: kernel :
--- valgrind/coregrind/vg_memory.c #1.66:1.66.2.1
@@ -494,5 +494,5 @@ Addr VG_(find_map_space)(Addr addr, UInt
Segment *s;
Addr ret;
- Addr limit = (for_client ? VG_(client_end) : VG_(valgrind_end));
+ Addr limit = (for_client ? VG_(client_end)-1 : VG_(valgrind_last));
if (addr == 0)
@@ -538,5 +538,5 @@ Addr VG_(find_map_space)(Addr addr, UInt
}
- if ((limit - len) < ret)
+ if (((limit - len)+1) < ret)
ret = 0; /* no space */
else
@@ -551,5 +551,5 @@ Addr VG_(find_map_space)(Addr addr, UInt
/* Pad the entire process address space, from VG_(client_base)
- to VG_(valgrind_end) by creating an anonymous and inaccessible
+ to VG_(valgrind_last) by creating an anonymous and inaccessible
mapping over any part of the address space which is not covered
by an entry in the segment list.
@@ -573,5 +573,5 @@ void VG_(pad_address_space)(void)
args[5] = 0;
- while (s && addr < VG_(valgrind_end)) {
+ while (s && addr <= VG_(valgrind_last)) {
if (addr < s->addr) {
args[0] = (UInt)addr;
@@ -585,7 +585,7 @@ void VG_(pad_address_space)(void)
}
- if (addr < VG_(valgrind_end)) {
+ if (addr <= VG_(valgrind_last)) {
args[0] = (UInt)addr;
- args[1] = VG_(valgrind_end) - addr;
+ args[1] = VG_(valgrind_last) - addr + 1;
ret = VG_(do_syscall)(__NR_mmap, (UInt)args);
@@ -603,5 +603,5 @@ void VG_(unpad_address_space)(void)
Int ret;
- while (s && addr < VG_(valgrind_end)) {
+ while (s && addr <= VG_(valgrind_last)) {
if (addr < s->addr) {
ret = VG_(do_syscall)(__NR_munmap, (UInt)addr, s->addr - addr);
@@ -612,6 +612,6 @@ void VG_(unpad_address_space)(void)
}
- if (addr < VG_(valgrind_end)) {
- ret = VG_(do_syscall)(__NR_munmap, (UInt)addr, VG_(valgrind_end) - addr);
+ if (addr <= VG_(valgrind_last)) {
+ ret = VG_(do_syscall)(__NR_munmap, addr, (VG_(valgrind_last) - addr) + 1);
}
@@ -794,5 +794,5 @@ Bool VG_(is_shadow_addr)(Addr a)
Bool VG_(is_valgrind_addr)(Addr a)
{
- return a >= VG_(valgrind_base) && a < VG_(valgrind_end);
+ return a >= VG_(valgrind_base) && a <= VG_(valgrind_last);
}
--- valgrind/coregrind/vg_mylibc.c #1.85:1.85.2.1
@@ -285,5 +285,5 @@ void* VG_(mmap)( void* start, UInt lengt
vg_assert(VG_(client_base) <= res && res+length < VG_(client_end));
} else {
- vg_assert(VG_(valgrind_base) <= res && res+length < VG_(valgrind_end));
+ vg_assert(VG_(valgrind_base) <= res && res+length-1 <= VG_(valgrind_last));
}
@@ -1093,5 +1093,5 @@ static inline ExeContext *get_real_execo
asm("movl %%ebp, %0; movl %%esp, %1" : "=r" (ebp), "=r" (esp));
- stacktop = VG_(valgrind_end);
+ stacktop = VG_(valgrind_last);
VG_(get_sigstack_bounds)( &sigstack_low, &sigstack_high );
if (esp >= sigstack_low && esp < sigstack_high)
@@ -1664,5 +1664,5 @@ void* VG_(get_memory_from_mmap) ( Int nB
if (p != ((void*)(-1))) {
- vg_assert(p >= (void*)VG_(valgrind_base) && p < (void*)VG_(valgrind_end));
+ vg_assert((void*)VG_(valgrind_base) <= p && p <= (void*)VG_(valgrind_last));
tot_alloc += (UInt)nBytes;
if (0)
|
|
From: Nicholas N. <nj...@ca...> - 2004-09-11 23:28:06
|
CVS commit by nethercote:
Fix minor off-by-one error.
MERGED FROM HEAD
M +1 -1 vg_mylibc.c 1.85.2.2
--- valgrind/coregrind/vg_mylibc.c #1.85.2.1:1.85.2.2
@@ -283,5 +283,5 @@ void* VG_(mmap)( void* start, UInt lengt
if (!VG_(is_kerror)(res)) {
if (flags & VKI_MAP_CLIENT) {
- vg_assert(VG_(client_base) <= res && res+length < VG_(client_end));
+ vg_assert(VG_(client_base) <= res && res+length <= VG_(client_end));
} else {
vg_assert(VG_(valgrind_base) <= res && res+length-1 <= VG_(valgrind_last));
|
|
From: Nicholas N. <nj...@ca...> - 2004-10-08 14:03:19
|
CVS commit by nethercote:
Improve error message.
MERGED FROM HEAD
M +11 -3 vg_main.c 1.198.2.2
--- valgrind/coregrind/vg_main.c #1.198.2.1:1.198.2.2
@@ -490,7 +490,15 @@ static void layout_remaining_space(Addr
if ((void*)-1 == vres) {
fprintf(stderr,
- "valgrind: Couldn't allocate address space for shadow memory\n"
- "valgrind: Are you using a kernel with a small user address space,\n"
- "valgrind: or do you have your virtual memory size limited?\n");
+ "valgrind: Could not allocate address space (%p bytes)\n"
+ "valgrind: for shadow memory\n"
+ "valgrind: Possible causes:\n"
+ "valgrind: - For some systems (especially under RedHat 8), Valgrind\n"
+ "valgrind: needs at least 1.5GB swap space.\n"
+ "valgrind: - Or, your virtual memory size may be limited (check\n"
+ "valgrind: with 'ulimit -v').\n"
+ "valgrind: - Or, your system may use a kernel that provides only a\n"
+ "valgrind: too-small (eg. 2GB) user address space.\n"
+ , (void*)shadow_size
+ );
exit(1);
}
|
|
From: Nicholas N. <nj...@ca...> - 2004-10-14 11:20:22
|
CVS commit by nethercote: Replace glibc header with equivalent kernel header, which fixes a compile problem seen by Sefer Tov. MERGED FROM HEAD M +1 -1 vg_unsafe.h 1.33.2.1 --- valgrind/coregrind/vg_unsafe.h #1.33:1.33.2.1 @@ -48,5 +48,5 @@ #include <linux/sockios.h>/* for SIOCOUTQ */ #include <sys/un.h> /* for sockaddr_un */ -#include <net/if.h> /* for struct ifreq et al */ +#include <linux/if.h> /* for struct ifreq et al */ #include <net/if_arp.h> /* for struct arpreq */ #include <net/route.h> /* for struct rtentry */ |
|
From: Nicholas N. <nj...@ca...> - 2004-10-18 15:56:21
|
CVS commit by nethercote:
Increase the size of M_VG_ERRTXT from 512B to 4KB, increasing the size of C++
names that can be demangled.
MERGED FROM HEAD
M +3 -3 vg_errcontext.c 1.58.2.1
M +1 -1 vg_include.h 1.235.2.3
M +4 -4 vg_symtab2.c 1.85.2.1
M +1 -1 vg_to_ucode.c 1.146.2.1
--- valgrind/coregrind/vg_errcontext.c #1.58:1.58.2.1
@@ -333,5 +333,5 @@ static void gen_suppression(Error* err)
{
Int i;
- UChar buf[M_VG_ERRTXT];
+ static UChar buf[M_VG_ERRTXT];
Bool main_done = False;
ExeContext* ec = VG_(get_error_where)(err);
@@ -986,6 +986,6 @@ static Supp* is_suppressible_error ( Err
Int i;
- Char caller_obj[VG_N_SUPP_CALLERS][M_VG_ERRTXT];
- Char caller_fun[VG_N_SUPP_CALLERS][M_VG_ERRTXT];
+ static Char caller_obj[VG_N_SUPP_CALLERS][M_VG_ERRTXT];
+ static Char caller_fun[VG_N_SUPP_CALLERS][M_VG_ERRTXT];
Supp* su;
--- valgrind/coregrind/vg_include.h #1.235.2.2:1.235.2.3
@@ -75,5 +75,5 @@
/* Max length of a text fragment used to construct error messages. */
-#define M_VG_ERRTXT 512
+#define M_VG_ERRTXT 4096
/* Max length of the string copied from env var VG_ARGS at startup. */
--- valgrind/coregrind/vg_symtab2.c #1.85:1.85.2.1
@@ -2175,7 +2175,7 @@ Char* VG_(describe_eip)(Addr eip, Char*
UChar ibuf[20];
UInt n = 0;
- UChar buf_fn[M_VG_ERRTXT];
- UChar buf_obj[M_VG_ERRTXT];
- UChar buf_srcloc[M_VG_ERRTXT];
+ static UChar buf_fn[M_VG_ERRTXT];
+ static UChar buf_obj[M_VG_ERRTXT];
+ static UChar buf_srcloc[M_VG_ERRTXT];
Bool know_fnname = VG_(get_fnname) (eip, buf_fn, M_VG_ERRTXT);
Bool know_objname = VG_(get_objname)(eip, buf_obj, M_VG_ERRTXT);
@@ -2215,5 +2215,5 @@ void VG_(mini_stack_dump) ( Addr eips[],
{
UInt i;
- UChar buf[M_VG_ERRTXT];
+ static UChar buf[M_VG_ERRTXT];
Bool main_done = False;
--- valgrind/coregrind/vg_to_ucode.c #1.146:1.146.2.1
@@ -3858,5 +3858,5 @@ static Addr disInstr ( UCodeBlock* cb, A
UChar dis_buf[50];
Int am_sz, d_sz;
- Char loc_buf[M_VG_ERRTXT];
+ static Char loc_buf[M_VG_ERRTXT];
/* Holds eip at the start of the insn, so that we can print
|
|
From: Nicholas N. <nj...@ca...> - 2004-10-20 14:24:52
|
CVS commit by nethercote:
Fix typo, courtesy of Aleksander Salwa.
MERGED FROM HEAD
M +1 -1 vg_libpthread.c 1.161.2.1
--- valgrind/coregrind/vg_libpthread.c #1.161:1.161.2.1
@@ -1168,5 +1168,5 @@ pthread_create (pthread_t *__restrict __
sigprocmask(SIG_SETMASK, NULL, &info->sigmask);
- if (__attr) {
+ if (__vg_attr) {
si.base = (Addr)__vg_attr->__vg_stackaddr;
si.size = __vg_attr->__vg_stacksize;
|
|
From: Tom H. <th...@cy...> - 2004-10-28 07:56:55
|
CVS commit by thughes:
When augmenting the argument vector from the VALGRIND_OPTS environment
variable and/or the .valgrindrc files, make sure that enough space is
allocated for all the old arguments, not just those that are arguments
to valgrind itself.
MERGED FROM HEAD
M +4 -2 vg_main.c 1.198.2.3
--- valgrind/coregrind/vg_main.c #1.198.2.2:1.198.2.3
@@ -591,5 +591,7 @@ static void augment_command_line(Int* vg
char **from;
char **to;
- int env_arg_count, f1_arg_count, f2_arg_count;
+ int orig_arg_count, env_arg_count, f1_arg_count, f2_arg_count;
+
+ for ( orig_arg_count = 0; vg_argv0[orig_arg_count]; orig_arg_count++ );
env_arg_count = count_args(env_clo);
@@ -603,5 +605,5 @@ static void augment_command_line(Int* vg
/* +2: +1 for null-termination, +1 for added '--' */
from = vg_argv0;
- vg_argv0 = malloc( (vg_argc0 + env_arg_count + f1_arg_count
+ vg_argv0 = malloc( (orig_arg_count + env_arg_count + f1_arg_count
+ f2_arg_count + 2) * sizeof(char **));
vg_assert(vg_argv0);
|
|
From: Tom H. <th...@cy...> - 2004-10-28 08:09:56
|
CVS commit by thughes:
Fixed get_height to ensure that SK_MAXHEIGHT-1 is the maximum level we
will allocate for a skip list entry as many routines use arrays of
size SK_MAXHEIGHT to hold a set of level pointers which means that a
level of SK_MAXHEIGHT is not valid due to C arrays being zero based.
This led to a number of subtle and hard to locate problems caused by
stack based arrays being overflowed by one entry when a node was
allocated with the maximum level. As each node only has a one in two
million or so chance of getting a level of SK_MAXHEIGHT this didn't
actually happen all that often.
MERGED FROM HEAD
M +1 -1 vg_skiplist.c 1.5.2.1
--- valgrind/coregrind/vg_skiplist.c #1.5:1.5.2.1
@@ -113,5 +113,5 @@ static inline Int get_height(void)
UInt ret = 0;
- while((ret < SK_MAXHEIGHT) && (random() & 1))
+ while((ret < SK_MAXHEIGHT - 1) && (random() & 1))
ret++;
|
|
From: Tom H. <th...@cy...> - 2004-10-28 08:15:44
|
CVS commit by thughes:
The fix for bug 85811 added decoding of many extra negative type
numbers in stabs and also removed the expectation of a trailing
semicolon after the type number as gcc didn't seem to be putting
one in. It seems that older gcc's do add one however, so we now
skip one if it is there.
MERGED FROM HEAD
M +6 -0 vg_stabs.c 1.14.2.1
--- valgrind/coregrind/vg_stabs.c #1.14:1.14.2.1
@@ -676,4 +676,10 @@ static SymType *stabtype_parser(SegInfo
break;
}
+ /* Different versions of gcc seem to disagree about whether a
+ negative type is followed by a semicolon or not, and the stabs
+ spec (susch as it is) is not clear either so we will skip a
+ semicolon if there is one. */
+ if (*p == ';')
+ p++;
break;
}
|
|
From: Tom H. <th...@cy...> - 2004-10-28 08:16:42
|
CVS commit by thughes:
Yet another attempt to quash the assertions in the pthread forwarding code.
It appears that the resolution of the address is to forward to is now
working properly but that on some systems the second part of the assertion
fails because the dynamic linker resolves the name of the function being
forwarded to the glibc version rather than the version in valgrind's pthread
library.
The solution is to use dlopen to explicitly obtain a handle to valgrind's
pthread library and then lookup the symbol with dlsym when doing the
comparison in the assertion.
MERGED FROM HEAD
M +7 -1 vg_libpthread.c 1.161.2.2
--- valgrind/coregrind/vg_libpthread.c #1.161.2.1:1.161.2.2
@@ -2243,11 +2243,17 @@ void ** (*__libc_internal_tsd_address)
------------------------------------------------------------------ */
+static void *libpthread_handle;
+
#define FORWARD(name, altname, args...) \
({ \
static name##_t name##_ptr = NULL; \
+ if (libpthread_handle == NULL) { \
+ libpthread_handle = dlopen("libpthread.so.0", RTLD_LAZY); \
+ my_assert(libpthread_handle != NULL); \
+ } \
if (name##_ptr == NULL) { \
if ((name##_ptr = (name##_t)dlsym(RTLD_NEXT, #name)) == NULL) \
name##_ptr = (name##_t)dlsym(RTLD_DEFAULT, #altname); \
- my_assert(name##_ptr != NULL && name##_ptr != name); \
+ my_assert(name##_ptr != NULL && name##_ptr != dlsym(libpthread_handle, #name)); \
} \
name##_ptr(args); \
|
|
From: Tom H. <th...@cy...> - 2004-10-28 08:18:02
|
CVS commit by thughes:
Don't free the interpreter structure until we've actually finished
using it... Possible fix for bug 89663 spotted by Mike Cavins.
MERGED FROM HEAD
M +1 -1 ume.c 1.20.2.1
--- valgrind/coregrind/ume.c #1.20:1.20.2.1
@@ -526,8 +526,8 @@ static int load_ELF(char *hdr, int len,
close(interp->fd);
- free(interp);
entry = baseoff + interp->e.e_entry;
info->interp_base = (ESZ(Addr))base;
+ free(interp);
} else
entry = (void *)e->e.e_entry;
|
|
From: Nicholas N. <nj...@ca...> - 2004-10-29 11:21:29
|
CVS commit by nethercote:
Fix typo that meant --signal-polltime was not being accepted.
MERGED FROM HEAD
M +1 -1 vg_main.c 1.198.2.4
--- valgrind/coregrind/vg_main.c #1.198.2.3:1.198.2.4
@@ -1723,5 +1723,5 @@ static void process_cmd_line_options( UI
else VG_NUM_CLO ("--input-fd", VG_(clo_input_fd))
else VG_NUM_CLO ("--sanity-level", VG_(clo_sanity_level))
- else VG_NUM_CLO ("--signalpolltime", VG_(clo_signal_polltime))
+ else VG_NUM_CLO ("--signal-polltime", VG_(clo_signal_polltime))
else VG_BNUM_CLO("--num-callers", VG_(clo_backtrace_size), 1,
VG_DEEPEST_BACKTRACE)
|
|
From: Tom H. <th...@cy...> - 2004-10-29 18:36:21
|
CVS commit by thughes:
When a thread is cancelled only abort pending system calls if
the thread is set for asynchronous cancellation and cancellation
is enabled. This fixes a long standing occasional failure in
the pth_cancel2 test.
MERGE TO STABLE
M +5 -2 vg_scheduler.c 1.171.2.2
--- valgrind/coregrind/vg_scheduler.c #1.171.2.1:1.171.2.2
@@ -1750,6 +1750,9 @@ void do__set_cancelpend ( ThreadId tid,
VG_(threads)[cee].cancel_pend = cancelpend_hdlr;
- /* interrupt a pending syscall */
+ /* interrupt a pending syscall if asynchronous cancellation
+ is enabled for the target thread */
+ if (VG_(threads)[cee].cancel_st && !VG_(threads)[cee].cancel_ty) {
VG_(proxy_abort_syscall)(cee);
+ }
if (VG_(clo_trace_sched)) {
|
|
From: Tom H. <th...@cy...> - 2004-11-01 17:37:11
|
CVS commit by thughes:
Make sure source-location mapping entries of size zero are converted
to size one even if verbose more is off.
MERGE TO STABLE
M +6 -4 vg_symtab2.c 1.85.2.2
--- valgrind/coregrind/vg_symtab2.c #1.85.2.1:1.85.2.2
@@ -216,8 +216,10 @@ void VG_(addLineInfo) ( SegInfo* si,
* multiple instructions can map to the one line), but avoid
* catching any other instructions bogusly. */
- if (this > next && VG_(clo_verbosity) > 2) {
+ if (this > next) {
+ if (VG_(clo_verbosity) > 2) {
VG_(message)(Vg_DebugMsg,
"warning: line info addresses out of order "
"at entry %d: 0x%x 0x%x", entry, this, next);
+ }
size = 1;
}
|
|
From: Tom H. <th...@cy...> - 2004-11-02 09:45:22
|
CVS commit by thughes:
Use -w instead of "use warnings" to enable warnings so that older
versions of perl can handle the script.
MERGE TO STABLE
M +1 -2 gen_intercepts.pl 1.1.2.1
M +1 -2 gen_toolint.pl 1.3.2.1
--- valgrind/coregrind/gen_intercepts.pl #1.1:1.1.2.1
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
# This file is part of Valgrind, an extensible x86 protected-mode
@@ -25,5 +25,4 @@
use strict;
-use warnings;
while(<>) {
--- valgrind/coregrind/gen_toolint.pl #1.3:1.3.2.1
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
# This file is part of Valgrind, an extensible x86 protected-mode
@@ -25,5 +25,4 @@
use strict;
-use warnings;
my $output = shift @ARGV;
|
|
From: Tom H. <th...@cy...> - 2004-11-04 13:20:23
|
CVS commit by thughes:
Add support for the settimeofday system call.
MERGE TO STABLE
M +14 -0 vg_syscalls.c 1.131.2.1
--- valgrind/coregrind/vg_syscalls.c #1.131:1.131.2.1
@@ -4675,4 +4675,17 @@ PRE(setrlimit)
}
+PRE(settimeofday)
+{
+ /* int settimeofday(const struct timeval *tv, const struct timezone *tz); */
+ MAYBE_PRINTF("settimeofday ( %p, %p )\n",arg1,arg2);
+ SYSCALL_TRACK( pre_mem_read, tid, "settimeofday(tv)", arg1,
+ sizeof(struct timeval) );
+ if (arg2 != 0) {
+ SYSCALL_TRACK( pre_mem_read, tid, "settimeofday(tz)", arg2,
+ sizeof(struct timezone) );
+ /* maybe should warn if tz->tz_dsttime is non-zero? */
+ }
+}
+
PRE(setuid)
{
@@ -6072,4 +6085,5 @@ static const struct sys_info sys_info[]
SYSB_(setreuid, 0),
SYSB_(setrlimit, 0),
+ SYSB_(settimeofday, 0),
SYSB_(setuid32, 0),
SYSB_(setuid, 0),
|
|
From: Tom H. <th...@cy...> - 2004-11-04 13:24:38
|
CVS commit by thughes:
Fix some GNAT related stabs parsing problems.
MERGE TO STABLE
M +20 -7 vg_stabs.c 1.14.2.2
--- valgrind/coregrind/vg_stabs.c #1.14.2.1:1.14.2.2
@@ -171,4 +171,13 @@ static SymType *structDef(StabTypeTab *t
SymType *ref = structRef(tab, NULL, isstruct, name);
+ /* it seems that GNAT likes to declare names as both struct tags
+ and typedefs so check we aren't about to make a structure a
+ reference to itself as that will create a loop */
+ if (ref == def) {
+ if (debug)
+ VG_(printf)("ignoring %s self ref for %s %p -> %p\n",
+ isstruct ? "struct" : "union", name, ref, def);
+ }
+ else {
if (debug)
VG_(printf)("defining %s ref for %s %p -> %p\n",
@@ -177,4 +186,5 @@ static SymType *structDef(StabTypeTab *t
def = VG_(st_mktypedef)(ref, name, VG_(st_basetype)(def, False));
VG_(st_setname)(def, name);
+ }
return def;
}
@@ -940,5 +950,8 @@ static SymType *stabtype_parser(SegInfo
EXPECT(',', "struct TYPE");
- off = atou(&p, 0);
+ /* logic dictates that the offset would always be
+ positive and that atou would work here but GNAT has
+ has other ideas - see bug 90128 for more details */
+ off = atoi(&p, 0);
if (*p == ',') {
|
|
From: Nicholas N. <nj...@ca...> - 2004-11-08 13:31:43
|
CVS commit by nethercote:
Don't silently ignore any suppression contexts beyond the 4th -- instead abort
with a warning. Addresses part of bug #77922.
MERGED FROM HEAD
M +16 -5 vg_errcontext.c 1.58.2.2
--- valgrind/coregrind/vg_errcontext.c #1.58.2.1:1.58.2.2
@@ -787,5 +787,5 @@ static void load_one_suppressions_file (
# define N_BUF 200
Int fd, i;
- Bool eof;
+ Bool eof, too_many_contexts = False;
Char buf[N_BUF+1];
Char* tool_names;
@@ -883,7 +883,11 @@ static void load_one_suppressions_file (
VG_N_SUPP_CALLERS */
if (!VG_STREQ(buf, "}")) {
- do {
- eof = VG_(get_line) ( fd, buf, N_BUF );
- } while (!eof && !VG_STREQ(buf, "}"));
+ // Don't just ignore extra lines -- abort. (Someone complained
+ // about silent ignoring of lines in bug #77922.)
+ //do {
+ // eof = VG_(get_line) ( fd, buf, N_BUF );
+ //} while (!eof && !VG_STREQ(buf, "}"));
+ too_many_contexts = True;
+ goto syntax_error;
}
@@ -899,4 +903,11 @@ static void load_one_suppressions_file (
"FATAL: in suppressions file `%s': unexpected EOF",
filename );
+ } else if (too_many_contexts) {
+ VG_(message)(Vg_UserMsg,
+ "FATAL: in suppressions file: `%s': at %s:",
+ filename, buf );
+ VG_(message)(Vg_UserMsg,
+ "too many lines (limit of %d contexts in suppressions)",
+ VG_N_SUPP_CALLERS);
} else {
VG_(message)(Vg_UserMsg,
|
|
From: Tom H. <th...@cy...> - 2004-11-17 00:02:09
|
CVS commit by thughes:
Change VG_(nuke_all_threads) to disassociate the the stacks of the threads
being killed from the threads rather than marking them as inaccessible.
This should fix the problem with the environment (and other data from the
stacks of other threads) causing warnings after a fork. I believe that
VG_(nuke_all_threads) is only called in places where this is the behaviour
that we want or where it doesn't matter because we're about to exit anyway.
MERGE TO STABLE
M +7 -2 vg_scheduler.c 1.171.2.4
--- valgrind/coregrind/vg_scheduler.c #1.171.2.3:1.171.2.4
@@ -1421,7 +1421,10 @@ void cleanup_after_thread_exited ( Threa
vg_assert(is_valid_or_empty_tid(tid));
vg_assert(VG_(threads)[tid].status == VgTs_Empty);
+
/* Its stack is now off-limits */
+ if (VG_(threads)[tid].stack_base) {
VG_TRACK( die_mem_stack, VG_(threads)[tid].stack_base,
VG_(threads)[tid].stack_size );
+ }
/* Deallocate its LDT, if it ever had one. */
@@ -1520,4 +1523,6 @@ void VG_(nuke_all_threads_except) ( Thre
VG_(proxy_delete)(tid, True);
VG_(threads)[tid].status = VgTs_Empty;
+ VG_(threads)[tid].stack_base = (Addr)NULL;
+ VG_(threads)[tid].stack_size = 0;
cleanup_after_thread_exited( tid, True );
}
|
|
From: Nicholas N. <nj...@ca...> - 2004-11-18 12:49:07
|
CVS commit by nethercote:
Replace magic number with proper constant.
MERGED FROM HEAD
M +2 -1 vg_errcontext.c 1.58.2.3
--- valgrind/coregrind/vg_errcontext.c #1.58.2.2:1.58.2.3
@@ -338,5 +338,6 @@ static void gen_suppression(Error* err)
Int stop_at = VG_(clo_backtrace_size);
- if (stop_at > 4) stop_at = 4; /* At most four names */
+ /* At most VG_N_SUPP_CALLERS names */
+ if (stop_at > VG_N_SUPP_CALLERS) stop_at = VG_N_SUPP_CALLERS;
vg_assert(stop_at > 0);
|
|
From: Tom H. <th...@cy...> - 2004-11-24 23:53:04
|
CVS commit by thughes:
Yet another attempt to make the pthre cancellation wrappers work.
The exact search order followed by RTLD_NEXT and RTLD_DEFAULT seems to be
very variable across different glibc releases, especially when the pthread
library is pulled in implicitly by a dependency in another library.
As a result I have now given up on that scheme and have resorted to the
simple tactic of explicitly opening libc.so and then looking for the
function to forward to through that handle.
MERGE TO STABLE
M +58 -45 vg_libpthread.c 1.161.2.3
--- valgrind/coregrind/vg_libpthread.c #1.161.2.2:1.161.2.3
@@ -2243,17 +2243,34 @@ void ** (*__libc_internal_tsd_address)
------------------------------------------------------------------ */
-static void *libpthread_handle;
+static void *get_libc_handle(void)
+{
+ static void *libc_handle = NULL;
-#define FORWARD(name, altname, args...) \
+ if (libc_handle == NULL) {
+ libc_handle = dlopen("libc.so.6", RTLD_LAZY);
+ my_assert(libc_handle != NULL);
+ }
+
+ return libc_handle;
+}
+
+static void *get_libpthread_handle(void)
+{
+ static void *libpthread_handle = NULL;
+
+ if (libpthread_handle == NULL) {
+ libpthread_handle = dlopen("libpthread.so.0", RTLD_LAZY);
+ my_assert(libpthread_handle != NULL);
+ }
+
+ return libpthread_handle;
+}
+
+#define FORWARD(name, args...) \
({ \
static name##_t name##_ptr = NULL; \
- if (libpthread_handle == NULL) { \
- libpthread_handle = dlopen("libpthread.so.0", RTLD_LAZY); \
- my_assert(libpthread_handle != NULL); \
- } \
if (name##_ptr == NULL) { \
- if ((name##_ptr = (name##_t)dlsym(RTLD_NEXT, #name)) == NULL) \
- name##_ptr = (name##_t)dlsym(RTLD_DEFAULT, #altname); \
- my_assert(name##_ptr != NULL && name##_ptr != dlsym(libpthread_handle, #name)); \
+ name##_ptr = (name##_t)dlsym(get_libc_handle(), #name); \
+ my_assert(name##_ptr != NULL && name##_ptr != dlsym(get_libpthread_handle(), #name)); \
} \
name##_ptr(args); \
@@ -2270,9 +2287,5 @@ int sigaction(int signum,
{
__my_pthread_testcancel();
-#ifdef GLIBC_2_1
- return FORWARD(sigaction, __sigaction, signum, act, oldact);
-#else
- return FORWARD(sigaction, __libc_sigaction, signum, act, oldact);
-#endif
+ return FORWARD(sigaction, signum, act, oldact);
}
@@ -2284,5 +2297,5 @@ int accept(int fd, struct sockaddr *addr
{
__my_pthread_testcancel();
- return FORWARD(accept, __libc_accept, fd, addr, len);
+ return FORWARD(accept, fd, addr, len);
}
@@ -2297,5 +2310,5 @@ int connect(int sockfd,
{
__my_pthread_testcancel();
- return FORWARD(connect, __libc_connect, sockfd, serv_addr, addrlen);
+ return FORWARD(connect, sockfd, serv_addr, addrlen);
}
@@ -2307,5 +2320,5 @@ int fcntl(int fd, int cmd, long arg)
{
__my_pthread_testcancel();
- return FORWARD(fcntl, __libc_fcntl, fd, cmd, arg);
+ return FORWARD(fcntl, fd, cmd, arg);
}
@@ -2317,5 +2330,5 @@ ssize_t write(int fd, const void *buf, s
{
__my_pthread_testcancel();
- return FORWARD(write, __libc_write, fd, buf, count);
+ return FORWARD(write, fd, buf, count);
}
@@ -2327,5 +2340,5 @@ ssize_t read(int fd, void *buf, size_t c
{
__my_pthread_testcancel();
- return FORWARD(read, __libc_read, fd, buf, count);
+ return FORWARD(read, fd, buf, count);
}
@@ -2335,5 +2348,5 @@ int (*open64_t)(const char *pathname, in
int open64(const char *pathname, int flags, mode_t mode)
{
- return FORWARD(open64, __libc_open64, pathname, flags, mode);
+ return FORWARD(open64, pathname, flags, mode);
}
@@ -2343,5 +2356,5 @@ int (*open_t)(const char *pathname, int
int open(const char *pathname, int flags, mode_t mode)
{
- return FORWARD(open, __libc_open, pathname, flags, mode);
+ return FORWARD(open, pathname, flags, mode);
}
@@ -2352,5 +2365,5 @@ int close(int fd)
{
__my_pthread_testcancel();
- return FORWARD(close, __libc_close, fd);
+ return FORWARD(close, fd);
}
@@ -2362,5 +2375,5 @@ pid_t waitpid(pid_t pid, int *status, in
{
__my_pthread_testcancel();
- return FORWARD(waitpid, __libc_waitpid, pid, status, options);
+ return FORWARD(waitpid, pid, status, options);
}
@@ -2372,5 +2385,5 @@ int __nanosleep(const struct timespec *r
{
__my_pthread_testcancel();
- return FORWARD(__nanosleep, __libc_nanosleep, req, rem);
+ return FORWARD(__nanosleep, req, rem);
}
@@ -2381,5 +2394,5 @@ int pause(void)
{
__my_pthread_testcancel();
- return FORWARD(pause, __libc_pause);
+ return FORWARD(pause);
}
@@ -2391,5 +2404,5 @@ int __tcdrain(int fd)
{
__my_pthread_testcancel();
- return FORWARD(__tcdrain, __libc_tcdrain, fd);
+ return FORWARD(__tcdrain, fd);
}
@@ -2401,5 +2414,5 @@ int fsync(int fd)
{
__my_pthread_testcancel();
- return FORWARD(fsync, __libc_fsync, fd);
+ return FORWARD(fsync, fd);
}
@@ -2411,5 +2424,5 @@ off_t lseek(int fildes, off_t offset, in
{
__my_pthread_testcancel();
- return FORWARD(lseek, __libc_lseek, fildes, offset, whence);
+ return FORWARD(lseek, fildes, offset, whence);
}
@@ -2421,5 +2434,5 @@ __off64_t lseek64(int fildes, __off64_t
{
__my_pthread_testcancel();
- return FORWARD(lseek64, __libc_lseek64, fildes, offset, whence);
+ return FORWARD(lseek64, fildes, offset, whence);
}
@@ -2432,5 +2445,5 @@ ssize_t __pread64 (int __fd, void *__buf
{
__my_pthread_testcancel();
- return FORWARD(__pread64, __libc_pread64, __fd, __buf, __nbytes, __offset);
+ return FORWARD(__pread64, __fd, __buf, __nbytes, __offset);
}
@@ -2443,5 +2456,5 @@ ssize_t __pwrite64 (int __fd, const void
{
__my_pthread_testcancel();
- return FORWARD(__pwrite64, __libc_pwrite64, __fd, __buf, __nbytes, __offset);
+ return FORWARD(__pwrite64, __fd, __buf, __nbytes, __offset);
}
@@ -2453,5 +2466,5 @@ ssize_t pwrite(int fd, const void *buf,
{
__my_pthread_testcancel();
- return FORWARD(pwrite, __libc_pwrite, fd, buf, count, offset);
+ return FORWARD(pwrite, fd, buf, count, offset);
}
@@ -2463,5 +2476,5 @@ ssize_t pread(int fd, void *buf, size_t
{
__my_pthread_testcancel();
- return FORWARD(pread, __libc_pread, fd, buf, count, offset);
+ return FORWARD(pread, fd, buf, count, offset);
}
@@ -2472,5 +2485,5 @@ int recv(int s, void *msg, size_t len, i
{
__my_pthread_testcancel();
- return FORWARD(recv, __libc_recv, s, msg, len, flags);
+ return FORWARD(recv, s, msg, len, flags);
}
@@ -2481,5 +2494,5 @@ int send(int s, const void *msg, size_t
{
__my_pthread_testcancel();
- return FORWARD(send, __libc_send, s, msg, len, flags);
+ return FORWARD(send, s, msg, len, flags);
}
@@ -2491,5 +2504,5 @@ int sendmsg(int s, const struct msghdr *
{
__my_pthread_testcancel();
- return FORWARD(sendmsg, __libc_sendmsg, s, msg, flags);
+ return FORWARD(sendmsg, s, msg, flags);
}
@@ -2501,5 +2514,5 @@ int recvmsg(int s, struct msghdr *msg, i
{
__my_pthread_testcancel();
- return FORWARD(recvmsg, __libc_recvmsg, s, msg, flags);
+ return FORWARD(recvmsg, s, msg, flags);
}
@@ -2513,5 +2526,5 @@ int recvfrom(int s, void *buf, size_t le
{
__my_pthread_testcancel();
- return FORWARD(recvfrom, __libc_recfrom, s, buf, len, flags, from, fromlen);
+ return FORWARD(recvfrom, s, buf, len, flags, from, fromlen);
}
@@ -2525,5 +2538,5 @@ int sendto(int s, const void *msg, size_
{
__my_pthread_testcancel();
- return FORWARD(sendto, __libc_sendto, s, msg, len, flags, to, tolen);
+ return FORWARD(sendto, s, msg, len, flags, to, tolen);
}
@@ -2535,5 +2548,5 @@ int system(const char* str)
{
__my_pthread_testcancel();
- return FORWARD(system, __libc_system, str);
+ return FORWARD(system, str);
}
@@ -2545,5 +2558,5 @@ pid_t wait(int *status)
{
__my_pthread_testcancel();
- return FORWARD(wait, __libc_wait, status);
+ return FORWARD(wait, status);
}
@@ -2555,5 +2568,5 @@ int msync(const void *start, size_t leng
{
__my_pthread_testcancel();
- return FORWARD(msync, __libc_msync, start, length, flags);
+ return FORWARD(msync, start, length, flags);
}
@@ -2581,5 +2594,5 @@ void (*longjmp_t)(jmp_buf env, int val)
void longjmp(jmp_buf env, int val)
{
- FORWARD(longjmp, __libc_longjmp, env, val);
+ FORWARD(longjmp, env, val);
}
@@ -2590,5 +2603,5 @@ void siglongjmp(sigjmp_buf env, int val)
{
kludged("siglongjmp", "(it ignores cleanup handlers)");
- FORWARD(siglongjmp, __libc_siglongjmp, env, val);
+ FORWARD(siglongjmp, env, val);
}
@@ -2652,5 +2665,5 @@ pid_t __fork(void)
run_fork_handlers(0 /* prepare */);
- pid = FORWARD(__fork, __libc_fork);
+ pid = FORWARD(__fork);
if (pid == 0) {
/* I am the child */
|
|
From: Tom H. <th...@cy...> - 2005-01-23 16:51:13
|
CVS commit by thughes:
Don't die if we find a type of size zero. It isn't clear how to create
such a type but it has apparently been seend to happen.
MERGE TO STABLE
M +1 -1 vg_symtypes.c 1.7.2.1
--- valgrind/coregrind/vg_symtypes.c #1.7:1.7.2.1
@@ -873,5 +873,5 @@ Char *VG_(describe_addr)(ThreadId tid, A
VG_(printf)(" non-followable array (sz=%d): checking addr %p in range %p-%p\n",
sz, addr, var->valuep, (var->valuep + sz));
- if (addr >= var->valuep && addr <= (var->valuep + sz))
+ if (ty->size > 0 && addr >= var->valuep && addr <= (var->valuep + sz))
min = max = (addr - var->valuep) / ty->size;
else
|