From: Nicholas Nethercote Date: Wed, 3 Nov 2004 18:10:37 +0000 (+0000) Subject: 64-bit cleanness: Yet more UInt-->SizeT changes. X-Git-Tag: svn/VALGRIND_3_0_0~1399 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8fc746ba46dd4a5f39ac0a76c053f4608b88927;p=thirdparty%2Fvalgrind.git 64-bit cleanness: Yet more UInt-->SizeT changes. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2910 --- diff --git a/addrcheck/ac_main.c b/addrcheck/ac_main.c index 14b188a578..296679a9d1 100644 --- a/addrcheck/ac_main.c +++ b/addrcheck/ac_main.c @@ -138,7 +138,7 @@ Bool SK_(recognised_suppression) ( Char* name, Supp* su ) static void ac_ACCESS4_SLOWLY ( Addr a, Bool isWrite ); static void ac_ACCESS2_SLOWLY ( Addr a, Bool isWrite ); static void ac_ACCESS1_SLOWLY ( Addr a, Bool isWrite ); -static void ac_fpu_ACCESS_check_SLOWLY ( Addr addr, Int size, Bool isWrite ); +static void ac_fpu_ACCESS_check_SLOWLY ( Addr addr, SizeT size, Bool isWrite ); /*------------------------------------------------------------*/ /*--- Data defns. ---*/ @@ -833,7 +833,7 @@ static void ac_ACCESS1_SLOWLY ( Addr a, Bool isWrite) ------------------------------------------------------------------ */ static -void ac_fpu_ACCESS_check ( Addr addr, Int size, Bool isWrite ) +void ac_fpu_ACCESS_check ( Addr addr, SizeT size, Bool isWrite ) { /* Ensure the read area is both addressible and valid (ie, readable). If there's an address error, don't report a value @@ -912,13 +912,13 @@ void ac_fpu_ACCESS_check ( Addr addr, Int size, Bool isWrite ) } REGPARM(2) -static void ac_fpu_READ_check ( Addr addr, Int size ) +static void ac_fpu_READ_check ( Addr addr, SizeT size ) { ac_fpu_ACCESS_check ( addr, size, /*isWrite*/False ); } REGPARM(2) -static void ac_fpu_WRITE_check ( Addr addr, Int size ) +static void ac_fpu_WRITE_check ( Addr addr, SizeT size ) { ac_fpu_ACCESS_check ( addr, size, /*isWrite*/True ); } @@ -927,7 +927,7 @@ static void ac_fpu_WRITE_check ( Addr addr, Int size ) Slow, general cases for FPU access checks. ------------------------------------------------------------------ */ -void ac_fpu_ACCESS_check_SLOWLY ( Addr addr, Int size, Bool isWrite ) +void ac_fpu_ACCESS_check_SLOWLY ( Addr addr, SizeT size, Bool isWrite ) { Int i; Bool aerr = False; diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 67be6bb097..ac91f4153c 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -1024,12 +1024,12 @@ void SK_(fini)(Int exitcode) /*--------------------------------------------------------------------*/ // Called when a translation is invalidated due to code unloading. -void SK_(discard_basic_block_info) ( Addr a, UInt size ) +void SK_(discard_basic_block_info) ( Addr a, SizeT size ) { VgHashNode** prev_next_ptr; VgHashNode* bb_info; - if (0) VG_(printf)( "discard_basic_block_info: %p, %u\n", a, size); + if (0) VG_(printf)( "discard_basic_block_info: %p, %llu\n", a, (ULong)size); // Get BB info, remove from table, free BB info. Simple! bb_info = VG_(HT_get_node)(instr_info_table, a, &prev_next_ptr); diff --git a/coregrind/toolfuncs.def b/coregrind/toolfuncs.def index 73ff43e3de..b80077083d 100644 --- a/coregrind/toolfuncs.def +++ b/coregrind/toolfuncs.def @@ -91,7 +91,7 @@ void, print_extra_suppression_info, Error* err ## Should discard any information that pertains to specific basic blocks ## or instructions within the address range given. -void, discard_basic_block_info, Addr a, UInt size +void, discard_basic_block_info, Addr a, SizeT size ## ------------------------------------------------------------------ diff --git a/coregrind/vg_memory.c b/coregrind/vg_memory.c index 3a9e7d7bda..fad9c8ab36 100644 --- a/coregrind/vg_memory.c +++ b/coregrind/vg_memory.c @@ -715,15 +715,13 @@ static void segv_handler(Int seg) SIGSEGV handler, then try to touch the memory. No signal = good, signal = bad. */ -Bool VG_(is_addressable)(Addr p, Int size) +Bool VG_(is_addressable)(Addr p, SizeT size) { volatile Char * volatile cp = (volatile Char *)p; volatile Bool ret; struct vki_sigaction sa, origsa; vki_sigset_t mask; - vg_assert(size > 0); - sa.ksa_handler = segv_handler; sa.sa_flags = 0; VG_(sigfillset)(&sa.sa_mask); @@ -748,7 +746,7 @@ Bool VG_(is_addressable)(Addr p, Int size) /*--------------------------------------------------------------------*/ // Returns 0 on failure. -Addr VG_(client_alloc)(Addr addr, UInt len, UInt prot, UInt sf_flags) +Addr VG_(client_alloc)(Addr addr, SizeT len, UInt prot, UInt sf_flags) { len = PGROUNDUP(len); diff --git a/coregrind/vg_mylibc.c b/coregrind/vg_mylibc.c index 77dcf2189b..e81c78cdfb 100644 --- a/coregrind/vg_mylibc.c +++ b/coregrind/vg_mylibc.c @@ -1315,18 +1315,18 @@ Int VG_(unlink) ( Char* file_name ) /* Nb: we do not allow the Linux extension which malloc()s memory for the buffer if buf==NULL, because we don't want Linux calling malloc() */ -Char* VG_(getcwd) ( Char* buf, Int size ) +Char* VG_(getcwd) ( Char* buf, SizeT size ) { Int res; vg_assert(buf != NULL); - res = VG_(do_syscall)(__NR_getcwd, (UInt)buf, (UInt)size); + res = VG_(do_syscall)(__NR_getcwd, (UInt)buf, size); return VG_(is_kerror)(res) ? ((Char*)NULL) : (Char*)res; } /* Alternative version that does allocate the memory. Easier to use. */ Bool VG_(getcwd_alloc) ( Char** out ) { - UInt size = 4; + SizeT size = 4; *out = NULL; while (True) { @@ -1728,7 +1728,7 @@ Int VG_(log2) ( Int x ) // Generic shell sort. Like stdlib.h's qsort(). -void VG_(ssort)( void* base, UInt nmemb, UInt size, +void VG_(ssort)( void* base, SizeT nmemb, SizeT size, Int (*compar)(void*, void*) ) { Int incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, @@ -1758,7 +1758,7 @@ void VG_(ssort)( void* base, UInt nmemb, UInt size, } // Specialised cases - if (sizeof(UInt) == size) { + if (sizeof(ULong) == size) { #define ASSIGN(dst, dsti, src, srci) \ (dst)[(dsti)] = (src)[(srci)]; @@ -1766,6 +1766,13 @@ void VG_(ssort)( void* base, UInt nmemb, UInt size, #define COMPAR(dst, dsti, src, srci) \ compar( (void*)(& (dst)[(dsti)]), (void*)(& (src)[(srci)]) ) + ULong* a = (ULong*)base; + ULong v[1]; + + SORT; + + } else if (sizeof(UInt) == size) { + UInt* a = (UInt*)base; UInt v[1]; diff --git a/coregrind/vg_replace_malloc.c.base b/coregrind/vg_replace_malloc.c.base index d88a3e896b..ec8023ff26 100644 --- a/coregrind/vg_replace_malloc.c.base +++ b/coregrind/vg_replace_malloc.c.base @@ -95,7 +95,7 @@ static void init(void) __attribute__((constructor)); /* ALL calls to malloc() and friends wind up here. */ #define ALLOC(fff, vgfff) \ -LIBALIAS(void *, fff, (Int n)) \ +LIBALIAS(void *, fff, (SizeT n)) \ { \ void* v; \ \ @@ -109,7 +109,7 @@ LIBALIAS(void *, fff, (Int n)) \ } #define ALLOC2(fff, vgfff) \ -LIBALIAS(void *, fff, (Int n)) \ +LIBALIAS(void *, fff, (SizeT n)) \ { \ void* v; \ \ @@ -164,7 +164,7 @@ FREE( _ZdaPv, __builtin_vec_delete ); FREE( _ZdaPvRKSt9nothrow_t, __builtin_vec_delete ); -LIBALIAS(void*, calloc, ( Int nmemb, Int size )) +LIBALIAS(void*, calloc, ( SizeT nmemb, SizeT size )) { void* v; @@ -177,7 +177,7 @@ LIBALIAS(void*, calloc, ( Int nmemb, Int size )) return v; } -LIBALIAS(void*, realloc, ( void* ptrV, Int new_size )) +LIBALIAS(void*, realloc, ( void* ptrV, SizeT new_size )) { void* v; @@ -199,7 +199,7 @@ LIBALIAS(void*, realloc, ( void* ptrV, Int new_size )) } -LIBALIAS(void*, memalign, ( Int alignment, Int n )) +LIBALIAS(void*, memalign, ( SizeT alignment, SizeT n )) { void* v; @@ -219,7 +219,7 @@ LIBALIAS(void*, memalign, ( Int alignment, Int n )) } -LIBALIAS(void*, valloc, ( Int size )) +LIBALIAS(void*, valloc, ( SizeT size )) { return VG_INTERCEPT(soname:libc.so.6, memalign)(VKI_PAGE_SIZE, size); } @@ -234,7 +234,7 @@ LIBALIAS(int, mallopt, ( int cmd, int value )) } -LIBALIAS(int, posix_memalign, ( void **memptr, UInt alignment, UInt size )) +LIBALIAS(int, posix_memalign, ( void **memptr, SizeT alignment, SizeT size )) { void *mem; @@ -255,15 +255,15 @@ LIBALIAS(int, posix_memalign, ( void **memptr, UInt alignment, UInt size )) LIBALIAS(int, malloc_usable_size, ( void* p )) { - Int pszB; + SizeT pszB; MALLOC_TRACE("malloc_usable_size(%p)", p ); if (NULL == p) return 0; if (!init_done) init(); - pszB = (Int)VALGRIND_NON_SIMD_CALL2( info.arena_payload_szB, - VG_AR_CLIENT, p ); + pszB = (SizeT)VALGRIND_NON_SIMD_CALL2( info.arena_payload_szB, + VG_AR_CLIENT, p ); MALLOC_TRACE(" = %d", pszB ); return pszB; diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c index 5c0fef24de..874ab227fb 100644 --- a/coregrind/vg_symtab2.c +++ b/coregrind/vg_symtab2.c @@ -1601,7 +1601,7 @@ SegInfo *VG_(read_seg_symbols) ( Segment *seg ) accuracy of error messages, but we need to do it in order to maintain the no-overlapping invariant. */ -static void unload_symbols ( Addr start, UInt length ) +static void unload_symbols ( Addr start, SizeT length ) { SegInfo *prev, *curr; @@ -2541,7 +2541,7 @@ Addr VG_(seg_start)(const SegInfo* seg) return seg->start; } -UInt VG_(seg_size)(const SegInfo* seg) +SizeT VG_(seg_size)(const SegInfo* seg) { return seg->size; } @@ -2551,7 +2551,7 @@ const UChar* VG_(seg_filename)(const SegInfo* seg) return seg->filename; } -UInt VG_(seg_sym_offset)(const SegInfo* seg) +ULong VG_(seg_sym_offset)(const SegInfo* seg) { return seg->offset; } diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c index cbe882d483..dcd6ef8dbe 100644 --- a/coregrind/vg_syscalls.c +++ b/coregrind/vg_syscalls.c @@ -113,7 +113,7 @@ static void do_atfork_child(ThreadId tid) /* return true if address range entirely contained within client address space */ -static Bool valid_client_addr(Addr start, UInt size, ThreadId tid, const Char *syscallname) +static Bool valid_client_addr(Addr start, SizeT size, ThreadId tid, const Char *syscallname) { Addr end = start+size; Addr cl_base = VG_(client_base); @@ -165,7 +165,7 @@ static Bool valid_client_addr(Addr start, UInt size, ThreadId tid, const Char *s idea of addressible memory diverges from that of the kernel's, which causes the leak detector to crash. */ static -void mash_addr_and_len( Addr* a, UInt* len) +void mash_addr_and_len( Addr* a, SizeT* len) { Addr ra; @@ -175,7 +175,7 @@ void mash_addr_and_len( Addr* a, UInt* len) } static -void mmap_segment ( Addr a, UInt len, UInt prot, UInt mm_flags, Int fd, ULong offset ) +void mmap_segment ( Addr a, SizeT len, UInt prot, UInt mm_flags, Int fd, ULong offset ) { Bool rr, ww, xx; UInt flags; @@ -200,8 +200,8 @@ void mmap_segment ( Addr a, UInt len, UInt prot, UInt mm_flags, Int fd, ULong of } static -Addr mremap_segment ( Addr old_addr, UInt old_size, - Addr new_addr, UInt new_size, +Addr mremap_segment ( Addr old_addr, SizeT old_size, + Addr new_addr, SizeT new_size, UInt flags, ThreadId tid) { Addr ret; @@ -691,7 +691,7 @@ Char *strdupcat ( const Char *s1, const Char *s2, ArenaId aid ) static void pre_mem_read_sendmsg ( ThreadId tid, - Char *msg, UInt base, UInt size ) + Char *msg, Addr base, SizeT size ) { Char *outmsg = strdupcat ( "socketcall.sendmsg", msg, VG_AR_TRANSIENT ); SYSCALL_TRACK( pre_mem_read, tid, outmsg, base, size ); @@ -701,7 +701,7 @@ void pre_mem_read_sendmsg ( ThreadId tid, static void pre_mem_write_recvmsg ( ThreadId tid, - Char *msg, UInt base, UInt size ) + Char *msg, Addr base, SizeT size ) { Char *outmsg = strdupcat ( "socketcall.recvmsg", msg, VG_AR_TRANSIENT ); SYSCALL_TRACK( pre_mem_write, tid, outmsg, base, size ); @@ -710,7 +710,7 @@ void pre_mem_write_recvmsg ( ThreadId tid, static void post_mem_write_recvmsg ( ThreadId tid, - Char *fieldName, UInt base, UInt size ) + Char *fieldName, Addr base, SizeT size ) { VG_TRACK( post_mem_write, base, size ); } @@ -719,7 +719,7 @@ static void msghdr_foreachfield ( ThreadId tid, struct vki_msghdr *msg, - void (*foreach_func)( ThreadId, Char *, UInt, UInt ) + void (*foreach_func)( ThreadId, Char *, Addr, SizeT ) ) { if ( !msg ) @@ -1188,8 +1188,8 @@ PRE(fsetxattr) { /* int fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags); */ - MAYBE_PRINTF("fsetxattr ( %d, %p, %p, %d, %d )\n", - arg1, arg2, arg3, arg4, arg5); + MAYBE_PRINTF("fsetxattr ( %d, %p, %p, %llu, %d )\n", + arg1, arg2, arg3, (ULong)arg4, arg5); SYSCALL_TRACK( pre_mem_read_asciiz, tid, "fsetxattr(name)", arg2 ); SYSCALL_TRACK( pre_mem_read, tid, "fsetxattr(value)", arg3, arg4 ); } @@ -1246,7 +1246,7 @@ POSTALIAS(llistxattr, listxattr); PRE(flistxattr) { /* ssize_t flistxattr (int filedes, char *list, size_t size); */ - MAYBE_PRINTF("flistxattr ( %d, %p, %d )\n", arg1, arg2, arg3); + MAYBE_PRINTF("flistxattr ( %d, %p, %llu )\n", arg1, arg2, (ULong)arg3); SYSCALL_TRACK( pre_mem_write, tid, "listxattr(list)", arg2, arg3 ); } @@ -1307,7 +1307,7 @@ PRE(fdatasync) PRE(msync) { /* int msync(const void *start, size_t length, int flags); */ - MAYBE_PRINTF("msync ( %p, %d, %d )\n", arg1,arg2,arg3); + MAYBE_PRINTF("msync ( %p, %llu, %d )\n", arg1,(ULong)arg2,arg3); SYSCALL_TRACK( pre_mem_read, tid, "msync(start)", arg1, arg2 ); } @@ -1431,7 +1431,7 @@ PRE(chroot) PRE(madvise) { /* int madvise(void *start, size_t length, int advice ); */ - MAYBE_PRINTF("madvise ( %p, %d, %d )\n", arg1,arg2,arg3); + MAYBE_PRINTF("madvise ( %p, %llu, %d )\n", arg1,(ULong)arg2,arg3); } PRE(mremap) @@ -1440,8 +1440,8 @@ PRE(mremap) // which lacks the fifth 'new_address' argument. /* void* mremap(void * old_address, size_t old_size, size_t new_size, unsigned long flags, void * new_address); */ - MAYBE_PRINTF("mremap ( %p, %d, %d, 0x%x, %p )\n", - arg1, arg2, arg3, arg4, arg5); + MAYBE_PRINTF("mremap ( %p, %llu, %d, 0x%x, %p )\n", + arg1, (ULong)arg2, arg3, arg4, arg5); set_result( mremap_segment((Addr)arg1, arg2, (Addr)arg5, arg3, arg4, tid) ); } @@ -1498,13 +1498,13 @@ PRE(sched_setscheduler) PRE(mlock) { /* int mlock(const void * addr, size_t len) */ - MAYBE_PRINTF("mlock ( %p, %d )\n", arg1, arg2); + MAYBE_PRINTF("mlock ( %p, %llu )\n", arg1, (ULong)arg2); } PRE(munlock) { /* int munlock(const void * addr, size_t len) */ - MAYBE_PRINTF("munlock ( %p, %d )\n", arg1, arg2); + MAYBE_PRINTF("munlock ( %p, %llu )\n", arg1, (ULong)arg2); } PRE(mlockall) @@ -1571,7 +1571,7 @@ PRE(sendfile) { /* ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) */ - MAYBE_PRINTF("sendfile ( %d, %d, %p, %d )\n",arg1,arg2,arg3,arg4); + MAYBE_PRINTF("sendfile ( %d, %d, %p, %llu )\n",arg1,arg2,arg3,(ULong)arg4); if (arg3 != (UInt)NULL) SYSCALL_TRACK( pre_mem_write, tid, "sendfile(offset)", arg3, sizeof(vki_off_t) ); @@ -1586,7 +1586,7 @@ PRE(sendfile64) { /* ssize_t sendfile64(int out_df, int in_fd, loff_t *offset, size_t count); */ - MAYBE_PRINTF("sendfile64 ( %d, %d, %p, %d )\n",arg1,arg2,arg3,arg4); + MAYBE_PRINTF("sendfile64 ( %d, %d, %p, %llu )\n",arg1,arg2,arg3,(ULong)arg4); if (arg3 != (UInt)NULL) SYSCALL_TRACK( pre_mem_write, tid, "sendfile64(offset)", arg3, sizeof(vki_loff_t) ); @@ -1602,8 +1602,8 @@ POST(sendfile64) PRE(pwrite64) { // ssize_t pwrite64(int fd, const void *buf, size_t nbytes, loff_t offset); - MAYBE_PRINTF("pwrite64 ( %d, %p, %d, %lld )\n", - arg1, arg2, arg3, arg4|((ULong) arg5 << 32)); + MAYBE_PRINTF("pwrite64 ( %d, %p, %llu, %lld )\n", + arg1, arg2, (ULong)arg3, arg4|((ULong) arg5 << 32)); SYSCALL_TRACK( pre_mem_read, tid, "pwrite64(buf)", arg2, arg3 ); } @@ -1629,7 +1629,7 @@ POST(fstatfs) PRE(fstatfs64) { /* int fstatfs64(int fd, size_t sz, struct statfs *buf); */ - MAYBE_PRINTF("fstatfs64 ( %d, %p )\n",arg1,arg2); + MAYBE_PRINTF("fstatfs64 ( %d, %llu, %p )\n",arg1,(ULong)arg2,arg3); SYSCALL_TRACK( pre_mem_write, tid, "stat(buf)", arg3, arg2 ); } @@ -1647,8 +1647,8 @@ PRE(getsid) PRE(pread64) { /* ssize_t pread64(int fd, void *buf, size_t count, loff_t offset); */ - MAYBE_PRINTF("pread ( %d, %p, %d, %lld )\n", - arg1, arg2, arg3, arg4|((ULong) arg5 << 32)); + MAYBE_PRINTF("pread ( %d, %p, %llu, %lld )\n", + arg1, arg2, (ULong)arg3, arg4|((ULong) arg5 << 32)); SYSCALL_TRACK( pre_mem_write, tid, "pread(buf)", arg2, arg3 ); } @@ -2111,7 +2111,7 @@ PRE(fsync) PRE(ftruncate) { /* int ftruncate(int fd, size_t length); */ - MAYBE_PRINTF("ftruncate ( %d, %d )\n", arg1,arg2); + MAYBE_PRINTF("ftruncate ( %d, %lld )\n", arg1,(ULong)arg2); } PRE(ftruncate64) @@ -2172,7 +2172,7 @@ PRE(getcwd) // Note that this prototype is the kernel one, with a different return // type to the glibc one! /* long getcwd(char *buf, size_t size); */ - MAYBE_PRINTF("getcwd ( %p, %d )\n",arg1,arg2); + MAYBE_PRINTF("getcwd ( %p, %llu )\n",arg1,(ULong)arg2); SYSCALL_TRACK( pre_mem_write, tid, "getcwd(buf)", arg1, arg2 ); } @@ -4080,8 +4080,8 @@ PRE(mmap2) /* void* mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset); */ - MAYBE_PRINTF("mmap2 ( %p, %d, %d, %d, %d, %d )\n", - arg1, arg2, arg3, arg4, arg5, arg6 ); + MAYBE_PRINTF("mmap2 ( %p, %llu, %d, %d, %d, %d )\n", + arg1, (ULong)arg2, arg3, arg4, arg5, arg6 ); if (arg4 & VKI_MAP_FIXED) { if (!valid_client_addr(arg1, arg2, tid, "mmap2")) @@ -4112,8 +4112,8 @@ PRE(mmap) vg_assert(tid = tst->tid); PLATFORM_GET_MMAP_ARGS(tst, a1, a2, a3, a4, a5, a6); - MAYBE_PRINTF("mmap ( %p, %d, %d, %d, %d, %d )\n", - a1, a2, a3, a4, a5, a6 ); + MAYBE_PRINTF("mmap ( %p, %llu, %d, %d, %d, %d )\n", + a1, (ULong)a2, a3, a4, a5, a6 ); if (a4 & VKI_MAP_FIXED) { if (!valid_client_addr(a1, a2, tid, "mmap")) { @@ -4142,7 +4142,7 @@ PRE(mprotect) { /* int mprotect(const void *addr, size_t len, int prot); */ /* should addr .. addr+len-1 be checked before the call? */ - MAYBE_PRINTF("mprotect ( %p, %d, %d )\n", arg1,arg2,arg3); + MAYBE_PRINTF("mprotect ( %p, %llu, %d )\n", arg1,(ULong)arg2,arg3); if (!valid_client_addr(arg1, arg2, tid, "mprotect")) set_result( -VKI_ENOMEM ); @@ -4151,7 +4151,7 @@ PRE(mprotect) POST(mprotect) { Addr a = arg1; - UInt len = arg2; + SizeT len = arg2; Int prot = arg3; Bool rr = prot & VKI_PROT_READ; Bool ww = prot & VKI_PROT_WRITE; @@ -4166,7 +4166,7 @@ PRE(munmap) { /* int munmap(void *start, size_t length); */ /* should start .. start+length-1 be checked before the call? */ - MAYBE_PRINTF("munmap ( %p, %d )\n", arg1,arg2); + MAYBE_PRINTF("munmap ( %p, %llu )\n", arg1,(ULong)arg2); if (!valid_client_addr(arg1, arg2, tid, "munmap")) set_result( -VKI_EINVAL ); @@ -4174,8 +4174,8 @@ PRE(munmap) POST(munmap) { - Addr a = arg1; - UInt len = arg2; + Addr a = arg1; + SizeT len = arg2; mash_addr_and_len(&a, &len); VG_(unmap_range)(a, len); @@ -4185,7 +4185,7 @@ POST(munmap) PRE(mincore) { /* int mincore(void *start, size_t length, unsigned char *vec); */ - MAYBE_PRINTF("mincore ( %p, %d, %p )\n", arg1,arg2,arg3); + MAYBE_PRINTF("mincore ( %p, %llu, %p )\n", arg1,(ULong)arg2,arg3); SYSCALL_TRACK(pre_mem_write, tid, "mincore(vec)", arg3, (arg2 + 4096 - 1) / 4096); } @@ -4262,7 +4262,7 @@ POST(open) PRE(read) { /* size_t read(int fd, void *buf, size_t count); */ - MAYBE_PRINTF("read ( %d, %p, %d )\n", arg1, arg2, arg3); + MAYBE_PRINTF("read ( %d, %p, %llu )\n", arg1, arg2, (ULong)arg3); if (!fd_allowed(arg1, "read", tid, False)) set_result( -VKI_EBADF ); @@ -4278,7 +4278,7 @@ POST(read) PRE(write) { /* size_t write(int fd, const void *buf, size_t count); */ - MAYBE_PRINTF("write ( %d, %p, %d )\n", arg1, arg2, arg3); + MAYBE_PRINTF("write ( %d, %p, %llu )\n", arg1, arg2, (ULong)arg3); if (!fd_allowed(arg1, "write", tid, False)) set_result( -VKI_EBADF ); else @@ -4411,7 +4411,7 @@ POST(epoll_wait) PRE(readlink) { /* int readlink(const char *path, char *buf, size_t bufsiz); */ - MAYBE_PRINTF("readlink ( %p, %p, %d )\n", arg1,arg2,arg3); + MAYBE_PRINTF("readlink ( %p, %p, %llu )\n", arg1,arg2,(ULong)arg3); SYSCALL_TRACK( pre_mem_read_asciiz, tid, "readlink(path)", arg1 ); SYSCALL_TRACK( pre_mem_write, tid, "readlink(buf)", arg2,arg3 ); } @@ -4426,7 +4426,7 @@ PRE(readv) /* int readv(int fd, const struct iovec * vector, size_t count); */ Int i; struct vki_iovec * vec; - MAYBE_PRINTF("readv ( %d, %p, %d )\n",arg1,arg2,arg3); + MAYBE_PRINTF("readv ( %d, %p, %llu )\n",arg1,arg2,(ULong)arg3); if (!fd_allowed(arg1, "readv", tid, False)) { set_result( -VKI_EBADF ); } else { @@ -4586,7 +4586,7 @@ PRE(setsid) PRE(setgroups) { /* int setgroups(size_t size, const gid_t *list); */ - MAYBE_PRINTF("setgroups ( %d, %p )\n", arg1, arg2); + MAYBE_PRINTF("setgroups ( %llu, %p )\n", (ULong)arg1, arg2); if (arg1 > 0) SYSCALL_TRACK( pre_mem_read, tid, "setgroups(list)", arg2, arg1 * sizeof(vki_gid_t) ); @@ -5074,7 +5074,7 @@ POST(statfs) PRE(statfs64) { /* int statfs64(const char *path, size_t sz, struct statfs64 *buf); */ - MAYBE_PRINTF("statfs64 ( %p, %p )\n",arg1,arg2); + MAYBE_PRINTF("statfs64 ( %p, %llu, %p )\n",arg1,(ULong)arg2,arg3); SYSCALL_TRACK( pre_mem_read_asciiz, tid, "statfs64(path)", arg1 ); SYSCALL_TRACK( pre_mem_write, tid, "statfs64(buf)", arg3, arg2 ); } @@ -5254,7 +5254,7 @@ PRE(writev) /* int writev(int fd, const struct iovec * vector, size_t count); */ Int i; struct vki_iovec * vec; - MAYBE_PRINTF("writev ( %d, %p, %d )\n",arg1,arg2,arg3); + MAYBE_PRINTF("writev ( %d, %p, %llu )\n",arg1,arg2,(ULong)arg3); if (!fd_allowed(arg1, "writev", tid, False)) { set_result( -VKI_EBADF ); } else { @@ -5520,7 +5520,7 @@ POSTALIAS(rt_sigpending, sigpending); PRE(io_setup) { - UInt size; + SizeT size; Addr addr; /* long io_setup (unsigned nr_events, aio_context_t *ctxp); */ @@ -5554,7 +5554,7 @@ PRE(io_destroy) { Segment *s = VG_(find_segment)(arg1); struct vki_aio_ring *r = *(struct vki_aio_ring **)arg1; - UInt size = PGROUNDUP(sizeof(struct vki_aio_ring) + r->nr * sizeof(struct vki_io_event)); + SizeT size = PGROUNDUP(sizeof(struct vki_aio_ring) + r->nr * sizeof(struct vki_io_event)); /* long io_destroy (aio_context_t ctx); */ MAYBE_PRINTF("io_destroy ( %ul )\n",arg1); @@ -5690,8 +5690,8 @@ PRE(mq_timedsend) { /* int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abs_timeout); */ - MAYBE_PRINTF("mq_timedsend ( %d, %p, %d, %d, %p )\n", - arg1,arg2,arg3,arg4,arg5); + MAYBE_PRINTF("mq_timedsend ( %d, %p, %llu, %d, %p )\n", + arg1,arg2,(ULong)arg3,arg4,arg5); if (!fd_allowed(arg1, "mq_timedsend", tid, False)) { set_result( -VKI_EBADF ); } else { @@ -5707,8 +5707,8 @@ PRE(mq_timedreceive) /* ssize_t mq_timedreceive(mqd_t mqdes, char *restrict msg_ptr, size_t msg_len, unsigned *restrict msg_prio, const struct timespec *restrict abs_timeout); */ - MAYBE_PRINTF("mq_timedreceive( %d, %p, %d, %p, %p )\n", - arg1,arg2,arg3,arg4,arg5); + MAYBE_PRINTF("mq_timedreceive( %d, %p, %llu, %p, %p )\n", + arg1,arg2,(ULong)arg3,arg4,arg5); if (!fd_allowed(arg1, "mq_timedreceive", tid, False)) { set_result( -VKI_EBADF ); } else { diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index c6a57ddd83..256ae3300a 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -142,7 +142,7 @@ typedef struct _HG_Chunk { struct _HG_Chunk* next; Addr data; /* ptr to actual block */ - Int size; /* size requested */ + SizeT size; /* size requested */ ExeContext* where; /* where it was allocated */ ThreadId tid; /* allocating thread */ } @@ -2403,7 +2403,7 @@ static void describe_addr ( Addr a, AddrInfo* ai ) seg != NULL; seg = VG_(next_seginfo)(seg)) { Addr base = VG_(seg_start)(seg); - UInt size = VG_(seg_size)(seg); + SizeT size = VG_(seg_size)(seg); const UChar *filename = VG_(seg_filename)(seg); if (a >= base && a < base+size) { diff --git a/include/tool.h.base b/include/tool.h.base index 89d66ad008..ec0460f7e8 100644 --- a/include/tool.h.base +++ b/include/tool.h.base @@ -388,7 +388,7 @@ extern Long VG_(atoll16) ( Char* str ); extern Long VG_(atoll36) ( UInt base, Char* str ); /* Like qsort(), but does shell-sort. The size==1/2/4 cases are specialised. */ -extern void VG_(ssort)( void* base, UInt nmemb, UInt size, +extern void VG_(ssort)( void* base, SizeT nmemb, SizeT size, Int (*compar)(void*, void*) ); @@ -460,7 +460,7 @@ extern Int VG_(stat) ( Char* file_name, struct vki_stat* buf ); extern Int VG_(fstat) ( Int fd, struct vki_stat* buf ); extern Int VG_(dup2) ( Int oldfd, Int newfd ); -extern Char* VG_(getcwd) ( Char* buf, Int size ); +extern Char* VG_(getcwd) ( Char* buf, SizeT size ); /* Easier to use than VG_(getcwd)() -- does the buffer fiddling itself. String put into 'cwd' is VG_(malloc)'d, and should be VG_(free)'d. @@ -499,9 +499,9 @@ extern Addr VG_(get_shadow_size)(void); extern void *VG_(shadow_alloc)(UInt size); -extern Bool VG_(is_addressable)(Addr p, Int sz); +extern Bool VG_(is_addressable)(Addr p, SizeT sz); -extern Addr VG_(client_alloc)(Addr base, UInt len, UInt prot, UInt flags); +extern Addr VG_(client_alloc)(Addr base, SizeT len, UInt prot, UInt flags); extern void VG_(client_free)(Addr addr); extern Bool VG_(is_valgrind_addr)(Addr a); @@ -1557,9 +1557,9 @@ extern SegInfo* VG_(get_obj) ( Addr a ); extern const SegInfo* VG_(next_seginfo) ( const SegInfo *seg ); extern Addr VG_(seg_start) ( const SegInfo *seg ); -extern UInt VG_(seg_size) ( const SegInfo *seg ); +extern SizeT VG_(seg_size) ( const SegInfo *seg ); extern const UChar* VG_(seg_filename) ( const SegInfo *seg ); -extern UInt VG_(seg_sym_offset)( const SegInfo *seg ); +extern ULong VG_(seg_sym_offset)( const SegInfo *seg ); typedef enum { diff --git a/memcheck/mac_needs.c b/memcheck/mac_needs.c index ce09679bb8..87b58263bd 100644 --- a/memcheck/mac_needs.c +++ b/memcheck/mac_needs.c @@ -876,7 +876,7 @@ Bool MAC_(handle_common_client_requests)(ThreadId tid, UInt* arg, UInt* ret ) case VG_USERREQ__MALLOCLIKE_BLOCK: { Addr p = (Addr)arg[1]; - UInt sizeB = arg[2]; + SizeT sizeB = arg[2]; UInt rzB = arg[3]; Bool is_zeroed = (Bool)arg[4]; diff --git a/memcheck/mac_shared.h b/memcheck/mac_shared.h index d9a84abd89..88deee5771 100644 --- a/memcheck/mac_shared.h +++ b/memcheck/mac_shared.h @@ -60,8 +60,8 @@ typedef typedef struct { // Used by: AddrKind akind; // ALL - Int blksize; // Freed, Mallocd - Int rwoffset; // Freed, Mallocd + SizeT blksize; // Freed, Mallocd + SSizeT rwoffset; // Freed, Mallocd ExeContext* lastchange; // Freed, Mallocd ThreadId stack_tid; // Stack Bool maybe_gcc; // True if just below %esp -- could be a gcc bug.