Skip to content

Commit 8bfc641

Browse files
committed
More in-depth documentation for the new debuginfo options
1 parent 029f485 commit 8bfc641

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+10
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,16 @@ pub mod debuginfo {
877877

878878
impl DebugEmissionKind {
879879
pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
880+
// We should be setting LLVM's emission kind to `LineTablesOnly` if
881+
// we are compiling with "limited" debuginfo. However, some of the
882+
// existing tools relied on slightly more debuginfo being generated than
883+
// would be the case with `LineTablesOnly`, and we did not want to break
884+
// these tools in a "drive-by fix", without a good idea or plan about
885+
// what limited debuginfo should exactly look like. So for now we are
886+
// instead adding a new debuginfo option "line-tables-only" so as to
887+
// not break anything and to allow users to have 'limited' debug info.
888+
//
889+
// See https://github.com/rust-lang/rust/issues/60020 for details.
880890
use rustc_session::config::DebugInfo;
881891
match kind {
882892
DebugInfo::None => DebugEmissionKind::NoDebug,

src/doc/rustc/src/codegen-options/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ This flag controls the generation of debug information. It takes one of the
7272
following values:
7373

7474
* `0` or `none`: no debug info at all (the default).
75-
* `line-directives-only`: line info directives only.
76-
* `line-tables-only`: line tables only.
75+
* `line-directives-only`: line info directives only, (For the nvptx* targets this enables [profiling](https://reviews.llvm.org/D46061), but on other targets the behavior is unspecified).
76+
* `line-tables-only`: line tables only, (Generates the minimal amount of debug info for backtraces with filename/line number info, but not anything else, i.e. variable or function parameter info).
7777
* `1` or `limited`: debug info without type information.
7878
* `2` or `full`: full debug info.
7979

src/test/codegen/debug-limited.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Verify that the limited debuginfo option emits llvm's FullDebugInfo, but no type info.
22
//
3-
// ignore-windows
43
// compile-flags: -C debuginfo=limited
54

65
#[repr(C)]
76
struct StructType {
87
a: i64,
9-
b: i32
8+
b: i32,
109
}
1110

1211
extern "C" {
@@ -16,7 +15,7 @@ extern "C" {
1615

1716
fn main() {
1817
unsafe {
19-
let value: &mut StructType = &mut* creator();
18+
let value: &mut StructType = &mut *creator();
2019
value.a = 7;
2120
save(value as *const StructType)
2221
}

src/test/codegen/debug-line-directives-only.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Verify that the only debuginfo generated are the line directives.
22
//
3-
// ignore-windows
43
// compile-flags: -C debuginfo=line-directives-only
54

65
#[repr(C)]
76
struct StructType {
87
a: i64,
9-
b: i32
8+
b: i32,
109
}
1110

1211
extern "C" {
@@ -16,7 +15,7 @@ extern "C" {
1615

1716
fn main() {
1817
unsafe {
19-
let value: &mut StructType = &mut* creator();
18+
let value: &mut StructType = &mut *creator();
2019
value.a = 7;
2120
save(value as *const StructType)
2221
}

src/test/codegen/debug-line-tables-only.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Verify that the only debuginfo generated are the line tables.
22
//
3-
// ignore-windows
43
// compile-flags: -C debuginfo=line-tables-only
54

65
#[repr(C)]
76
struct StructType {
87
a: i64,
9-
b: i32
8+
b: i32,
109
}
1110

1211
extern "C" {
@@ -16,7 +15,7 @@ extern "C" {
1615

1716
fn main() {
1817
unsafe {
19-
let value: &mut StructType = &mut* creator();
18+
let value: &mut StructType = &mut *creator();
2019
value.a = 7;
2120
save(value as *const StructType)
2221
}

0 commit comments

Comments
 (0)