1 use super::BackendTypes;
2 use crate::debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind};
3 use rustc::hir::def_id::CrateNum;
5 use rustc::ty::{self, Ty};
6 use rustc_data_structures::indexed_vec::IndexVec;
7 use rustc_mir::monomorphize::Instance;
9 use syntax_pos::{SourceFile, Span};
11 pub trait DebugInfoMethods<'tcx>: BackendTypes {
12 fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);
14 /// Creates the function-specific debug context.
16 /// Returns the FunctionDebugContext for the function which holds state needed
17 /// for debug info creation. The function may also return another variant of the
18 /// FunctionDebugContext enum which indicates why no debuginfo should be created
20 fn create_function_debug_context(
22 instance: Instance<'tcx>,
26 ) -> FunctionDebugContext<Self::DIScope>;
31 debug_context: &mut FunctionDebugContext<Self::DIScope>,
32 ) -> IndexVec<mir::SourceScope, MirDebugScope<Self::DIScope>>;
33 fn extend_scope_to_file(
35 scope_metadata: Self::DIScope,
37 defining_crate: CrateNum,
39 fn debuginfo_finalize(&self);
40 fn debuginfo_upvar_ops_sequence(&self, byte_offset_of_var_in_env: u64) -> [i64; 4];
43 pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes {
46 dbg_context: &FunctionDebugContext<Self::DIScope>,
48 variable_type: Ty<'tcx>,
49 scope_metadata: Self::DIScope,
50 variable_access: VariableAccess<'_, Self::Value>,
51 variable_kind: VariableKind,
54 fn set_source_location(
56 debug_context: &mut FunctionDebugContext<Self::DIScope>,
57 scope: Option<Self::DIScope>,
60 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
61 fn set_value_name(&mut self, value: Self::Value, name: &str);