Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_codegen_gcc/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use gccjit::{CType, Context, FunctionType, GlobalKind};
use rustc_codegen_ssa::ModuleCodegen;
use rustc_codegen_ssa::base::maybe_create_entry_wrapper;
use rustc_codegen_ssa::mono_item::MonoItemExt;
use rustc_codegen_ssa::traits::DebugInfoCodegenMethods;
use rustc_hir::attrs::{AttributeKind, Linkage};
use rustc_hir::find_attr;
use rustc_middle::dep_graph;
Expand Down
128 changes: 64 additions & 64 deletions compiler/rustc_codegen_gcc/src/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,66 @@ pub(super) const UNKNOWN_LINE_NUMBER: u32 = 0;
pub(super) const UNKNOWN_COLUMN_NUMBER: u32 = 0;

impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
fn dbg_scope_fn(
&mut self,
_instance: Instance<'tcx>,
_fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
_maybe_definition_llfn: Option<Function<'gcc>>,
) -> Self::DIScope {
// FIXME(antoyo): implement.
}

fn dbg_create_lexical_block(
&mut self,
_pos: BytePos,
_parent_scope: Self::DIScope,
) -> Self::DIScope {
}

fn dbg_location_clone_with_discriminator(
&mut self,
loc: Self::DILocation,
_discriminator: u32,
) -> Option<Self::DILocation> {
Some(loc)
}

fn extend_scope_to_file(
&mut self,
_scope_metadata: Self::DIScope,
_file: &SourceFile,
) -> Self::DIScope {
// FIXME(antoyo): implement.
}

fn dbg_loc(
&mut self,
_scope: Self::DIScope,
_inlined_at: Option<Self::DILocation>,
span: Span,
) -> Self::DILocation {
let pos = span.lo();
let DebugLoc { file, line, col } = self.lookup_debug_loc(pos);
match file.name {
rustc_span::FileName::Real(ref name) => self.context.new_location(
name.path(rustc_span::RemapPathScopeComponents::DEBUGINFO).to_string_lossy(),
line as i32,
col as i32,
),
_ => Location::null(),
}
}

fn create_dbg_var(
&mut self,
_variable_name: Symbol,
_variable_type: Ty<'tcx>,
_scope_metadata: Self::DIScope,
_variable_kind: VariableKind,
_span: Span,
) -> Self::DIVariable {
}

// 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(
Expand Down Expand Up @@ -103,6 +163,10 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
DebugLoc { file, line, col }
}
}

pub(crate) fn debuginfo_finalize(&self) {
self.context.set_debug_info(true)
}
}

impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
Expand All @@ -114,68 +178,4 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
) {
// FIXME(antoyo)
}

fn dbg_create_lexical_block(
&self,
_pos: BytePos,
_parent_scope: Self::DIScope,
) -> Self::DIScope {
}

fn dbg_location_clone_with_discriminator(
&self,
loc: Self::DILocation,
_discriminator: u32,
) -> Option<Self::DILocation> {
Some(loc)
}

fn extend_scope_to_file(
&self,
_scope_metadata: Self::DIScope,
_file: &SourceFile,
) -> Self::DIScope {
// FIXME(antoyo): implement.
}

fn debuginfo_finalize(&self) {
self.context.set_debug_info(true)
}

fn create_dbg_var(
&self,
_variable_name: Symbol,
_variable_type: Ty<'tcx>,
_scope_metadata: Self::DIScope,
_variable_kind: VariableKind,
_span: Span,
) -> Self::DIVariable {
}

fn dbg_scope_fn(
&self,
_instance: Instance<'tcx>,
_fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
_maybe_definition_llfn: Option<Function<'gcc>>,
) -> Self::DIScope {
// FIXME(antoyo): implement.
}

fn dbg_loc(
&self,
_scope: Self::DIScope,
_inlined_at: Option<Self::DILocation>,
span: Span,
) -> Self::DILocation {
let pos = span.lo();
let DebugLoc { file, line, col } = self.lookup_debug_loc(pos);
match file.name {
rustc_span::FileName::Real(ref name) => self.context.new_location(
name.path(rustc_span::RemapPathScopeComponents::DEBUGINFO).to_string_lossy(),
line as i32,
col as i32,
),
_ => Location::null(),
}
}
}
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ pub(crate) unsafe fn codegen(
);

if tcx.sess.opts.debuginfo != DebugInfo::None {
let dbg_cx = debuginfo::CodegenUnitDebugContext::new(cx.llmod);
let dbg_cx = debuginfo::CodegenUnitDebugContext::new(cx.llmod, tcx.sess);
debuginfo::metadata::build_compile_unit_di_node(tcx, module_name, &dbg_cx);
dbg_cx.finalize(tcx.sess);
dbg_cx.finalize();
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
tcx.sess.instrument_coverage().then(coverageinfo::CguCoverageContext::new);

let dbg_cx = if tcx.sess.opts.debuginfo != DebugInfo::None {
let dctx = debuginfo::CodegenUnitDebugContext::new(llmod);
let dctx = debuginfo::CodegenUnitDebugContext::new(llmod, tcx.sess);
debuginfo::metadata::build_compile_unit_di_node(
tcx,
codegen_unit.name().as_str(),
Expand Down
Loading
Loading