diff options
| author | ridwanabdillahi <91507758+ridwanabdillahi@users.noreply.github.com> | 2022-04-25 18:02:43 -0700 |
|---|---|---|
| committer | ridwanabdillahi <91507758+ridwanabdillahi@users.noreply.github.com> | 2022-05-03 10:53:54 -0700 |
| commit | 175a4eab84379cebfc230ea357ae02dc9be39660 (patch) | |
| tree | 19f4ae4b9b91cb53e6ee05368127daa4fbc88d33 /compiler/rustc_span/src | |
| parent | e1df625306f4136949e02612406f0c60df6008f3 (diff) | |
| download | rust-175a4eab84379cebfc230ea357ae02dc9be39660.tar.gz rust-175a4eab84379cebfc230ea357ae02dc9be39660.zip | |
Add support for a new attribute `#[debugger_visualizer]` to support embedding debugger visualizers into a generated PDB.
Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries. Merge the queries for debugger visualizers into a single query. Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`. Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate. Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature. Respond to PR comments and minor cleanups.
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/lib.rs | 23 | ||||
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index f22faef2580..14668a3d411 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -71,6 +71,7 @@ use std::hash::Hash; use std::ops::{Add, Range, Sub}; use std::path::{Path, PathBuf}; use std::str::FromStr; +use std::sync::Arc; use md5::Digest; use md5::Md5; @@ -1200,6 +1201,28 @@ impl SourceFileHash { } } +#[derive(HashStable_Generic)] +#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug, Encodable, Decodable)] +pub enum DebuggerVisualizerType { + Natvis, +} + +/// A single debugger visualizer file. +#[derive(HashStable_Generic)] +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable)] +pub struct DebuggerVisualizerFile { + /// The complete debugger visualizer source. + pub src: Arc<[u8]>, + /// Indicates which visualizer type this targets. + pub visualizer_type: DebuggerVisualizerType, +} + +impl DebuggerVisualizerFile { + pub fn new(src: Arc<[u8]>, visualizer_type: DebuggerVisualizerType) -> Self { + DebuggerVisualizerFile { src, visualizer_type } + } +} + /// A single source in the [`SourceMap`]. #[derive(Clone)] pub struct SourceFile { diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index c1299c94c4b..e7149f4a672 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -556,6 +556,7 @@ symbols! { debug_struct, debug_trait_builder, debug_tuple, + debugger_visualizer, decl_macro, declare_lint_pass, decode, @@ -927,6 +928,7 @@ symbols! { native_link_modifiers_bundle, native_link_modifiers_verbatim, native_link_modifiers_whole_archive, + natvis_file, ne, nearbyintf32, nearbyintf64, |
