[erlang-questions] How to best debug init.erl?

Peer Stritzinger <>
Thu Apr 19 21:17:55 CEST 2012


Hi,

2012/4/19 Björn-Egil Dahlberg <>:
> Any change to the files in erts/preloaded are a bit nasty. But not to worry,
> no too nasty. =)
>
> After recompiling init.erl (or any other file in there) and moved it to
> preloaded/ebin you need to remake the emulator. Preloaded, as the name
> suggests, are compiled into the runtime. Specifically you need to recompile
> preloaded.o and relink stuff.
>
> Relevant files:
> ./emulator/i386-apple-darwin11.2.0/preload.c
> ./emulator/i386-apple-darwin11.3.0/preload.c
> ./emulator/obj/i386-apple-darwin11.2.0/opt/plain/preload.o
> ./emulator/obj/i386-apple-darwin11.2.0/opt/smp/preload.o
> ./emulator/obj/i386-apple-darwin11.3.0/opt/plain/preload.o
> ./emulator/obj/i386-apple-darwin11.3.0/opt/smp/preload.o
> ./emulator/utils/make_preload
>
> well subst darwin for your target.

Isn't preload.c being rebuilt when doing ./otp_build boot -a ?


> As for your earlier question, ERTS_SMP is for "enable multiple schedulers",
> with what that entails, i.e. interprocess lockings, multiple runqueues etc.
>
> USE_THREADS are more or less for the async thread pool.

I see.  And the async thread pool probably also wants to know how many
cores there are etc.

At the moment I'm building without USE_THREADS since I'm not sure the
async thread pool will help me much with my kind of OS and a single
core.

However I'm not really grokking the whole async I/O stuff.  At the
moment we only have a rather brittle select implementation but we are
planning to port kqueues API to RTEMS.

> Den 19 april 2012 20:37 skrev Peer Stritzinger <>:
>>
>> Hi,
>>
>> while porting Erlang to a embedded system with the RTEMS os I'm stuck
>> currently with error exits in init.erl
>>
>> Example:
>>
>> {"init terminating in do_boot",{'cannot load',error_handler,get_file}}
>>
>> How can debug stuff like this?
>>
>> I'm loading the OS + Erlang with a JTAG debug box and gdb, debugging
>> the C startup works fine this way but once I'm in Erlang code I'm
>> blind.
>>
>> Currently I'm not getting crash dumps either (crash dumps not yet ported).
>>
>> I'm playing with "print debugging" -- adding erlang:display/1 calls
>> which leads me to another problem and my second question:
>>
>> What do I have to do to rebuild with changes in init.erl ...
>> especially for cross building.
>>
>> The way I'm building now looks like this:
>>
>>  $  ./otp_build autoconf
>>  $  ./otp_build configure
>> --xcomp-conf=xcomp/erl-xcomp-powerpc-rtems.conf --disable-threads
>> --prefix=/otp
>>  $  ./otp_build boot -a
>>  $  rm -rf ~/export/otp; gmake install DESTDIR=$HOME/export
>>
>> The export/otp dir is NFS mounted to the target system.
>>
>> Even if I re-configure the changes in init.erl are not reflected on
>> the target system.
>>
>> Cheers,
>> -- Peer
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>



More information about the erlang-questions mailing list