[erlang-questions] I need to call unexported functions from theerlang shell
Ulf Wiger (TN/EAB)
Fri Jun 15 19:07:35 CEST 2007
I've been thinking that this should be quite doable
as long as the abstract code is available.
(Note also that the debug_info can be encrypted to
protect it from outsiders).
I wrote a small module that fetches the abstract
code and evaluates functions in it.
It's short, so I've attached it.
> -----Original Message-----
> From: erlang-questions-bounces@REDACTED
> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of
> Scott Lystig Fritchie
> Sent: den 15 juni 2007 18:50
> To: erlang-questions@REDACTED
> Subject: Re: [erlang-questions] I need to call unexported
> functions from theerlang shell
> >>>>> "kw" == =?ISO-8859-1?Q?Claes Wikstr=F6m?= <ISO-8859-1> writes:
> kw> I sympathize with Luke here. Debugging live systems,
> being able to
> kw> call non exported functions from the shell is often ... well
> kw> necessary.
> Now that I've had an Erlang app running in someone else's
> data center, I have also run into that situation, and have
> really wished I could call non-exported functions.
> Would it be any less icky to create a new BIF to work around
> the problem?
> erlang:apply(Function::atom(), Args::list(term()))
> ... where Function must be in the caller's module and thus
> can act like any function in a module calling any other
> function in that module? Then each source module would have
> added (via -include() or
> whatever) one more exported function:
> trap_door(Function, Args) ->
> erlang:apply(Function, Args).
> I see that Luke keeps mumbling something about the R9C-0 release.
> Adding such a BIF to VMs in the field could be, er, an
> interesting trick. :-)
> erlang-questions mailing list
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3676 bytes
More information about the erlang-questions