1 use super::BackendTypes;
2 use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
4 use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty};
5 use rustc_span::{SourceFile, Span, Symbol};
6 use rustc_target::abi::call::FnAbi;
7 use rustc_target::abi::Size;
9 pub trait DebugInfoMethods<'tcx>: BackendTypes {
10 fn create_vtable_debuginfo(
13 trait_ref: Option<PolyExistentialTraitRef<'tcx>>,
17 /// Creates the function-specific debug context.
19 /// Returns the FunctionDebugContext for the function which holds state needed
20 /// for debug info creation, if it is enabled.
21 fn create_function_debug_context(
23 instance: Instance<'tcx>,
24 fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
26 mir: &mir::Body<'tcx>,
27 ) -> Option<FunctionDebugContext<Self::DIScope, Self::DILocation>>;
29 // FIXME(eddyb) find a common convention for all of the debuginfo-related
30 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
33 instance: Instance<'tcx>,
34 fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
35 maybe_definition_llfn: Option<Self::Function>,
41 inlined_at: Option<Self::DILocation>,
43 ) -> Self::DILocation;
45 fn extend_scope_to_file(
47 scope_metadata: Self::DIScope,
50 fn debuginfo_finalize(&self);
52 // FIXME(eddyb) find a common convention for all of the debuginfo-related
53 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
56 variable_name: Symbol,
57 variable_type: Ty<'tcx>,
58 scope_metadata: Self::DIScope,
59 variable_kind: VariableKind,
61 ) -> Self::DIVariable;
64 pub trait DebugInfoBuilderMethods: BackendTypes {
65 // FIXME(eddyb) find a common convention for all of the debuginfo-related
66 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
69 dbg_var: Self::DIVariable,
70 dbg_loc: Self::DILocation,
71 variable_alloca: Self::Value,
73 // NB: each offset implies a deref (i.e. they're steps in a pointer chain).
74 indirect_offsets: &[Size],
76 fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation);
77 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
78 fn set_var_name(&mut self, value: Self::Value, name: &str);