1 use super::BackendTypes
;
2 use crate::mir
::debuginfo
::{FunctionDebugContext, VariableKind}
;
3 use rustc_ast
::ast
::Name
;
4 use rustc_hir
::def_id
::CrateNum
;
6 use rustc_middle
::ty
::{Instance, Ty}
;
7 use rustc_span
::{SourceFile, Span}
;
8 use rustc_target
::abi
::call
::FnAbi
;
9 use rustc_target
::abi
::Size
;
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, if it is enabled.
18 fn create_function_debug_context(
20 instance
: Instance
<'tcx
>,
21 fn_abi
: &FnAbi
<'tcx
, Ty
<'tcx
>>,
24 ) -> Option
<FunctionDebugContext
<Self::DIScope
>>;
26 fn extend_scope_to_file(
28 scope_metadata
: Self::DIScope
,
30 defining_crate
: CrateNum
,
32 fn debuginfo_finalize(&self);
34 // FIXME(eddyb) find a common convention for all of the debuginfo-related
35 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
38 dbg_context
: &FunctionDebugContext
<Self::DIScope
>,
40 variable_type
: Ty
<'tcx
>,
41 scope_metadata
: Self::DIScope
,
42 variable_kind
: VariableKind
,
44 ) -> Self::DIVariable
;
47 pub trait DebugInfoBuilderMethods
: BackendTypes
{
48 // FIXME(eddyb) find a common convention for all of the debuginfo-related
49 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
52 dbg_var
: Self::DIVariable
,
53 scope_metadata
: Self::DIScope
,
54 variable_alloca
: Self::Value
,
56 // NB: each offset implies a deref (i.e. they're steps in a pointer chain).
57 indirect_offsets
: &[Size
],
60 fn set_source_location(&mut self, scope
: Self::DIScope
, span
: Span
);
61 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
62 fn set_var_name(&mut self, value
: Self::Value
, name
: &str);