|
From: Philippe W. <phi...@sk...> - 2015-04-01 20:10:43
|
On Wed, 2015-04-01 at 16:37 -0300, Andres Tiraboschi wrote: > Actually they replace malloc(at least in valgrind 3.10.1). For example > in the source of drd look at drd_malloc_wrappers.c No. They do something so that *potentially* malloc/free/... are replaced. But by default, the replacement will *not* happen for a static malloc or for a tcmalloc or any other alternate malloc library. So, that makes me believe there is no need to have malloc replaced to have this tools working (with reduced functionality of course, because they will not observe any malloc activity). So, I still believe the segv you are seeing is not related to 'non replacement of malloc/free/...' but that you have another problem. Philippe > > 2015-04-01 16:25 GMT-03:00 Philippe Waroquiers <phi...@sk...>: > > On Tue, 2015-03-31 at 15:28 -0300, Andres Tiraboschi wrote: > >> But if you want to replace functions from pthread like helgrind and > >> drd do you have to replace the client malloc/free > >> I don't know why. > > To my knowledge, there is no need to replace malloc/free to have > > helgrind or drd working. > > > > A "proof" of that is that if you use an alternate malloc lib (e.g. > > tcmalloc) or a static malloc library, > > by default, no replacement will be done. Still these tools do > > not crash. > > > > So, the segv you are seeing is I believe not related to > > 'non replacement of malloc/free/...'. > > Replacing malloc might just by chance bypass the real underlying > > problem. > > > > Philippe > > > > > >> > >> 2015-03-30 15:26 GMT-03:00 Philippe Waroquiers <phi...@sk...>: > >> > On Mon, 2015-03-30 at 15:10 -0300, Andres Tiraboschi wrote: > >> >> I was making a tool for valgrind for measuring things related with threads. > >> >> I made it work but for that, surprisingly I had to replace mallocs and > >> >> frees with VG_(needs_malloc_replacement). > >> >> If I don't do this I get a segmentation fault. > >> >> > >> >> In drd if I make that the tool doens't replace the mallocs and frees > >> >> there is the same segmentation fault. > >> >> > >> >> I couldn't find any documentation about this, so I don't know if this > >> >> is supposed to be like this or is a bug. > >> > No, it is not mandatory to replace (client) malloc/free. > >> > > >> > There are several tools that do not replace malloc/free. > >> > E.g. cachegrind and callgrind are not replacing client malloc/free. > >> > > >> > Philippe > >> > > >> > > > > > |