thanks for your help.  i thought this might work

void* I_WRAP_SONAME_FNNAME_ZZ(Za,malloc)( size_t size )
{
   OrigFn fn;
   void* result;
   VALGRIND_GET_ORIG_FN(fn);
   CALL_FN_W_W(result, fn, size);
   return result;
}

but i am getting the following

==77199== Process terminating with default action of signal 11 (SIGSEGV)
==77199==  General Protection Fault
==77199==    at 0x19D820: misaligned_stack_error_ (in 
/usr/lib/system/libdyld.dylib)
==77199==    by 0x28AF94: _malloc_initialize (in 
/usr/lib/system/libsystem_c.dylib)
==77199==    by 0x28B86A: malloc (in /usr/lib/system/libsystem_c.dylib)
==77199==    by 0x1F15: malloc (in Darwin_Debug/utils_q)
==77199==    by 0x1A5A61: get_or_create_key_element (in 
/usr/lib/system/libkeymgr.dylib)
==77199==    by 0x1A5C6A: _keymgr_get_and_lock_processwide_ptr_2 (in 
/usr/lib/system/libkeymgr.dylib)
==77199==    by 0x1A5E49: __keymgr_initializer (in 
/usr/lib/system/libkeymgr.dylib)
==77199==    by 0x1C797: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==77199==    by 0x8FE11202: 
ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in 
/usr/lib/dyld)
==77199==    by 0x8FE10D67: 
ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in 
/usr/lib/dyld)
==77199==    by 0x8FE0E2C7: 
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned 
int, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==77199==    by 0x8FE0E25D: 
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned 
int, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==77199== 

On Apr 13, 2012, at 12:30 AM, Julian Seward wrote:

> 
> There is no way at present.  You could hack vg_replace_malloc.c to
> do what you want, perhaps.  The difficult bit is dealing with threaded
> programs -- it may be that the number of allocations up to a given
> point in the program depends on the thread scheduling, so you don't
> really have a reliable way to incrementally test the failure of each
> allocation point.
> 
> J
> 
> On Friday, April 13, 2012, Anatoly Yakovenko wrote:
>> I would like to test my program's handling of alloc failures.  is
>> there anyway to tell valgrind when to fail after N number of mallocs?
>> 
>> Thanks,
>> Anatoly
>> 
>> ---------------------------------------------------------------------------
>> --- For Developers, A Lot Can Happen In A Second.
>> Boundary is the first to Know...and Tell You.
>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>> http://p.sf.net/sfu/Boundary-d2dvs2
>> _______________________________________________
>> Valgrind-users mailing list
>> Valgrind-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/valgrind-users
> 


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to