-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debuginfo: Generate debugging information for function level static variables #13144
Labels
A-debuginfo
Area: Debugging information in compiled programs (DWARF, PDB, etc.)
Comments
Neat! |
bors
added a commit
that referenced
this issue
Mar 29, 2014
Only supports crate level statics. No debug info is generated for function level statics. Closes #9227. As discussed at the end of the comments for #9227, I took an initial stab at adding support for function level statics and decided it would be enough work to warrant being split into a separate issue. See #13144 for the new issue describing the need to add support for function level static variables.
Hm, it seems this may've regressed, because I cannot see even module-level statics in GDB. static OUTSIDE: i32 = 123;
fn main() {
static INSIDE: i32 = 456;
}
|
I believe that the static variables huonw notes above aren't being picked up because they're const folded away, but this appears to be working now. Both module-level and function-local statics are picked up. pub static mut OUTSIDE: i32 = 123;
fn main() {
static mut INSIDE: i32 = 456;
unsafe { (OUTSIDE, INSIDE) };
} generates
|
dingxiangfei2009
pushed a commit
to dingxiangfei2009/rust
that referenced
this issue
Jul 28, 2024
…hat, r=y21 Make restriction lint's use `span_lint_and_then` (i -> p) This migrates a few restriction lints to use `span_lint_and_then`. This change is motivated by rust-lang/rust-clippy#7797. I've also cleaned up some lint message. Mostly minor stuff. For example: suggestions with a longer message than `"try"` now use `SuggestionStyle::ShowAlways` --- cc: rust-lang/rust-clippy#7797 brother PR of: rust-lang/rust-clippy#13136 changelog: none
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Support for crate level static variable debug info will be added once the patch for #9227 lands, but it does not include support for handling statics declared at the function level.
Fundamentally the new
debuginfo::create_global_var_metadata()
function needs to be updated to do the following:The "correct" way to approach this would be to update
debuginfo::populate_scope_map::walk_decl()
to handle theDeclItem
case forItemStatic
items as is done for function local variables.However, as a consequence of a bug in clang/llvm (see: http://llvm.org/bugs/show_bug.cgi?id=19238), passing the lexical scope metadata from a
debuginfo::FunctionDebugContextData::scope_map
member tollvm::LLVMDIBuilderCreateStaticVariable()
results in a segfault when generating debug information.The suggested work around is to use the function debug info as scope for the variable instead, with the consequence that the generated debug info will be not be entirely correct (similar to the clang case in the bug above).
The text was updated successfully, but these errors were encountered: