2003-11-03 18:38:43

by Ihar 'Philips' Filipau

[permalink] [raw]
Subject: How provoke call stack trace

Hello All!

[ Simple question. Probably FAQ - but I cannot find it. ]

How can I print call stack trace, just like BUG() does?
But without asm(".long 0") as BUG() does.

Is there any function which can be used by module to just
investigate some given call path?

--
Ihar 'Philips' Filipau / with best regards from Saarbruecken.
-- _ _ _
"... and for $64000 question, could you get yourself |_|*|_|
vaguely familiar with the notion of on-topic posting?" |_|_|*|
-- Al Viro @ LKML |*|*|*|


2003-11-03 18:45:26

by Michael Buesch

[permalink] [raw]
Subject: Re: How provoke call stack trace

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 03 November 2003 19:38, Ihar 'Philips' Filipau wrote:
> Hello All!
>
> [ Simple question. Probably FAQ - but I cannot find it. ]
>
> How can I print call stack trace, just like BUG() does?
> But without asm(".long 0") as BUG() does.

Maybe
dump_stack();
is what you're searching for?

- --
Regards Michael Buesch [ http://www.tuxsoft.de.vu ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/pqI9oxoigfggmSgRAscBAJ4ndlnDWL0557Jv5oE6Iawue4SEZACbBRHU
W3QGnBNgazObL2bEedaEe3A=
=FJMu
-----END PGP SIGNATURE-----

2003-11-03 18:54:40

by Muli Ben-Yehuda

[permalink] [raw]
Subject: Re: How provoke call stack trace

On Mon, Nov 03, 2003 at 07:38:39PM +0100, Ihar 'Philips' Filipau wrote:

> Is there any function which can be used by module to just
> investigate some given call path?

Assuming 2.6, call dump_stack(). If you want greater flexibility,
investigate show_trace() and friends.

Hope this helps,
Muli
--
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

"the nucleus of linux oscillates my world" - gccbot@#offtopic


Attachments:
(No filename) (441.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments

2003-11-03 18:51:09

by Roland Dreier

[permalink] [raw]
Subject: Re: How provoke call stack trace

Ihar> Is there any function which can be used by module to
Ihar> just investigate some given call path?

Try dump_stack() (declared in <linux/kernel.h>).

- Roland

2003-11-03 19:32:19

by Ihar 'Philips' Filipau

[permalink] [raw]
Subject: Re: How provoke call stack trace


Thanks to every one!
Already looking into the source code.

P.S.
But it looks like ppc (as of 2.4.22) doesn't implement it.
But still BUG() on ppc prints stack trace... I'm just no specialist
in cpu exception handling. especially on ppc :-(

Ihar 'Philips' Filipau wrote:
> Hello All!
>
> [ Simple question. Probably FAQ - but I cannot find it. ]
>
> How can I print call stack trace, just like BUG() does?
> But without asm(".long 0") as BUG() does.
>
> Is there any function which can be used by module to just investigate
> some given call path?
>

--
Ihar 'Philips' Filipau / with best regards from Saarbruecken.
-- _ _ _
"... and for $64000 question, could you get yourself |_|*|_|
vaguely familiar with the notion of on-topic posting?" |_|_|*|
-- Al Viro @ LKML |*|*|*|

2003-11-03 20:26:19

by Ihar 'Philips' Filipau

[permalink] [raw]
Subject: Re: How provoke call stack trace

Muli Ben-Yehuda wrote:
> On Mon, Nov 03, 2003 at 07:38:39PM +0100, Ihar 'Philips' Filipau wrote:
>
>
>> Is there any function which can be used by module to just
>>investigate some given call path?
>
>
> Assuming 2.6, call dump_stack(). If you want greater flexibility,
> investigate show_trace() and friends.
>
> Hope this helps,

I'm sitting right now on 2.4.22 - so no 2.6 nicities.
I actually wanted to have something like this on ppc - but ppc has no
dump_stack() implemented.

Thanks any way.

[ Just checked 2.6 - ppc has dump_stack() now. Nice. It looks like
all archs have implemented it in 2.6. Cool. ]

--
Ihar 'Philips' Filipau / with best regards from Saarbruecken.
-- _ _ _
"... and for $64000 question, could you get yourself |_|*|_|
vaguely familiar with the notion of on-topic posting?" |_|_|*|
-- Al Viro @ LKML |*|*|*|