|
From: Andres T. <and...@ta...> - 2015-04-01 20:23:33
|
But in drd_malloc_wrappers.c for example if you comment "VG_(needs_malloc_replacement)(drd_malloc, ..." in DRD_(register_malloc_wrappers) when pthread_create is called you'll have the following segmentation fault. --6540-- VG_USERREQ__CLIENT_CALL2: func=0x0 ==6540== ==6540== Process terminating with default action of signal 11 (SIGSEGV) . . . Segmentation fault (core dumped) This the same segmentation fault I was having and I solved replacing malloc/free. I have no idea why this. 2015-04-01 17:11 GMT-03:00 Philippe Waroquiers <phi...@sk...>: > 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 >> >> > >> >> > >> > >> > > > |