2018-11-24 15:30:29 +00:00
|
|
|
use super::BackendTypes;
|
2019-09-12 09:29:46 +00:00
|
|
|
use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
|
2020-03-29 14:41:09 +00:00
|
|
|
use rustc_middle::mir;
|
|
|
|
use rustc_middle::ty::{Instance, Ty};
|
2020-04-19 11:00:18 +00:00
|
|
|
use rustc_span::{SourceFile, Span, Symbol};
|
2019-10-29 18:01:31 +00:00
|
|
|
use rustc_target::abi::call::FnAbi;
|
2020-03-31 16:16:47 +00:00
|
|
|
use rustc_target::abi::Size;
|
2018-09-13 12:58:19 +00:00
|
|
|
|
2018-11-24 15:30:29 +00:00
|
|
|
pub trait DebugInfoMethods<'tcx>: BackendTypes {
|
2018-09-13 12:58:19 +00:00
|
|
|
fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);
|
2018-09-24 15:35:39 +00:00
|
|
|
|
|
|
|
/// Creates the function-specific debug context.
|
|
|
|
///
|
|
|
|
/// Returns the FunctionDebugContext for the function which holds state needed
|
2019-09-11 14:52:39 +00:00
|
|
|
/// for debug info creation, if it is enabled.
|
2018-09-20 13:47:22 +00:00
|
|
|
fn create_function_debug_context(
|
|
|
|
&self,
|
|
|
|
instance: Instance<'tcx>,
|
2019-10-29 18:01:31 +00:00
|
|
|
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
2019-10-13 09:28:19 +00:00
|
|
|
llfn: Self::Function,
|
2020-02-10 23:27:33 +00:00
|
|
|
mir: &mir::Body<'tcx>,
|
|
|
|
) -> Option<FunctionDebugContext<Self::DIScope, Self::DILocation>>;
|
2018-09-24 15:35:39 +00:00
|
|
|
|
2020-02-10 20:30:51 +00:00
|
|
|
// FIXME(eddyb) find a common convention for all of the debuginfo-related
|
|
|
|
// names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
|
|
|
|
fn dbg_scope_fn(
|
|
|
|
&self,
|
|
|
|
instance: Instance<'tcx>,
|
|
|
|
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
|
|
|
maybe_definition_llfn: Option<Self::Function>,
|
|
|
|
) -> Self::DIScope;
|
|
|
|
|
2020-02-10 23:27:33 +00:00
|
|
|
fn dbg_loc(
|
|
|
|
&self,
|
|
|
|
scope: Self::DIScope,
|
|
|
|
inlined_at: Option<Self::DILocation>,
|
|
|
|
span: Span,
|
|
|
|
) -> Self::DILocation;
|
2020-02-10 20:52:30 +00:00
|
|
|
|
2018-09-20 13:47:22 +00:00
|
|
|
fn extend_scope_to_file(
|
|
|
|
&self,
|
|
|
|
scope_metadata: Self::DIScope,
|
|
|
|
file: &SourceFile,
|
|
|
|
) -> Self::DIScope;
|
2018-09-26 15:00:01 +00:00
|
|
|
fn debuginfo_finalize(&self);
|
2018-09-20 13:47:22 +00:00
|
|
|
|
2020-01-26 16:50:13 +00:00
|
|
|
// FIXME(eddyb) find a common convention for all of the debuginfo-related
|
|
|
|
// names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
|
|
|
|
fn create_dbg_var(
|
|
|
|
&self,
|
2020-04-19 11:00:18 +00:00
|
|
|
variable_name: Symbol,
|
2018-09-20 13:47:22 +00:00
|
|
|
variable_type: Ty<'tcx>,
|
|
|
|
scope_metadata: Self::DIScope,
|
2020-01-26 16:50:13 +00:00
|
|
|
variable_kind: VariableKind,
|
|
|
|
span: Span,
|
|
|
|
) -> Self::DIVariable;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait DebugInfoBuilderMethods: BackendTypes {
|
|
|
|
// FIXME(eddyb) find a common convention for all of the debuginfo-related
|
|
|
|
// names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
|
|
|
|
fn dbg_var_addr(
|
|
|
|
&mut self,
|
|
|
|
dbg_var: Self::DIVariable,
|
2020-02-10 20:52:30 +00:00
|
|
|
dbg_loc: Self::DILocation,
|
2019-09-12 09:29:46 +00:00
|
|
|
variable_alloca: Self::Value,
|
|
|
|
direct_offset: Size,
|
|
|
|
// NB: each offset implies a deref (i.e. they're steps in a pointer chain).
|
|
|
|
indirect_offsets: &[Size],
|
2018-09-20 13:47:22 +00:00
|
|
|
);
|
2020-02-10 20:52:30 +00:00
|
|
|
fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation);
|
2018-10-05 13:08:49 +00:00
|
|
|
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
|
2019-10-22 09:36:00 +00:00
|
|
|
fn set_var_name(&mut self, value: Self::Value, name: &str);
|
2018-09-13 12:58:19 +00:00
|
|
|
}
|