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
;
11 pub trait DebugInfoMethods
<'tcx
>: BackendTypes
{
12 fn create_vtable_debuginfo(
15 trait_ref
: Option
<PolyExistentialTraitRef
<'tcx
>>,
19 /// Creates the function-specific debug context.
21 /// Returns the FunctionDebugContext for the function which holds state needed
22 /// for debug info creation, if it is enabled.
23 fn create_function_debug_context(
25 instance
: Instance
<'tcx
>,
26 fn_abi
: &FnAbi
<'tcx
, Ty
<'tcx
>>,
28 mir
: &mir
::Body
<'tcx
>,
29 ) -> Option
<FunctionDebugContext
<'tcx
, Self::DIScope
, Self::DILocation
>>;
31 // FIXME(eddyb) find a common convention for all of the debuginfo-related
32 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
35 instance
: Instance
<'tcx
>,
36 fn_abi
: &FnAbi
<'tcx
, Ty
<'tcx
>>,
37 maybe_definition_llfn
: Option
<Self::Function
>,
43 inlined_at
: Option
<Self::DILocation
>,
45 ) -> Self::DILocation
;
47 fn extend_scope_to_file(
49 scope_metadata
: Self::DIScope
,
52 fn debuginfo_finalize(&self);
54 // FIXME(eddyb) find a common convention for all of the debuginfo-related
55 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
58 variable_name
: Symbol
,
59 variable_type
: Ty
<'tcx
>,
60 scope_metadata
: Self::DIScope
,
61 variable_kind
: VariableKind
,
63 ) -> Self::DIVariable
;
66 pub trait DebugInfoBuilderMethods
: BackendTypes
{
67 // FIXME(eddyb) find a common convention for all of the debuginfo-related
68 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
71 dbg_var
: Self::DIVariable
,
72 dbg_loc
: Self::DILocation
,
73 variable_alloca
: Self::Value
,
75 // NB: each offset implies a deref (i.e. they're steps in a pointer chain).
76 indirect_offsets
: &[Size
],
77 // Byte range in the `dbg_var` covered by this fragment,
78 // if this is a fragment of a composite `DIVariable`.
79 fragment
: Option
<Range
<Size
>>,
81 fn set_dbg_loc(&mut self, dbg_loc
: Self::DILocation
);
82 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
83 fn set_var_name(&mut self, value
: Self::Value
, name
: &str);