Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More in-depth documentation for the new debuginfo options
  • Loading branch information
jdtatz authored and jyn514 committed Mar 31, 2023
commit 7b453b9f5a3b921291fd723067d48fee28e7475b
10 changes: 10 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,16 @@ pub mod debuginfo {

impl DebugEmissionKind {
pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
// We should be setting LLVM's emission kind to `LineTablesOnly` if
// we are compiling with "limited" debuginfo. However, some of the
// existing tools relied on slightly more debuginfo being generated than
// would be the case with `LineTablesOnly`, and we did not want to break
// these tools in a "drive-by fix", without a good idea or plan about
// what limited debuginfo should exactly look like. So for now we are
// instead adding a new debuginfo option "line-tables-only" so as to
// not break anything and to allow users to have 'limited' debug info.
//
// See https://github.com/rust-lang/rust/issues/60020 for details.
use rustc_session::config::DebugInfo;
match kind {
DebugInfo::None => DebugEmissionKind::NoDebug,
Expand Down
4 changes: 2 additions & 2 deletions src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ This flag controls the generation of debug information. It takes one of the
following values:

* `0` or `none`: no debug info at all (the default).
* `line-directives-only`: line info directives only.
* `line-tables-only`: line tables only.
* `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).
* `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).
* `1` or `limited`: debug info without type information.
* `2` or `full`: full debug info.

Expand Down
5 changes: 2 additions & 3 deletions tests/codegen/debug-limited.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Verify that the limited debuginfo option emits llvm's FullDebugInfo, but no type info.
//
// ignore-windows
// compile-flags: -C debuginfo=limited

#[repr(C)]
struct StructType {
a: i64,
b: i32
b: i32,
}

extern "C" {
Expand All @@ -16,7 +15,7 @@ extern "C" {

fn main() {
unsafe {
let value: &mut StructType = &mut* creator();
let value: &mut StructType = &mut *creator();
value.a = 7;
save(value as *const StructType)
}
Expand Down
5 changes: 2 additions & 3 deletions tests/codegen/debug-line-directives-only.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Verify that the only debuginfo generated are the line directives.
//
// ignore-windows
// compile-flags: -C debuginfo=line-directives-only

#[repr(C)]
struct StructType {
a: i64,
b: i32
b: i32,
}

extern "C" {
Expand All @@ -16,7 +15,7 @@ extern "C" {

fn main() {
unsafe {
let value: &mut StructType = &mut* creator();
let value: &mut StructType = &mut *creator();
value.a = 7;
save(value as *const StructType)
}
Expand Down
5 changes: 2 additions & 3 deletions tests/codegen/debug-line-tables-only.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Verify that the only debuginfo generated are the line tables.
//
// ignore-windows
// compile-flags: -C debuginfo=line-tables-only

#[repr(C)]
struct StructType {
a: i64,
b: i32
b: i32,
}

extern "C" {
Expand All @@ -16,7 +15,7 @@ extern "C" {

fn main() {
unsafe {
let value: &mut StructType = &mut* creator();
let value: &mut StructType = &mut *creator();
value.a = 7;
save(value as *const StructType)
}
Expand Down