Erlang rr()返回缺少的\u块
wings 3d shell使用erlang的新手问题(windows 7 pro,wings 3d 1.4.1)。当我写入读取记录定义的命令时:Erlang rr()返回缺少的\u块,erlang,Erlang,wings 3d shell使用erlang的新手问题(windows 7 pro,wings 3d 1.4.1)。当我写入读取记录定义的命令时: rr(wings). 我总是会出错: {error,beam_lib, {missing_chunk,'d:/temp/erlang/lib/wings/ebin/wings.beam',"Abst"}} 我做错了什么?rr/1“从模块的BEAM文件读取记录定义。如果BEAM文件中没有记录定义,则定位并读取源文件。”
rr(wings).
我总是会出错:
{error,beam_lib,
{missing_chunk,'d:/temp/erlang/lib/wings/ebin/wings.beam',"Abst"}}
我做错了什么?rr/1“从模块的BEAM文件读取记录定义。如果BEAM文件中没有记录定义,则定位并读取源文件。”
我的猜测是,.BEAM文件中没有包含抽象形式,并且在您的安装中,源文件不可用
更新:深入查看shell:read\u file\u records/2
函数,我发现了以下内容:
read_file_records(File, Opts) ->
case filename:extension(File) of
".beam" ->
case beam_lib:chunks(File, [abstract_code,"CInf"]) of
{ok,{_Mod,[{abstract_code,{Version,Forms}},{"CInf",CB}]}} ->
case record_attrs(Forms) of
[] when Version =:= raw_abstract_v1 ->
[];
[] ->
%% If the version is raw_X, then this test
%% is unnecessary.
try_source(File, CB);
Records ->
Records
end;
{ok,{_Mod,[{abstract_code,no_abstract_code},{"CInf",CB}]}} ->
try_source(File, CB);
Error ->
%% Could be that the "Abst" chunk is missing (pre R6).
Error
end;
_ ->
parse_file(File, Opts)
end.
看起来,如果“abs”块丢失,它甚至不会尝试读取源代码。beam\u lib:chunk(文件,[abstract\u code,“CInf”])
为您返回了什么?您正在运行哪个Erlang版本?rr/1“从模块的BEAM文件读取记录定义。如果BEAM文件中没有记录定义,则定位并读取源文件。”
我的猜测是,.BEAM文件中没有包含抽象形式,并且在您的安装中,源文件不可用
更新:深入查看shell:read\u file\u records/2
函数,我发现了以下内容:
read_file_records(File, Opts) ->
case filename:extension(File) of
".beam" ->
case beam_lib:chunks(File, [abstract_code,"CInf"]) of
{ok,{_Mod,[{abstract_code,{Version,Forms}},{"CInf",CB}]}} ->
case record_attrs(Forms) of
[] when Version =:= raw_abstract_v1 ->
[];
[] ->
%% If the version is raw_X, then this test
%% is unnecessary.
try_source(File, CB);
Records ->
Records
end;
{ok,{_Mod,[{abstract_code,no_abstract_code},{"CInf",CB}]}} ->
try_source(File, CB);
Error ->
%% Could be that the "Abst" chunk is missing (pre R6).
Error
end;
_ ->
parse_file(File, Opts)
end.
看起来,如果“abs”块丢失,它甚至不会尝试读取源代码。
beam\u lib:chunk(文件,[abstract\u code,“CInf”])
为您返回了什么?您正在运行哪个Erlang版本?rr/1需要实际的文件名或文件名的相对路径。像这样:
rr("wings.hrl").
OR
rr("./apps/MYAPP-1.0/include/my_include_file.hrl").
OR
rr("./src/wings.erl").
rr(“wings.hrl”)。
或
rr(“./apps/MYAPP-1.0/include/my_include_file.hrl”)。
或
rr(“./src/wings.erl”)。
换句话说,将实际相对路径从
pwd()
传递给包含定义的文件。rr/1需要实际文件名或文件名的相对路径。像这样:
rr("wings.hrl").
OR
rr("./apps/MYAPP-1.0/include/my_include_file.hrl").
OR
rr("./src/wings.erl").
rr(“wings.hrl”)。
或
rr(“./apps/MYAPP-1.0/include/my_include_file.hrl”)。
或
rr(“./src/wings.erl”)。
换句话说,将从pwd()
到包含定义的文件的实际相对路径传递给它。我正在使用:
Erlang R14B01 (erts-5.8.2) [rq:1] [async-threads:0]
Eshell V5.8.2 (abort with ^G)
称之为这很好:
rr("d:/temp/erlang/src/wings.hrl").
电话:
beam_lib:chunks("wings", [abstract_code,"CInf"]).
返回:
{error,beam_lib,{file_error,"wings.beam",enoent}}
我正在使用:
Erlang R14B01 (erts-5.8.2) [rq:1] [async-threads:0]
Eshell V5.8.2 (abort with ^G)
称之为这很好:
rr("d:/temp/erlang/src/wings.hrl").
电话:
beam_lib:chunks("wings", [abstract_code,"CInf"]).
返回:
{error,beam_lib,{file_error,"wings.beam",enoent}}
还有一个rr/1的变体,它接受atom,这就是@mbr所使用的。rr(“wings.hrl”)应该允许他读取记录定义,但最好能理解为什么该变体不起作用。这就造成了文件路径问题。否则,这意味着功能rr/1有副作用。这可能是哪一个?还有一个rr/1的变体,它接受一个原子,这就是@mbr所使用的。rr(“wings.hrl”)应该允许他读取记录定义,但最好能理解为什么该变体不起作用。这就造成了文件路径问题。否则,这意味着功能rr/1有副作用。这可能是哪一个?这一定是路径问题。是D:或D:上的.hrl文件,windows驱动器可能区分大小写。这一定是路径问题。是D:或D:上的.hrl文件,windows驱动器可以区分大小写。