rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.79k stars 12.5k forks source link

Debugging rust compiler with lldb, unable to display variables #129440

Closed jianghupt closed 2 days ago

jianghupt commented 3 weeks ago

I compiled https://github.com/rust-lang/rust/ ./x.py build --stage2 . And set [rust] debug=true [llvm] assertins=true

Then I debugged it through lldb, and the command :fr v did not display the variables

How should I make lldb display the variables

image

saethlin commented 3 weeks ago

Honestly, you shouldn't.

If you want the kind of debugging your get from a debug build, you need to set

[rust]
optimize = 0

But please read this paragraph: https://github.com/rust-lang/rust/blob/b5723af3457b9cd3795eeb97e9af2d34964854f2/config.example.toml#L460

jianghupt commented 3 weeks ago

Honestly, you shouldn't.

If you want the kind of debugging your get from a debug build, you need to set

[rust]
optimize = 0

But please read this paragraph:

https://github.com/rust-lang/rust/blob/b5723af3457b9cd3795eeb97e9af2d34964854f2/config.example.toml#L460

I tried it, but the variable still cannot be printed. [rust] optimize = false

khuey commented 1 week ago

debug = true isn't really sufficient for an interactive debugging experience. You need debuginfo-level = 2 (the default with debug = true is debuginfo-level = 1) to get variable information.

jianghupt commented 2 days ago

debug = true isn't really sufficient for an interactive debugging experience. You need debuginfo-level = 2 (the default with debug = true is debuginfo-level = 1) to get variable information.

thank you, you are right