Valgrind - used gdb

Neil Ferguson nferguso@eso.org
Thu Oct 26 14:51:00 GMT 2006


Srivatsan Ramanujam wrote:

<snip>

> what does the -fno-inline flag do? should i include
> this along with that db-attach flags?

'-fno-inline' is a compiler flag, not a Valgrind flag. It tells the compiler 
not to inline anything, which should hopefully give you a deeper, but more 
informative stack trace in your debugger.

You'll need to add it to your build setup somehow - set CFLAGS in your 
environment, for example, or edit your Makefile.

>> Sounds like your function is TOO huge. Strive to make routines do "one
>> unit of work". If the cyclometric complexity of the routine is greater
>> than, oh, 7 or so, it's likely doing too much.
> 
> yeah that is the whole problem....the function is too huge...but it is NOT
> MINE :-), someone else had written it (who isn't much familiar with
> programming as he is more of an algo expert....), rewriting this program
> into smaller chunks wud take more time...so it is not an option as of
> now.....

An algorithm expert should be *exactly* the person to break an algorithm into 
tractable subcomponents.

>>And "too much" translates into "hard to understand,
>>hard to maintain, hard to debug".
>>
>>HTH,
>>--Eljay
> 
> any further directions wud be really helpful.
> 
> thanks
> vatsan.

If you can't compile with '-fno-inline', you're going to have to go with one 
of the divide-and-conquer approaches John described. There's nothing else you 
can do in a situation like this.

Neil.



More information about the Gcc-help mailing list