2021-03-20 14:23:38 -07:00
|
|
|
#![doc = include_str!("doc.md")]
|
2012-12-03 16:48:01 -08:00
|
|
|
|
2019-09-04 19:44:58 +03:00
|
|
|
use rustc_codegen_ssa::mir::debuginfo::VariableKind::*;
|
2015-04-24 17:20:13 +12:00
|
|
|
|
2020-02-10 22:52:30 +02:00
|
|
|
use self::metadata::{file_metadata, type_metadata, TypeMap};
|
|
|
|
use self::metadata::{UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER};
|
2017-12-20 21:28:10 -08:00
|
|
|
use self::namespace::mangled_name_of_instance;
|
2020-02-25 00:00:00 +00:00
|
|
|
use self::utils::{create_DIArray, is_node_local_to_unit, DIB};
|
2013-06-18 10:17:10 +02:00
|
|
|
|
2020-03-31 18:16:47 +02:00
|
|
|
use crate::abi::FnAbi;
|
|
|
|
use crate::builder::Builder;
|
|
|
|
use crate::common::CodegenCx;
|
2019-02-18 03:58:58 +09:00
|
|
|
use crate::llvm;
|
2019-12-22 17:42:04 -05:00
|
|
|
use crate::llvm::debuginfo::{
|
2020-02-10 22:52:30 +02:00
|
|
|
DIArray, DIBuilder, DIFile, DIFlags, DILexicalBlock, DILocation, DISPFlags, DIScope, DIType,
|
|
|
|
DIVariable,
|
2019-12-22 17:42:04 -05:00
|
|
|
};
|
2019-02-18 03:58:58 +09:00
|
|
|
use crate::value::Value;
|
2020-03-31 18:16:47 +02:00
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
use rustc_codegen_ssa::debuginfo::type_names;
|
|
|
|
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
|
2020-03-31 18:16:47 +02:00
|
|
|
use rustc_codegen_ssa::traits::*;
|
2019-12-24 05:02:53 +01:00
|
|
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
2020-02-10 22:52:30 +02:00
|
|
|
use rustc_data_structures::sync::Lrc;
|
2021-05-11 12:00:59 +02:00
|
|
|
use rustc_hir::def_id::{DefId, DefIdMap};
|
2019-09-26 05:38:33 +00:00
|
|
|
use rustc_index::vec::IndexVec;
|
2020-03-29 17:19:48 +02:00
|
|
|
use rustc_middle::mir;
|
2021-08-30 17:38:27 +03:00
|
|
|
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
|
2020-03-31 18:16:47 +02:00
|
|
|
use rustc_middle::ty::subst::{GenericArgKind, SubstsRef};
|
2020-06-22 13:33:17 +01:00
|
|
|
use rustc_middle::ty::{self, Instance, ParamEnv, Ty, TypeFoldable};
|
2020-03-11 12:49:08 +01:00
|
|
|
use rustc_session::config::{self, DebugInfo};
|
2021-08-31 11:16:10 -07:00
|
|
|
use rustc_session::Session;
|
2020-03-31 18:16:47 +02:00
|
|
|
use rustc_span::symbol::Symbol;
|
2020-02-10 22:52:30 +02:00
|
|
|
use rustc_span::{self, BytePos, Pos, SourceFile, SourceFileAndLine, Span};
|
2021-08-30 17:38:27 +03:00
|
|
|
use rustc_target::abi::{Primitive, Size};
|
2012-12-13 13:05:22 -08:00
|
|
|
|
2015-04-24 16:48:10 +12:00
|
|
|
use libc::c_uint;
|
2019-09-12 12:29:46 +03:00
|
|
|
use smallvec::SmallVec;
|
2020-03-31 18:16:47 +02:00
|
|
|
use std::cell::RefCell;
|
2021-03-08 15:32:41 -08:00
|
|
|
use std::iter;
|
2020-08-05 17:05:53 +05:30
|
|
|
use tracing::debug;
|
2013-06-26 16:00:42 +02:00
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
mod create_scope_map;
|
2015-04-24 17:25:35 +12:00
|
|
|
pub mod gdb;
|
2016-07-13 00:40:38 +02:00
|
|
|
pub mod metadata;
|
2019-12-22 17:42:04 -05:00
|
|
|
mod namespace;
|
|
|
|
mod utils;
|
2015-04-29 18:14:37 +12:00
|
|
|
|
2019-09-11 17:52:39 +03:00
|
|
|
pub use self::create_scope_map::compute_mir_scopes;
|
2015-04-29 18:14:37 +12:00
|
|
|
pub use self::metadata::create_global_var_metadata;
|
2016-08-24 19:34:31 -07:00
|
|
|
pub use self::metadata::extend_scope_to_file;
|
2015-04-24 17:25:35 +12:00
|
|
|
|
2014-10-27 15:37:07 -07:00
|
|
|
#[allow(non_upper_case_globals)]
|
2014-12-06 11:39:25 -05:00
|
|
|
const DW_TAG_auto_variable: c_uint = 0x100;
|
2014-10-27 15:37:07 -07:00
|
|
|
#[allow(non_upper_case_globals)]
|
2014-12-06 11:39:25 -05:00
|
|
|
const DW_TAG_arg_variable: c_uint = 0x101;
|
2011-11-15 21:11:22 -05:00
|
|
|
|
2013-06-18 13:06:41 +02:00
|
|
|
/// A context object for maintaining all state needed by the debuginfo module.
|
2018-06-27 17:57:25 +03:00
|
|
|
pub struct CrateDebugContext<'a, 'tcx> {
|
|
|
|
llcontext: &'a llvm::Context,
|
|
|
|
llmod: &'a llvm::Module,
|
2018-07-17 18:45:33 +03:00
|
|
|
builder: &'a mut DIBuilder<'a>,
|
2019-05-06 11:47:03 +10:00
|
|
|
created_files: RefCell<FxHashMap<(Option<String>, Option<String>), &'a DIFile>>,
|
2020-03-31 18:16:47 +02:00
|
|
|
created_enum_disr_types: RefCell<FxHashMap<(DefId, Primitive), &'a DIType>>,
|
2014-05-30 17:09:16 +02:00
|
|
|
|
2018-07-04 16:36:49 +03:00
|
|
|
type_map: RefCell<TypeMap<'a, 'tcx>>,
|
|
|
|
namespace_map: RefCell<DefIdMap<&'a DIScope>>,
|
2014-05-30 17:09:16 +02:00
|
|
|
|
2014-06-18 15:07:26 +12:00
|
|
|
// This collection is used to assert that composite types (structs, enums,
|
|
|
|
// ...) have their members only set once:
|
2018-07-04 16:36:49 +03:00
|
|
|
composite_types_completed: RefCell<FxHashSet<&'a DIType>>,
|
2013-06-14 11:38:29 -07:00
|
|
|
}
|
|
|
|
|
2021-12-14 13:49:49 -05:00
|
|
|
impl Drop for CrateDebugContext<'_, '_> {
|
2018-07-17 18:45:33 +03:00
|
|
|
fn drop(&mut self) {
|
|
|
|
unsafe {
|
|
|
|
llvm::LLVMRustDIBuilderDispose(&mut *(self.builder as *mut _));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-27 17:57:25 +03:00
|
|
|
impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
|
|
|
|
pub fn new(llmod: &'a llvm::Module) -> Self {
|
2013-10-21 13:08:31 -07:00
|
|
|
debug!("CrateDebugContext::new");
|
2016-08-02 02:35:09 +03:00
|
|
|
let builder = unsafe { llvm::LLVMRustDIBuilderCreate(llmod) };
|
2013-06-17 08:42:05 -07:00
|
|
|
// DIBuilder inherits context from the module, so we'd better use the same one
|
|
|
|
let llcontext = unsafe { llvm::LLVMGetModuleContext(llmod) };
|
2016-12-16 18:48:25 -07:00
|
|
|
CrateDebugContext {
|
2017-08-06 22:54:09 -07:00
|
|
|
llcontext,
|
|
|
|
llmod,
|
|
|
|
builder,
|
2018-10-16 16:57:53 +02:00
|
|
|
created_files: Default::default(),
|
|
|
|
created_enum_disr_types: Default::default(),
|
|
|
|
type_map: Default::default(),
|
2018-07-21 22:15:11 +03:00
|
|
|
namespace_map: RefCell::new(Default::default()),
|
2018-10-16 16:57:53 +02:00
|
|
|
composite_types_completed: Default::default(),
|
2016-12-16 18:48:25 -07:00
|
|
|
}
|
2013-08-05 11:12:40 +02:00
|
|
|
}
|
2021-08-31 11:16:10 -07:00
|
|
|
|
|
|
|
pub fn finalize(&self, sess: &Session) {
|
|
|
|
unsafe {
|
|
|
|
llvm::LLVMRustDIBuilderFinalize(self.builder);
|
|
|
|
|
|
|
|
// Debuginfo generation in LLVM by default uses a higher
|
|
|
|
// version of dwarf than macOS currently understands. We can
|
|
|
|
// instruct LLVM to emit an older version of dwarf, however,
|
|
|
|
// for macOS to understand. For more info see #11352
|
|
|
|
// This can be overridden using --llvm-opts -dwarf-version,N.
|
|
|
|
// Android has the same issue (#22398)
|
|
|
|
if let Some(version) = sess.target.dwarf_version {
|
|
|
|
llvm::LLVMRustAddModuleFlag(self.llmod, "Dwarf Version\0".as_ptr().cast(), version)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Indicate that we want CodeView debug information on MSVC
|
|
|
|
if sess.target.is_like_msvc {
|
|
|
|
llvm::LLVMRustAddModuleFlag(self.llmod, "CodeView\0".as_ptr().cast(), 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prevent bitcode readers from deleting the debug info.
|
|
|
|
let ptr = "Debug Info Version\0".as_ptr();
|
|
|
|
llvm::LLVMRustAddModuleFlag(
|
|
|
|
self.llmod,
|
|
|
|
ptr.cast(),
|
|
|
|
llvm::LLVMRustDebugMetadataVersion(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2013-08-05 11:12:40 +02:00
|
|
|
}
|
|
|
|
|
2019-02-08 14:53:55 +01:00
|
|
|
/// Creates any deferred debug metadata nodes
|
2019-02-25 08:40:18 +01:00
|
|
|
pub fn finalize(cx: &CodegenCx<'_, '_>) {
|
2021-08-31 11:16:10 -07:00
|
|
|
if let Some(dbg_cx) = &cx.dbg_cx {
|
|
|
|
debug!("finalize");
|
|
|
|
|
|
|
|
if gdb::needs_gdb_debug_scripts_section(cx) {
|
|
|
|
// Add a .debug_gdb_scripts section to this compile-unit. This will
|
|
|
|
// cause GDB to try and load the gdb_load_rust_pretty_printers.py file,
|
|
|
|
// which activates the Rust pretty printers for binary this section is
|
|
|
|
// contained in.
|
|
|
|
gdb::get_or_insert_gdb_debug_scripts_section_global(cx);
|
2014-01-28 00:05:33 -05:00
|
|
|
}
|
|
|
|
|
2021-08-31 11:16:10 -07:00
|
|
|
dbg_cx.finalize(cx.sess());
|
|
|
|
}
|
2011-11-10 00:55:09 -05:00
|
|
|
}
|
|
|
|
|
2021-12-14 13:49:49 -05:00
|
|
|
impl<'ll> DebugInfoBuilderMethods for Builder<'_, 'll, '_> {
|
2020-01-26 18:50:13 +02:00
|
|
|
// 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(
|
2018-10-05 15:08:49 +02:00
|
|
|
&mut self,
|
2020-01-26 18:50:13 +02:00
|
|
|
dbg_var: &'ll DIVariable,
|
2020-02-10 22:52:30 +02:00
|
|
|
dbg_loc: &'ll DILocation,
|
2019-09-12 12:29:46 +03:00
|
|
|
variable_alloca: Self::Value,
|
|
|
|
direct_offset: Size,
|
|
|
|
indirect_offsets: &[Size],
|
2018-09-20 15:47:22 +02:00
|
|
|
) {
|
2019-09-12 12:29:46 +03:00
|
|
|
// Convert the direct and indirect offsets to address ops.
|
2020-02-08 18:07:44 +02:00
|
|
|
// FIXME(eddyb) use `const`s instead of getting the values via FFI,
|
|
|
|
// the values should match the ones in the DWARF standard anyway.
|
2019-09-12 12:29:46 +03:00
|
|
|
let op_deref = || unsafe { llvm::LLVMRustDIBuilderCreateOpDeref() };
|
|
|
|
let op_plus_uconst = || unsafe { llvm::LLVMRustDIBuilderCreateOpPlusUconst() };
|
2022-01-03 11:25:33 +01:00
|
|
|
let mut addr_ops = SmallVec::<[u64; 8]>::new();
|
2019-09-12 12:29:46 +03:00
|
|
|
|
|
|
|
if direct_offset.bytes() > 0 {
|
|
|
|
addr_ops.push(op_plus_uconst());
|
2022-01-03 11:25:33 +01:00
|
|
|
addr_ops.push(direct_offset.bytes() as u64);
|
2019-09-12 12:29:46 +03:00
|
|
|
}
|
|
|
|
for &offset in indirect_offsets {
|
|
|
|
addr_ops.push(op_deref());
|
|
|
|
if offset.bytes() > 0 {
|
|
|
|
addr_ops.push(op_plus_uconst());
|
2022-01-03 11:25:33 +01:00
|
|
|
addr_ops.push(offset.bytes() as u64);
|
2018-09-20 15:47:22 +02:00
|
|
|
}
|
|
|
|
}
|
2019-09-12 12:29:46 +03:00
|
|
|
|
|
|
|
unsafe {
|
2020-01-26 18:50:13 +02:00
|
|
|
// FIXME(eddyb) replace `llvm.dbg.declare` with `llvm.dbg.addr`.
|
2020-02-08 18:07:44 +02:00
|
|
|
llvm::LLVMRustDIBuilderInsertDeclareAtEnd(
|
2020-02-10 22:52:30 +02:00
|
|
|
DIB(self.cx()),
|
2019-09-12 12:29:46 +03:00
|
|
|
variable_alloca,
|
2020-01-26 18:50:13 +02:00
|
|
|
dbg_var,
|
2019-09-12 12:29:46 +03:00
|
|
|
addr_ops.as_ptr(),
|
|
|
|
addr_ops.len() as c_uint,
|
2020-02-08 18:07:44 +02:00
|
|
|
dbg_loc,
|
2019-12-22 17:42:04 -05:00
|
|
|
self.llbb(),
|
|
|
|
);
|
2019-09-12 12:29:46 +03:00
|
|
|
}
|
2013-08-23 18:45:02 +02:00
|
|
|
}
|
|
|
|
|
2020-02-10 22:52:30 +02:00
|
|
|
fn set_dbg_loc(&mut self, dbg_loc: &'ll DILocation) {
|
2020-02-08 18:27:49 +02:00
|
|
|
unsafe {
|
2020-02-10 22:52:20 +02:00
|
|
|
let dbg_loc_as_llval = llvm::LLVMRustMetadataAsValue(self.cx().llcx, dbg_loc);
|
|
|
|
llvm::LLVMSetCurrentDebugLocation(self.llbuilder, dbg_loc_as_llval);
|
2020-02-08 18:27:49 +02:00
|
|
|
}
|
2016-12-19 07:33:35 -07:00
|
|
|
}
|
2020-02-10 22:52:30 +02:00
|
|
|
|
2018-10-05 15:08:49 +02:00
|
|
|
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
|
2018-09-24 15:26:39 +02:00
|
|
|
gdb::insert_reference_to_gdb_debug_scripts_section_global(self)
|
|
|
|
}
|
2018-12-04 20:20:45 +01:00
|
|
|
|
2019-10-22 12:36:00 +03:00
|
|
|
fn set_var_name(&mut self, value: &'ll Value, name: &str) {
|
2019-09-04 15:21:46 +03:00
|
|
|
// Avoid wasting time if LLVM value names aren't even enabled.
|
|
|
|
if self.sess().fewer_names() {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only function parameters and instructions are local to a function,
|
|
|
|
// don't change the name of anything else (e.g. globals).
|
|
|
|
let param_or_inst = unsafe {
|
2019-12-22 17:42:04 -05:00
|
|
|
llvm::LLVMIsAArgument(value).is_some() || llvm::LLVMIsAInstruction(value).is_some()
|
2019-09-04 15:21:46 +03:00
|
|
|
};
|
|
|
|
if !param_or_inst {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-12-04 12:00:28 -08:00
|
|
|
// Avoid replacing the name if it already exists.
|
|
|
|
// While we could combine the names somehow, it'd
|
|
|
|
// get noisy quick, and the usefulness is dubious.
|
|
|
|
if llvm::get_value_name(value).is_empty() {
|
|
|
|
llvm::set_value_name(value, name.as_bytes());
|
2018-12-04 20:20:45 +01:00
|
|
|
}
|
|
|
|
}
|
2018-09-20 15:47:22 +02:00
|
|
|
}
|
2016-12-19 07:33:35 -07:00
|
|
|
|
2020-02-10 22:52:30 +02:00
|
|
|
/// A source code location used to generate debug information.
|
|
|
|
// FIXME(eddyb) rename this to better indicate it's a duplicate of
|
|
|
|
// `rustc_span::Loc` rather than `DILocation`, perhaps by making
|
|
|
|
// `lookup_char_pos` return the right information instead.
|
|
|
|
pub struct DebugLoc {
|
|
|
|
/// Information about the original source file.
|
|
|
|
pub file: Lrc<SourceFile>,
|
|
|
|
/// The (1-based) line number.
|
2021-02-19 14:50:15 -06:00
|
|
|
pub line: u32,
|
2020-02-10 22:52:30 +02:00
|
|
|
/// The (1-based) column number.
|
2021-02-19 14:50:15 -06:00
|
|
|
pub col: u32,
|
2020-02-10 22:52:30 +02:00
|
|
|
}
|
|
|
|
|
2021-12-14 13:49:49 -05:00
|
|
|
impl CodegenCx<'_, '_> {
|
2020-02-10 22:52:30 +02:00
|
|
|
/// Looks up debug source information about a `BytePos`.
|
|
|
|
// FIXME(eddyb) rename this to better indicate it's a duplicate of
|
|
|
|
// `lookup_char_pos` rather than `dbg_loc`, perhaps by making
|
|
|
|
// `lookup_char_pos` return the right information instead.
|
|
|
|
pub fn lookup_debug_loc(&self, pos: BytePos) -> DebugLoc {
|
|
|
|
let (file, line, col) = match self.sess().source_map().lookup_line(pos) {
|
|
|
|
Ok(SourceFileAndLine { sf: file, line }) => {
|
|
|
|
let line_pos = file.line_begin_pos(pos);
|
|
|
|
|
|
|
|
// Use 1-based indexing.
|
|
|
|
let line = (line + 1) as u32;
|
|
|
|
let col = (pos - line_pos).to_u32() + 1;
|
|
|
|
|
2021-02-19 14:50:15 -06:00
|
|
|
(file, line, col)
|
2020-02-10 22:52:30 +02:00
|
|
|
}
|
2021-02-19 14:50:15 -06:00
|
|
|
Err(file) => (file, UNKNOWN_LINE_NUMBER, UNKNOWN_COLUMN_NUMBER),
|
2020-02-10 22:52:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// For MSVC, omit the column number.
|
|
|
|
// Otherwise, emit it. This mimics clang behaviour.
|
|
|
|
// See discussion in https://github.com/rust-lang/rust/issues/42921
|
2020-11-08 14:27:51 +03:00
|
|
|
if self.sess().target.is_like_msvc {
|
2021-02-19 14:50:15 -06:00
|
|
|
DebugLoc { file, line, col: UNKNOWN_COLUMN_NUMBER }
|
2020-02-10 22:52:30 +02:00
|
|
|
} else {
|
|
|
|
DebugLoc { file, line, col }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-14 13:49:49 -05:00
|
|
|
impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
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>>,
|
2018-09-20 15:47:22 +02:00
|
|
|
llfn: &'ll Value,
|
2020-02-11 01:27:33 +02:00
|
|
|
mir: &mir::Body<'tcx>,
|
|
|
|
) -> Option<FunctionDebugContext<&'ll DIScope, &'ll DILocation>> {
|
2018-09-20 15:47:22 +02:00
|
|
|
if self.sess().opts.debuginfo == DebugInfo::None {
|
2019-09-11 17:52:39 +03:00
|
|
|
return None;
|
2018-09-20 15:47:22 +02:00
|
|
|
}
|
2016-05-01 12:46:55 -04:00
|
|
|
|
2020-02-10 22:30:51 +02:00
|
|
|
// Initialize fn debug context (including scopes).
|
2020-02-10 22:52:30 +02:00
|
|
|
// FIXME(eddyb) figure out a way to not need `Option` for `dbg_scope`.
|
2020-02-11 01:27:33 +02:00
|
|
|
let empty_scope = DebugScope {
|
|
|
|
dbg_scope: None,
|
|
|
|
inlined_at: None,
|
|
|
|
file_start_pos: BytePos(0),
|
|
|
|
file_end_pos: BytePos(0),
|
|
|
|
};
|
2020-02-10 22:30:51 +02:00
|
|
|
let mut fn_debug_context =
|
|
|
|
FunctionDebugContext { scopes: IndexVec::from_elem(empty_scope, &mir.source_scopes) };
|
2013-06-18 13:06:41 +02:00
|
|
|
|
2020-02-10 22:30:51 +02:00
|
|
|
// Fill in all the scopes, with the information from the MIR body.
|
|
|
|
compute_mir_scopes(
|
|
|
|
self,
|
2020-02-11 01:27:33 +02:00
|
|
|
instance,
|
2020-02-10 22:30:51 +02:00
|
|
|
mir,
|
|
|
|
self.dbg_scope_fn(instance, fn_abi, Some(llfn)),
|
|
|
|
&mut fn_debug_context,
|
|
|
|
);
|
|
|
|
|
|
|
|
Some(fn_debug_context)
|
|
|
|
}
|
2013-08-13 12:52:39 +02:00
|
|
|
|
2020-02-10 22:30:51 +02:00
|
|
|
fn dbg_scope_fn(
|
|
|
|
&self,
|
|
|
|
instance: Instance<'tcx>,
|
|
|
|
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
|
|
|
maybe_definition_llfn: Option<&'ll Value>,
|
|
|
|
) -> &'ll DIScope {
|
2018-09-20 15:47:22 +02:00
|
|
|
let def_id = instance.def_id();
|
|
|
|
let containing_scope = get_containing_scope(self, instance);
|
2020-02-10 22:30:51 +02:00
|
|
|
let span = self.tcx.def_span(def_id);
|
2020-02-25 00:00:00 +00:00
|
|
|
let loc = self.lookup_debug_loc(span.lo());
|
2020-02-10 03:03:24 +02:00
|
|
|
let file_metadata = file_metadata(self, &loc.file);
|
2016-11-03 22:19:33 +02:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
let function_type_metadata = unsafe {
|
2019-10-29 20:01:31 +02:00
|
|
|
let fn_signature = get_function_signature(self, fn_abi);
|
2020-05-21 20:53:41 +03:00
|
|
|
llvm::LLVMRustDIBuilderCreateSubroutineType(DIB(self), fn_signature)
|
2018-09-20 15:47:22 +02:00
|
|
|
};
|
|
|
|
|
Improve debug symbol names to avoid ambiguity and work better with MSVC's debugger
There are several cases where names of types and functions in the debug info are either ambiguous, or not helpful, such as including ambiguous placeholders (e.g., `{{impl}}`, `{{closure}}` or `dyn _'`) or dropping qualifications (e.g., for dynamic types).
Instead, each debug symbol name should be unique and useful:
* Include disambiguators for anonymous `DefPathDataName` (closures and generators), and unify their formatting when used as a path-qualifier vs item being qualified.
* Qualify the principal trait for dynamic types.
* If there is no principal trait for a dynamic type, emit all other traits instead.
* Respect the `qualified` argument when emitting ref and pointer types.
* For implementations, emit the disambiguator.
* Print const generics when emitting generic parameters or arguments.
Additionally, when targeting MSVC, its debugger treats many command arguments as C++ expressions, even when the argument is defined to be a symbol name. As such names in the debug info need to be more C++-like to be parsed correctly:
* Avoid characters with special meaning (`#`, `[`, `"`, `+`).
* Never start a name with `<` or `{` as this is treated as an operator.
* `>>` is always treated as a right-shift, even when parsing generic arguments (so add a space to avoid this).
* Emit function declarations using C/C++ style syntax (e.g., leading return type).
* Emit arrays as a synthetic `array$<type, size>` type.
* Include a `$` in all synthetic types as this is a legal character for C++, but not Rust (thus we avoid collisions with user types).
2021-06-24 10:36:28 -07:00
|
|
|
let mut name = String::new();
|
|
|
|
type_names::push_item_name(self.tcx(), def_id, false, &mut name);
|
2018-09-20 15:47:22 +02:00
|
|
|
|
Improve debug symbol names to avoid ambiguity and work better with MSVC's debugger
There are several cases where names of types and functions in the debug info are either ambiguous, or not helpful, such as including ambiguous placeholders (e.g., `{{impl}}`, `{{closure}}` or `dyn _'`) or dropping qualifications (e.g., for dynamic types).
Instead, each debug symbol name should be unique and useful:
* Include disambiguators for anonymous `DefPathDataName` (closures and generators), and unify their formatting when used as a path-qualifier vs item being qualified.
* Qualify the principal trait for dynamic types.
* If there is no principal trait for a dynamic type, emit all other traits instead.
* Respect the `qualified` argument when emitting ref and pointer types.
* For implementations, emit the disambiguator.
* Print const generics when emitting generic parameters or arguments.
Additionally, when targeting MSVC, its debugger treats many command arguments as C++ expressions, even when the argument is defined to be a symbol name. As such names in the debug info need to be more C++-like to be parsed correctly:
* Avoid characters with special meaning (`#`, `[`, `"`, `+`).
* Never start a name with `<` or `{` as this is treated as an operator.
* `>>` is always treated as a right-shift, even when parsing generic arguments (so add a space to avoid this).
* Emit function declarations using C/C++ style syntax (e.g., leading return type).
* Emit arrays as a synthetic `array$<type, size>` type.
* Include a `$` in all synthetic types as this is a legal character for C++, but not Rust (thus we avoid collisions with user types).
2021-06-24 10:36:28 -07:00
|
|
|
// Find the enclosing function, in case this is a closure.
|
2021-11-06 20:01:35 +00:00
|
|
|
let enclosing_fn_def_id = self.tcx().typeck_root_def_id(def_id);
|
2016-04-06 15:37:19 +03:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
// Get_template_parameters() will append a `<...>` clause to the function
|
|
|
|
// name if necessary.
|
|
|
|
let generics = self.tcx().generics_of(enclosing_fn_def_id);
|
|
|
|
let substs = instance.substs.truncate_to(self.tcx(), generics);
|
2021-09-30 19:38:50 +02:00
|
|
|
let template_parameters = get_template_parameters(self, generics, substs, &mut name);
|
2016-04-06 15:37:19 +03:00
|
|
|
|
2020-07-10 15:45:05 +10:00
|
|
|
let linkage_name = &mangled_name_of_instance(self, instance).name;
|
2020-05-26 00:00:00 +00:00
|
|
|
// Omit the linkage_name if it is the same as subprogram name.
|
|
|
|
let linkage_name = if &name == linkage_name { "" } else { linkage_name };
|
2013-09-06 16:00:08 +02:00
|
|
|
|
2020-02-03 12:14:05 +02:00
|
|
|
// FIXME(eddyb) does this need to be separate from `loc.line` for some reason?
|
|
|
|
let scope_line = loc.line;
|
2013-08-19 18:23:43 +02:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
let mut flags = DIFlags::FlagPrototyped;
|
2018-02-19 12:41:10 +01:00
|
|
|
|
2019-10-29 20:01:31 +02:00
|
|
|
if fn_abi.ret.layout.abi.is_uninhabited() {
|
2018-09-20 15:47:22 +02:00
|
|
|
flags |= DIFlags::FlagNoReturn;
|
|
|
|
}
|
2016-11-30 14:59:45 -07:00
|
|
|
|
2019-01-16 09:59:03 -08:00
|
|
|
let mut spflags = DISPFlags::SPFlagDefinition;
|
|
|
|
if is_node_local_to_unit(self, def_id) {
|
|
|
|
spflags |= DISPFlags::SPFlagLocalToUnit;
|
|
|
|
}
|
|
|
|
if self.sess().opts.optimize != config::OptLevel::No {
|
|
|
|
spflags |= DISPFlags::SPFlagOptimized;
|
|
|
|
}
|
2021-05-11 12:00:59 +02:00
|
|
|
if let Some((id, _)) = self.tcx.entry_fn(()) {
|
2021-04-26 01:09:35 +08:00
|
|
|
if id == def_id {
|
2019-04-04 13:05:41 -07:00
|
|
|
spflags |= DISPFlags::SPFlagMainSubprogram;
|
|
|
|
}
|
|
|
|
}
|
2019-01-16 09:59:03 -08:00
|
|
|
|
2020-02-10 22:30:51 +02:00
|
|
|
unsafe {
|
|
|
|
return llvm::LLVMRustDIBuilderCreateFunction(
|
2018-09-20 15:47:22 +02:00
|
|
|
DIB(self),
|
|
|
|
containing_scope,
|
2020-03-06 00:00:00 +00:00
|
|
|
name.as_ptr().cast(),
|
|
|
|
name.len(),
|
|
|
|
linkage_name.as_ptr().cast(),
|
|
|
|
linkage_name.len(),
|
2018-09-20 15:47:22 +02:00
|
|
|
file_metadata,
|
2021-02-19 14:50:15 -06:00
|
|
|
loc.line,
|
2018-09-20 15:47:22 +02:00
|
|
|
function_type_metadata,
|
2021-02-19 14:50:15 -06:00
|
|
|
scope_line,
|
2018-09-20 15:47:22 +02:00
|
|
|
flags,
|
2019-01-16 09:59:03 -08:00
|
|
|
spflags,
|
2020-02-10 22:30:51 +02:00
|
|
|
maybe_definition_llfn,
|
2018-09-20 15:47:22 +02:00
|
|
|
template_parameters,
|
2019-12-22 17:42:04 -05:00
|
|
|
None,
|
2020-02-10 22:30:51 +02:00
|
|
|
);
|
|
|
|
}
|
2013-08-13 12:52:39 +02:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
fn get_function_signature<'ll, 'tcx>(
|
|
|
|
cx: &CodegenCx<'ll, 'tcx>,
|
2019-10-29 20:01:31 +02:00
|
|
|
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
2018-09-20 15:47:22 +02:00
|
|
|
) -> &'ll DIArray {
|
|
|
|
if cx.sess().opts.debuginfo == DebugInfo::Limited {
|
|
|
|
return create_DIArray(DIB(cx), &[]);
|
|
|
|
}
|
2013-08-13 12:52:39 +02:00
|
|
|
|
2019-10-29 20:01:31 +02:00
|
|
|
let mut signature = Vec::with_capacity(fn_abi.args.len() + 1);
|
2015-07-13 21:48:07 +02:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
// Return type -- llvm::DIBuilder wants this at index 0
|
2019-10-29 20:01:31 +02:00
|
|
|
signature.push(if fn_abi.ret.is_ignore() {
|
|
|
|
None
|
2018-09-20 15:47:22 +02:00
|
|
|
} else {
|
2019-12-31 20:15:40 +03:00
|
|
|
Some(type_metadata(cx, fn_abi.ret.layout.ty, rustc_span::DUMMY_SP))
|
2019-10-29 20:01:31 +02:00
|
|
|
});
|
2015-07-14 19:03:13 +02:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
// Arguments types
|
2020-11-08 14:27:51 +03:00
|
|
|
if cx.sess().target.is_like_msvc {
|
2018-09-20 15:47:22 +02:00
|
|
|
// FIXME(#42800):
|
|
|
|
// There is a bug in MSDIA that leads to a crash when it encounters
|
|
|
|
// a fixed-size array of `u8` or something zero-sized in a
|
|
|
|
// function-type (see #40477).
|
|
|
|
// As a workaround, we replace those fixed-size arrays with a
|
|
|
|
// pointer-type. So a function `fn foo(a: u8, b: [u8; 4])` would
|
|
|
|
// appear as `fn foo(a: u8, b: *const u8)` in debuginfo,
|
|
|
|
// and a function `fn bar(x: [(); 7])` as `fn bar(x: *const ())`.
|
|
|
|
// This transformed type is wrong, but these function types are
|
|
|
|
// already inaccurate due to ABI adjustments (see #42800).
|
2019-10-29 20:01:31 +02:00
|
|
|
signature.extend(fn_abi.args.iter().map(|arg| {
|
|
|
|
let t = arg.layout.ty;
|
2020-08-03 00:49:11 +02:00
|
|
|
let t = match t.kind() {
|
2018-09-20 15:47:22 +02:00
|
|
|
ty::Array(ct, _)
|
2020-08-03 00:49:11 +02:00
|
|
|
if (*ct == cx.tcx.types.u8) || cx.layout_of(ct).is_zst() =>
|
2019-12-22 17:42:04 -05:00
|
|
|
{
|
2018-09-20 15:47:22 +02:00
|
|
|
cx.tcx.mk_imm_ptr(ct)
|
|
|
|
}
|
2019-12-22 17:42:04 -05:00
|
|
|
_ => t,
|
2018-09-20 15:47:22 +02:00
|
|
|
};
|
2019-12-31 20:15:40 +03:00
|
|
|
Some(type_metadata(cx, t, rustc_span::DUMMY_SP))
|
2018-09-20 15:47:22 +02:00
|
|
|
}));
|
|
|
|
} else {
|
2019-12-22 17:42:04 -05:00
|
|
|
signature.extend(
|
|
|
|
fn_abi
|
|
|
|
.args
|
|
|
|
.iter()
|
2019-12-31 20:15:40 +03:00
|
|
|
.map(|arg| Some(type_metadata(cx, arg.layout.ty, rustc_span::DUMMY_SP))),
|
2019-12-22 17:42:04 -05:00
|
|
|
);
|
2018-09-20 15:47:22 +02:00
|
|
|
}
|
2013-08-05 11:12:40 +02:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
create_DIArray(DIB(cx), &signature[..])
|
2016-03-06 16:30:21 +02:00
|
|
|
}
|
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
fn get_template_parameters<'ll, 'tcx>(
|
|
|
|
cx: &CodegenCx<'ll, 'tcx>,
|
|
|
|
generics: &ty::Generics,
|
2019-02-26 09:30:34 +08:00
|
|
|
substs: SubstsRef<'tcx>,
|
2018-09-20 15:47:22 +02:00
|
|
|
name_to_append_suffix_to: &mut String,
|
|
|
|
) -> &'ll DIArray {
|
Improve debug symbol names to avoid ambiguity and work better with MSVC's debugger
There are several cases where names of types and functions in the debug info are either ambiguous, or not helpful, such as including ambiguous placeholders (e.g., `{{impl}}`, `{{closure}}` or `dyn _'`) or dropping qualifications (e.g., for dynamic types).
Instead, each debug symbol name should be unique and useful:
* Include disambiguators for anonymous `DefPathDataName` (closures and generators), and unify their formatting when used as a path-qualifier vs item being qualified.
* Qualify the principal trait for dynamic types.
* If there is no principal trait for a dynamic type, emit all other traits instead.
* Respect the `qualified` argument when emitting ref and pointer types.
* For implementations, emit the disambiguator.
* Print const generics when emitting generic parameters or arguments.
Additionally, when targeting MSVC, its debugger treats many command arguments as C++ expressions, even when the argument is defined to be a symbol name. As such names in the debug info need to be more C++-like to be parsed correctly:
* Avoid characters with special meaning (`#`, `[`, `"`, `+`).
* Never start a name with `<` or `{` as this is treated as an operator.
* `>>` is always treated as a right-shift, even when parsing generic arguments (so add a space to avoid this).
* Emit function declarations using C/C++ style syntax (e.g., leading return type).
* Emit arrays as a synthetic `array$<type, size>` type.
* Include a `$` in all synthetic types as this is a legal character for C++, but not Rust (thus we avoid collisions with user types).
2021-06-24 10:36:28 -07:00
|
|
|
type_names::push_generic_params(
|
|
|
|
cx.tcx,
|
|
|
|
cx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), substs),
|
|
|
|
name_to_append_suffix_to,
|
|
|
|
);
|
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
if substs.types().next().is_none() {
|
|
|
|
return create_DIArray(DIB(cx), &[]);
|
|
|
|
}
|
2013-08-08 18:33:06 +02:00
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
// Again, only create type information if full debuginfo is enabled
|
|
|
|
let template_params: Vec<_> = if cx.sess().opts.debuginfo == DebugInfo::Full {
|
|
|
|
let names = get_parameter_names(cx, generics);
|
2021-03-08 15:32:41 -08:00
|
|
|
iter::zip(substs, names)
|
2019-12-22 17:42:04 -05:00
|
|
|
.filter_map(|(kind, name)| {
|
|
|
|
if let GenericArgKind::Type(ty) = kind.unpack() {
|
|
|
|
let actual_type =
|
|
|
|
cx.tcx.normalize_erasing_regions(ParamEnv::reveal_all(), ty);
|
|
|
|
let actual_type_metadata =
|
2019-12-31 20:15:40 +03:00
|
|
|
type_metadata(cx, actual_type, rustc_span::DUMMY_SP);
|
2020-03-06 00:00:00 +00:00
|
|
|
let name = name.as_str();
|
2019-12-22 17:42:04 -05:00
|
|
|
Some(unsafe {
|
|
|
|
Some(llvm::LLVMRustDIBuilderCreateTemplateTypeParameter(
|
|
|
|
DIB(cx),
|
|
|
|
None,
|
2020-03-06 00:00:00 +00:00
|
|
|
name.as_ptr().cast(),
|
|
|
|
name.len(),
|
2019-12-22 17:42:04 -05:00
|
|
|
actual_type_metadata,
|
|
|
|
))
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.collect()
|
2018-09-20 15:47:22 +02:00
|
|
|
} else {
|
|
|
|
vec![]
|
|
|
|
};
|
|
|
|
|
2021-12-03 03:06:36 +01:00
|
|
|
create_DIArray(DIB(cx), &template_params)
|
2018-09-20 15:47:22 +02:00
|
|
|
}
|
2016-08-18 08:32:50 +03:00
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
fn get_parameter_names(cx: &CodegenCx<'_, '_>, generics: &ty::Generics) -> Vec<Symbol> {
|
2021-02-25 04:13:42 +03:00
|
|
|
let mut names = generics.parent.map_or_else(Vec::new, |def_id| {
|
|
|
|
get_parameter_names(cx, cx.tcx.generics_of(def_id))
|
|
|
|
});
|
2018-09-20 15:47:22 +02:00
|
|
|
names.extend(generics.params.iter().map(|param| param.name));
|
|
|
|
names
|
2016-04-06 10:49:50 +03:00
|
|
|
}
|
2018-09-20 15:47:22 +02:00
|
|
|
|
|
|
|
fn get_containing_scope<'ll, 'tcx>(
|
|
|
|
cx: &CodegenCx<'ll, 'tcx>,
|
|
|
|
instance: Instance<'tcx>,
|
|
|
|
) -> &'ll DIScope {
|
|
|
|
// First, let's see if this is a method within an inherent impl. Because
|
|
|
|
// if yes, we want to make the result subroutine DIE a child of the
|
|
|
|
// subroutine's self-type.
|
|
|
|
let self_type = cx.tcx.impl_of_method(instance.def_id()).and_then(|impl_def_id| {
|
|
|
|
// If the method does *not* belong to a trait, proceed
|
|
|
|
if cx.tcx.trait_id_of_impl(impl_def_id).is_none() {
|
|
|
|
let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions(
|
|
|
|
instance.substs,
|
|
|
|
ty::ParamEnv::reveal_all(),
|
2020-10-24 02:21:18 +02:00
|
|
|
cx.tcx.type_of(impl_def_id),
|
2018-09-20 15:47:22 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// Only "class" methods are generally understood by LLVM,
|
2018-11-27 02:59:49 +00:00
|
|
|
// so avoid methods on other types (e.g., `<*mut T>::null`).
|
2020-08-03 00:49:11 +02:00
|
|
|
match impl_self_ty.kind() {
|
2018-09-20 15:47:22 +02:00
|
|
|
ty::Adt(def, ..) if !def.is_box() => {
|
2020-02-11 23:03:00 +02:00
|
|
|
// Again, only create type information if full debuginfo is enabled
|
2020-06-22 13:33:17 +01:00
|
|
|
if cx.sess().opts.debuginfo == DebugInfo::Full
|
2022-01-12 03:19:52 +00:00
|
|
|
&& !impl_self_ty.needs_subst()
|
2020-06-22 13:33:17 +01:00
|
|
|
{
|
2020-02-11 23:03:00 +02:00
|
|
|
Some(type_metadata(cx, impl_self_ty, rustc_span::DUMMY_SP))
|
|
|
|
} else {
|
|
|
|
Some(namespace::item_namespace(cx, def.did))
|
|
|
|
}
|
2018-09-20 15:47:22 +02:00
|
|
|
}
|
2019-12-22 17:42:04 -05:00
|
|
|
_ => None,
|
2018-09-20 15:47:22 +02:00
|
|
|
}
|
2018-04-13 00:57:38 +01:00
|
|
|
} else {
|
2018-09-20 15:47:22 +02:00
|
|
|
// For trait method impls we still use the "parallel namespace"
|
|
|
|
// strategy
|
2018-04-13 00:57:38 +01:00
|
|
|
None
|
|
|
|
}
|
2018-09-20 15:47:22 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
self_type.unwrap_or_else(|| {
|
2019-12-22 17:42:04 -05:00
|
|
|
namespace::item_namespace(
|
|
|
|
cx,
|
|
|
|
DefId {
|
|
|
|
krate: instance.def_id().krate,
|
|
|
|
index: cx
|
|
|
|
.tcx
|
|
|
|
.def_key(instance.def_id())
|
|
|
|
.parent
|
|
|
|
.expect("get_containing_scope: missing parent?"),
|
|
|
|
},
|
|
|
|
)
|
2018-09-20 15:47:22 +02:00
|
|
|
})
|
|
|
|
}
|
2013-08-08 18:33:06 +02:00
|
|
|
}
|
2016-05-01 12:46:55 -04:00
|
|
|
|
2020-02-11 01:27:33 +02:00
|
|
|
fn dbg_loc(
|
|
|
|
&self,
|
|
|
|
scope: &'ll DIScope,
|
|
|
|
inlined_at: Option<&'ll DILocation>,
|
|
|
|
span: Span,
|
|
|
|
) -> &'ll DILocation {
|
2020-02-10 22:52:30 +02:00
|
|
|
let DebugLoc { line, col, .. } = self.lookup_debug_loc(span.lo());
|
|
|
|
|
2021-02-19 14:50:15 -06:00
|
|
|
unsafe { llvm::LLVMRustDIBuilderCreateDebugLocation(line, col, scope, inlined_at) }
|
2020-02-10 22:52:30 +02:00
|
|
|
}
|
|
|
|
|
2021-10-06 14:26:50 +02:00
|
|
|
fn create_vtable_metadata(
|
|
|
|
&self,
|
|
|
|
ty: Ty<'tcx>,
|
|
|
|
trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
|
|
|
|
vtable: Self::Value,
|
|
|
|
) {
|
|
|
|
metadata::create_vtable_metadata(self, ty, trait_ref, vtable)
|
2016-08-10 20:39:09 +03:00
|
|
|
}
|
|
|
|
|
2018-09-20 15:47:22 +02:00
|
|
|
fn extend_scope_to_file(
|
2019-12-22 17:42:04 -05:00
|
|
|
&self,
|
|
|
|
scope_metadata: &'ll DIScope,
|
2019-12-31 20:15:40 +03:00
|
|
|
file: &rustc_span::SourceFile,
|
2019-12-22 17:42:04 -05:00
|
|
|
) -> &'ll DILexicalBlock {
|
2021-09-30 19:38:50 +02:00
|
|
|
metadata::extend_scope_to_file(self, scope_metadata, file)
|
2019-12-22 17:42:04 -05:00
|
|
|
}
|
2018-09-26 17:00:01 +02:00
|
|
|
|
|
|
|
fn debuginfo_finalize(&self) {
|
|
|
|
finalize(self)
|
|
|
|
}
|
2020-01-26 18:50:13 +02: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 13:00:18 +02:00
|
|
|
variable_name: Symbol,
|
2020-01-26 18:50:13 +02:00
|
|
|
variable_type: Ty<'tcx>,
|
|
|
|
scope_metadata: &'ll DIScope,
|
|
|
|
variable_kind: VariableKind,
|
|
|
|
span: Span,
|
|
|
|
) -> &'ll DIVariable {
|
2020-02-25 00:00:00 +00:00
|
|
|
let loc = self.lookup_debug_loc(span.lo());
|
2020-02-10 03:03:24 +02:00
|
|
|
let file_metadata = file_metadata(self, &loc.file);
|
2020-02-03 12:14:05 +02:00
|
|
|
|
2020-01-26 18:50:13 +02:00
|
|
|
let type_metadata = type_metadata(self, variable_type, span);
|
|
|
|
|
|
|
|
let (argument_index, dwarf_tag) = match variable_kind {
|
|
|
|
ArgumentVariable(index) => (index as c_uint, DW_TAG_arg_variable),
|
|
|
|
LocalVariable => (0, DW_TAG_auto_variable),
|
|
|
|
};
|
|
|
|
let align = self.align_of(variable_type);
|
|
|
|
|
2020-03-06 00:00:00 +00:00
|
|
|
let name = variable_name.as_str();
|
2020-01-26 18:50:13 +02:00
|
|
|
unsafe {
|
|
|
|
llvm::LLVMRustDIBuilderCreateVariable(
|
|
|
|
DIB(self),
|
|
|
|
dwarf_tag,
|
|
|
|
scope_metadata,
|
2020-03-06 00:00:00 +00:00
|
|
|
name.as_ptr().cast(),
|
|
|
|
name.len(),
|
2020-01-26 18:50:13 +02:00
|
|
|
file_metadata,
|
2021-02-19 14:50:15 -06:00
|
|
|
loc.line,
|
2020-01-26 18:50:13 +02:00
|
|
|
type_metadata,
|
2020-02-06 11:04:46 +02:00
|
|
|
true,
|
2020-01-26 18:50:13 +02:00
|
|
|
DIFlags::FlagZero,
|
|
|
|
argument_index,
|
|
|
|
align.bytes() as u32,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2014-05-15 14:13:33 +02:00
|
|
|
}
|