[erlang-bugs] Allow code upgrade for the code_server itself

Stavros Aronis aronisstav@REDACTED
Mon Mar 10 23:02:20 CET 2014


Hello!

I am playing around with code instrumentation and trying to hack the code
server so that it applies some transformation whenever it loads *any*
module. The hack itself is relatively simple:

1) Instrument and reload any already loaded modules (come to think about
it, during this process more modules may be loaded, but let's assume a
fixpoint). This is to avoid the case where in order to load A, you have to
instrument A, and the instrumenter itself needs a call to X, which is not
yet loaded so you have to load X, so you have to instrument X, etc...
2) Get the Core Erlang code of the codeserver and wrap the second argument
of erlang:load_module (Line 1264) with a call to my instrumenter (which is
a function from binary() -> binary())
3) Load the patched code_server code
4) Move the code_server process from the old code to the new one.

I am having trouble with the last step. As far as I understand it, the
reason is that the call to system_continue (Line 184) is not qualified, as
is the similar call in sys.erl (Line 324).

Is there a reason why this is so? Is there any possibility for this to be
patched?

Cheers,

Stavros
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140310/2292f566/attachment.htm>


More information about the erlang-bugs mailing list