From 78e24d41bd366a2a84bb2c7eb7d4b0259fae703e Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Sun, 24 Apr 2005 00:04:42 +0000 Subject: [PATCH] Add intercepts for operator new(unsigned long) and operator new[](unsigned long). The 32-bit ones take unsigned int args, not unsigned longs, and so the existing name-set did not capture them. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3549 --- NOTES.txt | 16 +++++++++++----- coregrind/vg_replace_malloc.c | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/NOTES.txt b/NOTES.txt index 7c8b7fe71..6b6d7bc54 100644 --- a/NOTES.txt +++ b/NOTES.txt @@ -1,12 +1,18 @@ 23 Apr 05 (memcheck-on-amd64 notes) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* If a thread is given an initial stack with address range [lo .. hi], + we need to tell memcheck that the area [lo - VGA_STACK_REDZONE_SIZE + .. hi] is valid, rather than just [lo .. hi] as has been the case on + x86-only systems. However, am not sure where to look for the call + into memcheck that states the new stack area. + +* vg_replace_malloc.c: need to create intercepts for + 64-bit versions of + operator new(unsigned, std::nothrow_t const&) + and + operator new[](unsigned, std::nothrow_t const&) -If a thread is given an initial stack with address range [lo .. hi], -we need to tell memcheck that the area [lo - VGA_STACK_REDZONE_SIZE -.. hi] is valid, rather than just [lo .. hi] as has been the case on -x86-only systems. However, am not sure where to look for the -call into memcheck that states the new stack area. 9 Apr 05 (starting work on memcheck for 32/64-bit and big/little endian) diff --git a/coregrind/vg_replace_malloc.c b/coregrind/vg_replace_malloc.c index 6d5a69807..c9ba6f32e 100644 --- a/coregrind/vg_replace_malloc.c +++ b/coregrind/vg_replace_malloc.c @@ -215,19 +215,27 @@ ALLOC_or_NULL(m_libstc_plus_plus_star, malloc, malloc); ALLOC_or_NULL(m_libc_dot_so_dot_6, malloc, malloc); //ALLOC_or_NULL(m_libpgc_dot_so, malloc, malloc); -// operator new(unsigned int), GNU mangling +// operator new(unsigned int), GNU mangling, 32-bit platforms ALLOC_or_BOMB(m_libstc_plus_plus_star, builtin_new, __builtin_new); ALLOC_or_BOMB(m_libc_dot_so_dot_6, builtin_new, __builtin_new); ALLOC_or_BOMB(m_libstc_plus_plus_star, __builtin_new, __builtin_new); ALLOC_or_BOMB(m_libc_dot_so_dot_6, __builtin_new, __builtin_new); +// TODO: these should only exist on 32-bit platforms ALLOC_or_BOMB(m_libstc_plus_plus_star, _Znwj, __builtin_new); ALLOC_or_BOMB(m_libc_dot_so_dot_6, _Znwj, __builtin_new); +// TODO: these should only exist on 64-bit platforms +// operator new(unsigned long), GNU mangling, 64-bit platforms +ALLOC_or_BOMB(m_libstc_plus_plus_star, _Znwm, __builtin_new); +ALLOC_or_BOMB(m_libc_dot_so_dot_6, _Znwm, __builtin_new); + + // operator new(unsigned int), ARM/cfront mangling //ALLOC_or_BOMB(m_libpgc_dot_so, __nw__FUi, __builtin_new); +// TODO: create 64-bit version // operator new(unsigned, std::nothrow_t const&), GNU mangling ALLOC_or_NULL(m_libstc_plus_plus_star, _ZnwjRKSt9nothrow_t, __builtin_new); ALLOC_or_NULL(m_libc_dot_so_dot_6, _ZnwjRKSt9nothrow_t, __builtin_new); @@ -235,9 +243,17 @@ ALLOC_or_NULL(m_libc_dot_so_dot_6, _ZnwjRKSt9nothrow_t, __builtin_new); // operator new[](unsigned int), GNU mangling ALLOC_or_BOMB(m_libstc_plus_plus_star, __builtin_vec_new, __builtin_vec_new ); ALLOC_or_BOMB(m_libc_dot_so_dot_6, __builtin_vec_new, __builtin_vec_new ); + +// TODO: these should only exist on 32-bit platforms ALLOC_or_BOMB(m_libstc_plus_plus_star, _Znaj, __builtin_vec_new ); ALLOC_or_BOMB(m_libc_dot_so_dot_6, _Znaj, __builtin_vec_new ); +// TODO: these should only exist on 64-bit platforms +// operator new[](unsigned long), GNU mangling, 64-bit platforms +ALLOC_or_BOMB(m_libstc_plus_plus_star, _Znam, __builtin_vec_new ); +ALLOC_or_BOMB(m_libc_dot_so_dot_6, _Znam, __builtin_vec_new ); + +// TODO: create 64-bit version // operator new[](unsigned, std::nothrow_t const&), GNU mangling ALLOC_or_NULL(m_libstc_plus_plus_star, _ZnajRKSt9nothrow_t, __builtin_vec_new ); ALLOC_or_NULL(m_libc_dot_so_dot_6, _ZnajRKSt9nothrow_t, __builtin_vec_new );