Very grateful to tim I think I didn't make it clear... actually, my program is a large monster which got 300k lines. and I'm forbiden to modify it(and also I won't do that). I just want run valgrind like gdb: handle SIGPIPE nostop Is there the way to achieve the goals? --alonso
On Thu, Jul 2, 2009 at 10:37 PM, Tim Post <[email protected]> wrote: > Hi, > > On Thu, 2009-07-02 at 22:09 +0800, 张 磊 wrote: > > Hi,all! > > > > > > this is alonso,I'm freshman here... > > > > My programe recive signal form from underlying framework. if threse's > > something wrong, the framework will send a signal (just like signal > > 11) to kill my programe... > > > > > > when go throuth with Valgrind, My programe run slower than before and > > this abnormal... so it will be killed > > > > How can I disable this kind of signal when I run my programe with > > valgrind? > > If you have the Valgrind development headers, there's a very helpful > macro to accomplish just this: > > #include <valgrind/valgrind.h> > > if (RUNNING_ON_VALGRIND) { > ... don't rely on timed signals ... > } else { > ... rely on timed signals ... > } > > I use that macro frequently, i.e. automatically turning on a global > debug variable, which in turn controls a bunch of other things. > > So, more properly, it might be: > > #if HAVE_VALGRIND_VALGRIND_H > #include <valgrind/valgrind.h> > #else > #define RUNNING_ON_VALGRIND 0 > #endif > > unsigned int debug_mode = 0; > > int main(void) > { > if (RUNNING_ON_VALGRIND) > debug_mode = 1; > > .... > > if (debug) { > ... disable signals ... > } > > } > > That's probably the cheapest way to do it, unless you need the VG > instance. It sounds like you just need to know if your program is > running under VG and adjust its behavior if so. > > > There are a lot of other very useful bits in valgrind.h if you want to > take a peek. > > Cheers, > --Tim > > > >
------------------------------------------------------------------------------
_______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
