|
From: 张 磊 <st....@gm...> - 2009-07-02 14:17:18
|
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? * -- Sincerely, Lei Zhang, BSc Department of Computer Science and Technology School of Electronic and Information Engineering Xi'an Jiaotong University Tel:+86-29-82676725 Mobile:(+86)1599-160-6251 Email:St.Alonso@Gmail.com |
|
From: Tim P. <ec...@ec...> - 2009-07-02 14:38:04
|
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
|
|
From: 张 磊 <st....@gm...> - 2009-07-02 15:05:12
|
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 <ec...@ec...> 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
>
>
>
>
|
|
From: Dan K. <da...@ke...> - 2009-07-02 15:14:18
|
Try using LD_PRELOAD_LIBRARY On Jul 2, 2009 8:06 AM, "张 磊" <st....@gm...> wrote: 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 <ec...@ec...> wrote: > > Hi, > > On Thu, 2009-07-0... ------------------------------------------------------------------------------ _______________________________________________ Valgrind-users mailing list Val...@li... https://lists.sourceforge.net/lists/listinfo/valgrind-users |