diff options
author | José Valim <[email protected]> | 2017-03-08 13:25:35 +0100 |
---|---|---|
committer | José Valim <[email protected]> | 2017-04-25 13:24:22 +0200 |
commit | dfb899c0229f7ff7dbfad34d496e0429562728bf (patch) | |
tree | cfe4bd8963e33651e7552092dbd22d76492917e1 /lib/compiler/doc/src | |
parent | 621cedccc78581330b9628c559b0d851c303564f (diff) | |
download | otp-dfb899c0229f7ff7dbfad34d496e0429562728bf.tar.gz otp-dfb899c0229f7ff7dbfad34d496e0429562728bf.tar.bz2 otp-dfb899c0229f7ff7dbfad34d496e0429562728bf.zip |
Store abstract code in the Dbgi chunk
The new Dbgi chunk returns data in the following format:
{debug_info_v1, Backend, Data}
This allows compilers to store the debug info in different
formats. In order to retrieve a particular format, for
instance, Erlang Abstract Format, one may invoke:
Backend:debug_info(erlang_v1, Module, Data, Opts)
Besides introducing the chunk above, this commit also:
* Changes beam_lib:chunk(Beam, [:abstract_code]) to
read from the new Dbgi chunk while keeping backwards
compatibility with old .beams
* Adds the {debug_info, {Backend, Data}} option to
compile:file/2 and friends that are stored in the
Dbgi chunk. This allows the debug info encryption
mechanism to work across compilers
* Improves dialyzer to work directly on Core Erlang,
allowing languages that do not have the Erlang
Abstract Format to be dialyzer as long as they emit
the new chunk and their backend implementation is
available
Backwards compatibility is kept across the board except
for those calling beam_lib:chunk(Beam, ["Abst"]), as the
old chunk is no longer available. Note however the "Abst"
chunk has always been optional.
Future OTP versions may remove parsing the "Abst" chunk
altogether from beam_lib once Erlang 19 and earlier is no
longer supported.
The current Dialyzer implementation still supports earlier
.beam files and such may also be removed in future versions.
Diffstat (limited to 'lib/compiler/doc/src')
-rw-r--r-- | lib/compiler/doc/src/compile.xml | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml index ed04dac1c0..94bda0d5e3 100644 --- a/lib/compiler/doc/src/compile.xml +++ b/lib/compiler/doc/src/compile.xml @@ -132,12 +132,10 @@ <tag><c>debug_info</c></tag> <item> <marker id="debug_info"></marker> - <p>Includes debug information in the form of abstract code - (see - <seealso marker="erts:absform">The Abstract Format</seealso> - in ERTS User's Guide) in the compiled beam module. Tools - such as Debugger, Xref, and Cover require - the debug information to be included.</p> + <p>Includes debug information in the form of <seealso marker="erts:absform"> + Erlang Abstract Format</seealso> in the <c>debug_info</c> + chunk of the compiled beam module. Tools such as Debugger, + Xref, and Cover require the debug information to be included.</p> <p><em>Warning</em>: Source code can be reconstructed from the debug information. Use encrypted debug information @@ -147,6 +145,21 @@ <seealso marker="stdlib:beam_lib#debug_info">beam_lib(3)</seealso>.</p> </item> + <tag><c>{debug_info, {Backend, Data}}</c></tag> + <item> + <marker id="debug_info"></marker> + <p>Includes custom debug information in the form of a + <c>Backend</c> module with custom <c>Data</c> in the compiled beam module. + The given module must implement a <c>debug_info/4</c> function + and is responsible for generating different code representations, + as described in the <c>debug_info</c> under + <seealso marker="stdlib:beam_lib#debug_info">beam_lib(3)</seealso>.</p> + + <p><em>Warning</em>: Source code can be reconstructed from + the debug information. Use encrypted debug information + (<c>encrypt_debug_info</c>) to prevent this.</p> + </item> + <tag><c>{debug_info_key,KeyString}</c></tag> <item></item> <tag><c>{debug_info_key,{Mode,KeyString}}</c></tag> |