tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: static functions are your friends (Was GPIO revisited)
On Sun, Aug 09, 2009 at 05:41:35PM +0200, Marc Balmer wrote:
>
> What I really wanted is that in the moment the system crashed and enters
> ddb, it should be very easy to immediately get to the spot where the
> error happened. A useful backtrace so that I can go to the source code
> and see where it happened.
I think you misunderstand the cause of the problem you're seeing, though.
It's not static, it's that marking functions static causes GCC to
(sometimes) automatically inline them. It's the inlining that is confusing
the debugger.
__noinline will ensure that the debugger can trace through your functions
while preserving the several other benfits of 'static'. If you think the
compiler's automatic inlining is actually a worthwhile performance win
(and if it's tuned right, it should be, but often it is not) then another
macro which evaluates to noinline only in a debug or diagnostic kernel
might be a good idea.
You know, there's not always only one way to do things. Sometimes,
working in a collaborative project (rather than a he-who-shouts-loudest-wins
project) means that you have to give up your own personal most-preferred
way to do some particular thing in favor of what you can actually find
consensus for. Sometimes that means keeping a local tree with a few
dozen lines of changes to do it one's own most-preferred way. But so what?
Eventually there is usually a way to get most of what everyone involved
wants (like, say, "static __noinline" in this case!).
Thor
Home |
Main Index |
Thread Index |
Old Index