mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 10:05:29 +00:00
malloc_usable_size() was totally broken, crashing immediately.
I guess it's not very widely used :) git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4439
This commit is contained in:
parent
560ac62ff7
commit
dbae71819c
@ -1197,7 +1197,7 @@ void* VG_(arena_memalign) ( ArenaId aid, SizeT req_alignB, SizeT req_pszB )
|
||||
}
|
||||
|
||||
|
||||
SizeT VG_(arena_payload_szB) ( ArenaId aid, void* ptr )
|
||||
SizeT VG_(arena_payload_szB) ( ThreadId tid, ArenaId aid, void* ptr )
|
||||
{
|
||||
Arena* a = arenaId_to_ArenaP(aid);
|
||||
Block* b = get_payload_block(a, ptr);
|
||||
|
||||
@ -81,7 +81,7 @@ extern Char* VG_(arena_strdup) ( ArenaId aid, const Char* s);
|
||||
must be called before any of VG_(malloc) and friends are called. */
|
||||
extern void VG_(set_client_malloc_redzone_szB) ( SizeT rz_szB );
|
||||
|
||||
extern SizeT VG_(arena_payload_szB) ( ArenaId aid, void* payload );
|
||||
extern SizeT VG_(arena_payload_szB) ( ThreadId tid, ArenaId aid, void* p );
|
||||
|
||||
extern void VG_(sanity_check_malloc_all) ( void );
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ struct vg_mallocfunc_info {
|
||||
void (*tl___builtin_vec_delete)(ThreadId tid, void* p);
|
||||
void* (*tl_realloc) (ThreadId tid, void* p, SizeT size);
|
||||
|
||||
SizeT (*arena_payload_szB) (ArenaId aid, void* payload);
|
||||
SizeT (*arena_payload_szB) (ThreadId tid, ArenaId aid, void* payload);
|
||||
Bool clo_trace_malloc;
|
||||
};
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
|
||||
leak-tree.stderr.exp2 leak-tree.stderr.exp64 \
|
||||
leak-regroot.vgtest leak-regroot.stderr.exp \
|
||||
leakotron.vgtest leakotron.stdout.exp leakotron.stderr.exp \
|
||||
malloc_usable.stderr.exp malloc_usable.vgtest \
|
||||
malloc1.stderr.exp malloc1.vgtest \
|
||||
malloc2.stderr.exp malloc2.vgtest \
|
||||
malloc3.stderr.exp malloc3.stdout.exp malloc3.vgtest \
|
||||
@ -99,7 +100,7 @@ check_PROGRAMS = \
|
||||
doublefree error_counts errs1 exitprog execve execve2 erringfds \
|
||||
fprw fwrite hello inits inline \
|
||||
leak-0 leak-cycle leak-tree leak-regroot leakotron \
|
||||
malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
|
||||
malloc_usable malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
|
||||
match-overrun \
|
||||
memalign_test memalign2 memcmptest mempool mmaptest \
|
||||
nanoleak new_nothrow \
|
||||
|
||||
12
memcheck/tests/malloc_usable.c
Normal file
12
memcheck/tests/malloc_usable.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <assert.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Since our allocations are in multiples of 8, 99 will round up to 104.
|
||||
int* x = malloc(99);
|
||||
assert(104 == malloc_usable_size(x));
|
||||
return 0;
|
||||
}
|
||||
0
memcheck/tests/malloc_usable.stderr.exp
Normal file
0
memcheck/tests/malloc_usable.stderr.exp
Normal file
2
memcheck/tests/malloc_usable.vgtest
Normal file
2
memcheck/tests/malloc_usable.vgtest
Normal file
@ -0,0 +1,2 @@
|
||||
prog: malloc_usable
|
||||
vgopts: -q
|
||||
Loading…
x
Reference in New Issue
Block a user