2018-11-24 16:30:29 +01:00
|
|
|
use super::BackendTypes;
|
2019-09-12 12:29:46 +03:00
|
|
|
use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
|
2018-09-20 15:47:22 +02:00
|
|
|
use rustc::hir::def_id::CrateNum;
|
|
|
|
use rustc::mir;
|
2019-09-12 12:29:46 +03:00
|
|
|
use rustc::ty::layout::Size;
|
2019-12-22 17:42:04 -05:00
|
|
|
use rustc::ty::{Instance, Ty};
|
2019-12-31 20:15:40 +03:00
|
|
|
use rustc_span::{SourceFile, Span};
|
2019-10-29 20:01:31 +02:00
|
|
|
use rustc_target::abi::call::FnAbi;
|
2018-09-20 15:47:22 +02:00
|
|
|
use syntax::ast::Name;
|
2018-09-13 14:58:19 +02:00
|
|
|
|
2018-11-24 16:30:29 +01:00
|
|
|
pub trait DebugInfoMethods<'tcx>: BackendTypes {
|
2018-09-13 14:58:19 +02:00
|
|
|
fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);
|
2018-09-24 17:35:39 +02:00
|
|
|
|
|
|
|
/// Creates the function-specific debug context.
|
|
|
|
///
|
|
|
|
/// Returns the FunctionDebugContext for the function which holds state needed
|
2019-09-11 17:52:39 +03:00
|
|
|
/// for debug info creation, if it is enabled.
|
2018-09-20 15:47:22 +02:00
|
|
|
fn create_function_debug_context(
|
|
|
|
&self,
|
|
|
|
instance: Instance<'tcx>,
|
2019-10-29 20:01:31 +02:00
|
|
|
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
2019-10-13 11:28:19 +02:00
|
|
|
llfn: Self::Function,
|
2019-05-17 23:55:04 +02:00
|
|
|
mir: &mir::Body<'_>,
|
2019-09-11 17:52:39 +03:00
|
|
|
) -> Option<FunctionDebugContext<Self::DIScope>>;
|
2018-09-24 17:35:39 +02:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
fn extend_scope_to_file(
|
|
|
|
&self,
|
|
|
|
scope_metadata: Self::DIScope,
|
|
|
|
file: &SourceFile,
|
|
|
|
defining_crate: CrateNum,
|
|
|
|
) -> Self::DIScope;
|
2018-09-26 17:00:01 +02:00
|
|
|
fn debuginfo_finalize(&self);
|
2018-09-20 15:47:22 +02:00
|
|
|
}
|
|
|
|
|
2018-11-24 16:30:29 +01:00
|
|
|
pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes {
|
2018-09-20 15:47:22 +02:00
|
|
|
fn declare_local(
|
2018-10-05 15:08:49 +02:00
|
|
|
&mut self,
|
2018-09-20 15:47:22 +02:00
|
|
|
dbg_context: &FunctionDebugContext<Self::DIScope>,
|
|
|
|
variable_name: Name,
|
|
|
|
variable_type: Ty<'tcx>,
|
|
|
|
scope_metadata: Self::DIScope,
|
2019-09-12 12:29:46 +03: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 15:47:22 +02:00
|
|
|
variable_kind: VariableKind,
|
|
|
|
span: Span,
|
|
|
|
);
|
|
|
|
fn set_source_location(
|
2018-10-05 15:08:49 +02:00
|
|
|
&mut self,
|
2018-12-02 18:25:42 +01:00
|
|
|
debug_context: &mut FunctionDebugContext<Self::DIScope>,
|
2019-09-11 17:52:39 +03:00
|
|
|
scope: Self::DIScope,
|
2018-09-20 15:47:22 +02:00
|
|
|
span: Span,
|
|
|
|
);
|
2018-10-05 15:08:49 +02:00
|
|
|
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
|
2019-10-22 12:36:00 +03:00
|
|
|
fn set_var_name(&mut self, value: Self::Value, name: &str);
|
2018-09-13 14:58:19 +02:00
|
|
|
}
|