int:find_src/2, shell:try_source/2 ignore the obvious place to find source files?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

int:find_src/2, shell:try_source/2 ignore the obvious place to find source files?

Roger Lipscombe-2
When compiling some Erlang source files with mix, I discovered that it leaves out the abstract_code chunk.

This means that rr(Mod) -- implemented in shell:read_file_records/2 -- falls through to shell:try_source/2, which looks in the "CInf" chunk. It then uses the 'options'.'outdir' value and attempts to recreate the source path from that.

That is: given the following:

[{options, [{outdir, "/home/roger/Source/foo/bar/_build/dev/lib/baz/ebin"},
           {i,"include"}]},
 {version,"7.0.4"},
 {source,"/home/roger/Source/foo/bar/baz/src/quux.erl"}]

...it'll look for "/home/roger/Source/foo/bar/_build/dev/lib/baz/ebin/quux.erl" and "/home/roger/Source/foo/bar/_build/dev/lib/baz/src/quux.erl", which don't exist.

int:find_src/2 does the same.

It seems to me that the correct behaviour would be to use the 'source' property, if present...?


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: int:find_src/2, shell:try_source/2 ignore the obvious place to find source files?

Roger Lipscombe-2
Some clarifications...

On 30 May 2017 at 15:45, Roger Lipscombe <[hidden email]> wrote:
When compiling some Erlang source files with mix, I discovered that it leaves out the abstract_code chunk.

or: ...when compiling some Erlang source files with mix, with custom erlc_options that omit :debug_info, it leaves out the abstract_code chunk.

or: ...when compiling Erlang source files without 'debug_info', when the output directory isn't just 'src' replaced with 'ebin' (i.e. rebar3 or mix behaviour...).
 
This means that rr(Mod) -- implemented in shell:read_file_records/2 -- falls through to shell:try_source/2, which looks in the "CInf" chunk. It then uses the 'options'.'outdir' value and attempts to recreate the source path from that.

That is: given the following:

...result from Baz:module_info(compile)...


[{options, [{outdir, "/home/roger/Source/foo/bar/_build/dev/lib/baz/ebin"},
           {i,"include"}]},
 {version,"7.0.4"},
 {source,"/home/roger/Source/foo/bar/baz/src/quux.erl"}]

(or, equivalently, the "CInf" chunk)

...it'll look for "/home/roger/Source/foo/bar/_build/dev/lib/baz/ebin/quux.erl" and "/home/roger/Source/foo/bar/_build/dev/lib/baz/src/quux.erl", which don't exist.

int:find_src/2 does the same.

It seems to me that the correct behaviour would be to use the 'source' property, if present...?


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...