debugger

Ulf Wiger <>
Sun Jun 9 21:51:48 CEST 2002


On 9 Jun 2002, Lyn A Headley wrote:

>The interpret request fails and says the module must be purged before
>loading.  Ok fine.  code:purge(cothink).  Try again.  Same error!

>()4> code:purge(cothink).
>false
>()5> c(cothink, debug_info).
>{ok,cothink}
>()6> debugger:start().
><0.73.0>
>()7>
>=ERROR REPORT==== 9-Jun-2002::11:32:27 ===
>Module cothink must be purged before loading

When you run c(cothink, debug_info), the module is automatically
loaded. The c() function compiles _and_ loads the file.
>From c.erl:

c(File, Opt) when atom(Opt) -> c(File, [Opt]);
c(File, Opts0) ->
    Opts = [report_errors,report_warnings|Opts0],
    case compile:file(File, Opts) of
        {ok,Mod} ->                             %Listing file.
            machine_load(Mod, File, Opts);
        {ok,Mod,Ws} ->                          %Warnings ...
            machine_load(Mod, File, Opts);
        Other ->                                %Errors go here
            Other
    end.


If you want to compile, but not load, a file, use
compile:file(File, Options) - in this case:

  compile:file(File, [debug_info]).

(I know that compile:file(File, debug_info) works, but I don't
like it, partly because compile.erl only recognizes singleton
options that are atoms -- so it's inconsistent -- and partly
because it is, as far as I can tell, an undocumented feature.)

/Uffe
-- 
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson Telecom AB, ATM Multiservice Networks




More information about the erlang-questions mailing list