> Unfortunally you have the last valgrind message below, just before the
"crash".
If Valgrind cannot get more memory while the client is requesting some,
it will (silently) return NULL to the client.
If Valgrind cannot get more memory while it requests itself some memory
(e.g.
for the tool arena), it will exits with an "internal error" msg.
> I am very familiar with gdb, but I am a bit unsure what you mean by
"Valgrind gdbserver+gdb".
> If I have a binary "foo" compiled with "-g -O0" or alike, what then?
You launch valgrind like this:
valgrind --vgdb-error=0 foo
Then in another window:
gdb foo
... and you follow the instructions to connect gdb to the valgrind
gdbserver...
... typically, you give to gdb something like
target remote | ..../vgdb --pid=xxxxxx
... once gdb is connected, you can put breakpoints, then continue.
... when foo is stopped on a breakpoint, you can e.g. do
(gdb) monitor leak_check
... for more info, use 'monitor help' in gdb,
... or read the user manual sections
3.2 Debugging your program using Valgrind gdbserver and GDB
4.6 Memcheck Monitor Commands
> This will be quite painful, since I see the problem every 0.3% of the
cases I have - at random...
If you apply the patch below to a valgrind 3.7.0
coregrind/m_mallocfree.c file,
the Valgrind gdbserver will activate itself when the client runs out of
memory.
You can then investigate the state of the client memory using e.g.
monitor leak_check and its various parameters
(hoping the leak search does not need too much memory :).
Philippe
*** m_mallocfree.c.orig Wed Oct 26 23:24:45 2011
--- m_mallocfree.c Mon Jan 23 11:55:05 2012
***************
*** 42,47 ****
--- 42,48 ----
#include "pub_core_threadstate.h" // For VG_INVALID_THREADID
#include "pub_core_transtab.h"
#include "pub_core_tooliface.h"
+ #include "pub_core_gdbserver.h"
#include "valgrind.h"
//zz#include "memcheck/memcheck.h"
*************** Superblock* newSuperblock ( Arena* a, Si
*** 752,759 ****
else
sres = VG_(am_sbrk_anon_float_client)
( cszB, VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC
);
! if (sr_isError(sres))
return 0;
sb = (Superblock*)(AddrH)sr_Res(sres);
// Mark this segment as containing client heap. The leak
// checker needs to be able to identify such segments so as not
--- 753,764 ----
else
sres = VG_(am_sbrk_anon_float_client)
( cszB, VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC
);
! if (sr_isError(sres)) {
! VG_(umsg)("(action on client out of memory) vgdb me ... \n");
! VG_(gdbserver)(1); // no tid available here => tid 1
arbitrarily chosen.
! VG_(umsg)("Continuing ...\n");
return 0;
+ }
sb = (Superblock*)(AddrH)sr_Res(sres);
// Mark this segment as containing client heap. The leak
// checker needs to be able to identify such segments so as not
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users