-
Notifications
You must be signed in to change notification settings - Fork 90
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: embed gdb visualizers in module #1462
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,23 @@ impl DebugContext { | |
} | ||
Ok(()) | ||
}); | ||
|
||
self.add_gdb_debugger_visualizers(product); | ||
} | ||
|
||
fn add_gdb_debugger_visualizers(&mut self, product: &mut ObjectProduct) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If https://github.com/rust-lang/rust/blob/7606c13961ddc1174b70638e934df0439b7dc515/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs#L85-L117 returns false you need to skip adding the section. |
||
let mut section = WriterRelocate::new(self.endian); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to go through |
||
section.write(b"\x01gdb_load_rust_pretty_printers.py\0").unwrap(); | ||
|
||
for (index, visualizer) in self.gdb_visualizers.iter().enumerate() { | ||
let vis_name = format!("\x04pretty-printer-{}-{index}\n", self.crate_name); | ||
|
||
section.write(vis_name.as_bytes()).unwrap(); | ||
section.write(&visualizer.src).unwrap(); | ||
|
||
section.write(b"\0").unwrap(); | ||
} | ||
product.add_gdb_visualizers_section(section.writer.take()); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function needs to be called at
rustc_codegen_cranelift/src/main_shim.rs
Line 40 in 8c46d93