Stream: t-compiler/help

Topic: debuginfo-level


Santiago Pastorino (Jun 07 2019 at 12:04, on Zulip):

I saw a while ago some changes to the way the configuration now works

Santiago Pastorino (Jun 07 2019 at 12:05, on Zulip):

https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html suggest to set debuginfo-level to 2

Santiago Pastorino (Jun 07 2019 at 12:05, on Zulip):

I was wondering if shouldn't that recommend to set debug = true

Santiago Pastorino (Jun 07 2019 at 12:06, on Zulip):

the effect should be the same

Santiago Pastorino (Jun 07 2019 at 12:07, on Zulip):

in particular this was made on purpose #debuginfo-level = if debug { 2 } else { 0 }

Santiago Pastorino (Jun 07 2019 at 12:07, on Zulip):

so by doing debug = true we play nice with the file and not go against

Santiago Pastorino (Jun 07 2019 at 12:07, on Zulip):

/cc @nikomatsakis

Santiago Pastorino (Jun 07 2019 at 12:07, on Zulip):

anyway, probably just a silly bikesheed from my side

Santiago Pastorino (Jun 07 2019 at 17:25, on Zulip):

/cc @mark-i-m

mark-i-m (Jun 07 2019 at 20:31, on Zulip):

hmmm... yeah that seems reasonable

mark-i-m (Jun 07 2019 at 20:34, on Zulip):

https://github.com/rust-lang/rustc-guide/pull/332

mark-i-m (Jun 07 2019 at 20:34, on Zulip):

@Santiago Pastorino ^^

Santiago Pastorino (Jun 07 2019 at 20:36, on Zulip):

:+1:

Santiago Pastorino (Jun 07 2019 at 20:36, on Zulip):

as soon as check are ok, I can merge it :)

Santiago Pastorino (Jun 07 2019 at 20:38, on Zulip):

@mark-i-m was looking for the suggestion here https://rust-lang.github.io/rustc-guide/profiling/with_perf.html

Santiago Pastorino (Jun 07 2019 at 20:39, on Zulip):

but yeah, I guess you want 1 there and not 2 as it is when you're debugging

Santiago Pastorino (Jun 07 2019 at 20:41, on Zulip):

also src/compiler-debugging.md

Santiago Pastorino (Jun 07 2019 at 20:41, on Zulip):
If you want line numbers for the stack trace, you can enable
`debuginfo-level = 1` or `debuginfo-level = 2` in your config.toml and rebuild the
compiler. Then the backtrace will look like this:
Santiago Pastorino (Jun 07 2019 at 20:42, on Zulip):

src/codegen/debugging.md

Santiago Pastorino (Jun 07 2019 at 20:42, on Zulip):
`cargo llvm-ir [options] path` spits out the LLVM IR for a particular function
at `path`. (`cargo install cargo-asm` installs `cargo asm` and `cargo
llvm-ir`). `--build-type=debug` emits code for debug builds. There are also
other useful options. Also, debug info in LLVM IR can clutter the output a lot:
`RUSTFLAGS="-C debuginfo=0"` is really useful.
Santiago Pastorino (Jun 07 2019 at 20:42, on Zulip):

maybe here is better to say -C debug=false

mark-i-m (Jun 07 2019 at 20:43, on Zulip):

Ah, I see

mark-i-m (Jun 07 2019 at 20:43, on Zulip):

In the case of perf, I think you want to have minimal debuginfo to avoid overhead skewing the results

Santiago Pastorino (Jun 07 2019 at 20:44, on Zulip):

yep, agreed

mark-i-m (Jun 07 2019 at 20:44, on Zulip):

(thought TBH I don't know if that's a problem in practice)

mark-i-m (Jun 07 2019 at 20:44, on Zulip):

I agree that the others should suggest debug=true/false, though

mark-i-m (Jun 07 2019 at 20:44, on Zulip):

I will update the PR

mark-i-m (Jun 07 2019 at 20:57, on Zulip):

maybe here is better to say -C debug=false

Actually this is a compiler flag, not a config option...

mark-i-m (Jun 07 2019 at 20:57, on Zulip):

I opened a new PR because github was being weird

mark-i-m (Jun 07 2019 at 20:58, on Zulip):

should include the previous change and the change to src/compiler-debugging.md that you pointed out

mark-i-m (Jun 07 2019 at 20:58, on Zulip):

@Santiago Pastorino https://github.com/rust-lang/rustc-guide/pull/333

Santiago Pastorino (Jun 07 2019 at 20:59, on Zulip):

maybe here is better to say -C debug=false

Actually this is a compiler flag, not a config option...

right

Last update: Nov 11 2019 at 22:00UTC