inspecting the call stack from a program (was: Re: Extending Functionality: an expedient and questionable approa ch)
Chris Pressey
cpressey@REDACTED
Wed Mar 19 19:27:52 CET 2003
On Fri, 14 Mar 2003 14:45:49 -0000
Chandrashekhar Mullaparthi <Chandrashekhar.Mullaparthi@REDACTED>
wrote:
> Another way to look at the stack...but it is not as pretty as what you'd
> see in a crash report.
>
> (camelns@REDACTED)212> erlang:process_display(whereis(cns_server),
> backtrace).
> [...]
Sorry... I should have been more specific. I meant - a way for a program
to inspect the call stack.
I'm currently using this function:
call_stack() ->
{'EXIT', {Error, CallStack}} = (catch 1 = 2),
tl(CallStack).
I find this useful in conjunction with e.g. logging (e.g. in
/jungerl/lib/ce/src/ce_log.erl)
It's just that the "(catch 1 = 2)" strikes me as, uhm, ungraceful :)
-Chris
More information about the erlang-questions
mailing list