Skip to content

Commit 5d5311d

Browse files
Added overview of the debuginfo module at the beginning of debuginfo.rs.
1 parent 7375e94 commit 5d5311d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/librustc/middle/trans/debuginfo.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
/*!
12+
# Debug Info Module
13+
14+
This module serves the purpose of generating debug symbols. We use LLVM's
15+
[source level debugging](http://llvm.org/docs/SourceLevelDebugging.html) features for generating
16+
the debug information. The general principle is this:
17+
18+
Given the right metadata in the LLVM IR, the LLVM code generator is able to create DWARF debug
19+
symbols for the given code. The [metadata](http://llvm.org/docs/LangRef.html#metadata-type) is
20+
structured much like DWARF *debugging information entries* (DIE), representing type information
21+
such as datatype layout, function signatures, block layout, variable location and scope information,
22+
etc. It is the purpose of this module to generate correct metadata and insert it into the LLVM IR.
23+
24+
As the exact format of metadata trees may change between different LLVM versions, we now use LLVM
25+
[DIBuilder](http://llvm.org/docs/doxygen/html/classllvm_1_1DIBuilder.html) which to create metadata
26+
where possible. This will hopefully ease the adaption of this module to future LLVM versions.
27+
28+
The public API of the module is a set of functions that will insert the correct metadata into the
29+
LLVM IR when called with the right parameters. The module is thus driven from an outside client with
30+
function like `debuginfo::create_local_var(bcx: block, local: @ast::local)`.
31+
32+
Internally the module will try to reuse already created metadata by utilizing a cache. All private
33+
state used by the module is stored within a DebugContext struct, which in turn is contained in the
34+
CrateContext.
35+
*/
36+
1137
use core::prelude::*;
1238

1339
use driver::session;

0 commit comments

Comments
 (0)