rustc_codegen_ssa/traits/
debuginfo.rs

1use std::ops::Range;
2
3use rustc_abi::Size;
4use rustc_middle::mir;
5use rustc_middle::ty::{ExistentialTraitRef, Instance, Ty};
6use rustc_span::{SourceFile, Span, Symbol};
7use rustc_target::callconv::FnAbi;
8
9use super::BackendTypes;
10use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
11
12pub trait DebugInfoCodegenMethods<'tcx>: BackendTypes {
13    fn create_vtable_debuginfo(
14        &self,
15        ty: Ty<'tcx>,
16        trait_ref: Option<ExistentialTraitRef<'tcx>>,
17        vtable: Self::Value,
18    );
19
20    /// Creates the function-specific debug context.
21    ///
22    /// Returns the FunctionDebugContext for the function which holds state needed
23    /// for debug info creation, if it is enabled.
24    fn create_function_debug_context(
25        &self,
26        instance: Instance<'tcx>,
27        fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
28        llfn: Self::Function,
29        mir: &mir::Body<'tcx>,
30    ) -> Option<FunctionDebugContext<'tcx, Self::DIScope, Self::DILocation>>;
31
32    // FIXME(eddyb) find a common convention for all of the debuginfo-related
33    // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
34    fn dbg_scope_fn(
35        &self,
36        instance: Instance<'tcx>,
37        fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
38        maybe_definition_llfn: Option<Self::Function>,
39    ) -> Self::DIScope;
40
41    fn dbg_loc(
42        &self,
43        scope: Self::DIScope,
44        inlined_at: Option<Self::DILocation>,
45        span: Span,
46    ) -> Self::DILocation;
47
48    fn extend_scope_to_file(
49        &self,
50        scope_metadata: Self::DIScope,
51        file: &SourceFile,
52    ) -> Self::DIScope;
53    fn debuginfo_finalize(&self);
54
55    // FIXME(eddyb) find a common convention for all of the debuginfo-related
56    // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
57    fn create_dbg_var(
58        &self,
59        variable_name: Symbol,
60        variable_type: Ty<'tcx>,
61        scope_metadata: Self::DIScope,
62        variable_kind: VariableKind,
63        span: Span,
64    ) -> Self::DIVariable;
65}
66
67pub trait DebugInfoBuilderMethods: BackendTypes {
68    // FIXME(eddyb) find a common convention for all of the debuginfo-related
69    // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
70    fn dbg_var_addr(
71        &mut self,
72        dbg_var: Self::DIVariable,
73        dbg_loc: Self::DILocation,
74        variable_alloca: Self::Value,
75        direct_offset: Size,
76        // NB: each offset implies a deref (i.e. they're steps in a pointer chain).
77        indirect_offsets: &[Size],
78        // Byte range in the `dbg_var` covered by this fragment,
79        // if this is a fragment of a composite `DIVariable`.
80        fragment: Option<Range<Size>>,
81    );
82    fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation);
83    fn clear_dbg_loc(&mut self);
84    fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
85    fn set_var_name(&mut self, value: Self::Value, name: &str);
86}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy