Rustfmt debuginfo
This commit is contained in:
parent
c5c6ce87d2
commit
d8e9148c2e
2 changed files with 48 additions and 48 deletions
|
@ -5,8 +5,7 @@ use syntax::source_map::FileName;
|
||||||
use cranelift::codegen::binemit::CodeOffset;
|
use cranelift::codegen::binemit::CodeOffset;
|
||||||
|
|
||||||
use gimli::write::{
|
use gimli::write::{
|
||||||
Address, AttributeValue, FileId, LineProgram, LineString,
|
Address, AttributeValue, FileId, LineProgram, LineString, LineStringTable, Range, UnitEntryId,
|
||||||
LineStringTable, Range, UnitEntryId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn line_program_add_file(
|
fn line_program_add_file(
|
||||||
|
@ -131,11 +130,15 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||||
let entry = self.debug_context.dwarf.unit.get_mut(self.entry_id);
|
let entry = self.debug_context.dwarf.unit.get_mut(self.entry_id);
|
||||||
entry.set(
|
entry.set(
|
||||||
gimli::DW_AT_low_pc,
|
gimli::DW_AT_low_pc,
|
||||||
AttributeValue::Address(Address::Symbol { symbol: self.symbol, addend: 0 }),
|
AttributeValue::Address(Address::Symbol {
|
||||||
|
symbol: self.symbol,
|
||||||
|
addend: 0,
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(end as u64));
|
entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(end as u64));
|
||||||
|
|
||||||
self.debug_context.emit_location(self.entry_id, self.mir.span);
|
self.debug_context
|
||||||
|
.emit_location(self.entry_id, self.mir.span);
|
||||||
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ use cranelift::codegen::ir::{StackSlots, ValueLoc};
|
||||||
use cranelift::codegen::isa::RegUnit;
|
use cranelift::codegen::isa::RegUnit;
|
||||||
|
|
||||||
use gimli::write::{
|
use gimli::write::{
|
||||||
self, Address, AttributeValue, DwarfUnit, Expression, LineProgram, LineString,
|
self, Address, AttributeValue, DwarfUnit, Expression, LineProgram, LineString, Location,
|
||||||
Location, LocationList, Range, RangeList, UnitEntryId, Writer,
|
LocationList, Range, RangeList, UnitEntryId, Writer,
|
||||||
};
|
};
|
||||||
use gimli::{Encoding, Format, LineEncoding, Register, RunTimeEndian, X86_64};
|
use gimli::{Encoding, Format, LineEncoding, Register, RunTimeEndian, X86_64};
|
||||||
|
|
||||||
|
@ -105,9 +105,7 @@ impl<'tcx> DebugContext<'tcx> {
|
||||||
return *type_id;
|
return *type_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_entry = |dwarf: &mut DwarfUnit, tag| {
|
let new_entry = |dwarf: &mut DwarfUnit, tag| dwarf.unit.add(dwarf.unit.root(), tag);
|
||||||
dwarf.unit.add(dwarf.unit.root(), tag)
|
|
||||||
};
|
|
||||||
|
|
||||||
let primtive = |dwarf: &mut DwarfUnit, ate| {
|
let primtive = |dwarf: &mut DwarfUnit, ate| {
|
||||||
let type_id = new_entry(dwarf, gimli::DW_TAG_base_type);
|
let type_id = new_entry(dwarf, gimli::DW_TAG_base_type);
|
||||||
|
@ -122,7 +120,11 @@ impl<'tcx> DebugContext<'tcx> {
|
||||||
ty::Uint(_) => primtive(&mut self.dwarf, gimli::DW_ATE_unsigned),
|
ty::Uint(_) => primtive(&mut self.dwarf, gimli::DW_ATE_unsigned),
|
||||||
ty::Int(_) => primtive(&mut self.dwarf, gimli::DW_ATE_signed),
|
ty::Int(_) => primtive(&mut self.dwarf, gimli::DW_ATE_signed),
|
||||||
ty::Float(_) => primtive(&mut self.dwarf, gimli::DW_ATE_float),
|
ty::Float(_) => primtive(&mut self.dwarf, gimli::DW_ATE_float),
|
||||||
ty::Ref(_, pointee_ty, mutbl) | ty::RawPtr(ty::TypeAndMut { ty: pointee_ty, mutbl }) => {
|
ty::Ref(_, pointee_ty, mutbl)
|
||||||
|
| ty::RawPtr(ty::TypeAndMut {
|
||||||
|
ty: pointee_ty,
|
||||||
|
mutbl,
|
||||||
|
}) => {
|
||||||
let type_id = new_entry(&mut self.dwarf, gimli::DW_TAG_pointer_type);
|
let type_id = new_entry(&mut self.dwarf, gimli::DW_TAG_pointer_type);
|
||||||
|
|
||||||
// Ensure that type is inserted before recursing to avoid duplicates
|
// Ensure that type is inserted before recursing to avoid duplicates
|
||||||
|
@ -145,7 +147,10 @@ impl<'tcx> DebugContext<'tcx> {
|
||||||
let type_entry = self.dwarf.unit.get_mut(type_id);
|
let type_entry = self.dwarf.unit.get_mut(type_id);
|
||||||
|
|
||||||
type_entry.set(gimli::DW_AT_name, AttributeValue::String(name.into_bytes()));
|
type_entry.set(gimli::DW_AT_name, AttributeValue::String(name.into_bytes()));
|
||||||
type_entry.set(gimli::DW_AT_byte_size, AttributeValue::Udata(layout.size.bytes()));
|
type_entry.set(
|
||||||
|
gimli::DW_AT_byte_size,
|
||||||
|
AttributeValue::Udata(layout.size.bytes()),
|
||||||
|
);
|
||||||
|
|
||||||
self.types.insert(ty, type_id);
|
self.types.insert(ty, type_id);
|
||||||
|
|
||||||
|
@ -219,14 +224,8 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||||
.add(self.entry_id, gimli::DW_TAG_variable);
|
.add(self.entry_id, gimli::DW_TAG_variable);
|
||||||
let var_entry = self.debug_context.dwarf.unit.get_mut(var_id);
|
let var_entry = self.debug_context.dwarf.unit.get_mut(var_id);
|
||||||
|
|
||||||
var_entry.set(
|
var_entry.set(gimli::DW_AT_name, AttributeValue::String(name.into_bytes()));
|
||||||
gimli::DW_AT_name,
|
var_entry.set(gimli::DW_AT_type, AttributeValue::ThisUnitEntryRef(dw_ty));
|
||||||
AttributeValue::String(name.into_bytes()),
|
|
||||||
);
|
|
||||||
var_entry.set(
|
|
||||||
gimli::DW_AT_type,
|
|
||||||
AttributeValue::ThisUnitEntryRef(dw_ty),
|
|
||||||
);
|
|
||||||
|
|
||||||
var_id
|
var_id
|
||||||
}
|
}
|
||||||
|
@ -250,7 +249,6 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||||
length: end as u64,
|
length: end as u64,
|
||||||
});
|
});
|
||||||
|
|
||||||
{
|
|
||||||
let value_labels_ranges = context.build_value_labels_ranges(isa).unwrap();
|
let value_labels_ranges = context.build_value_labels_ranges(isa).unwrap();
|
||||||
|
|
||||||
for (value_label, value_loc_ranges) in value_labels_ranges.iter() {
|
for (value_label, value_loc_ranges) in value_labels_ranges.iter() {
|
||||||
|
@ -259,8 +257,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||||
let loc_list = LocationList(
|
let loc_list = LocationList(
|
||||||
value_loc_ranges
|
value_loc_ranges
|
||||||
.iter()
|
.iter()
|
||||||
.map(|value_loc_range| {
|
.map(|value_loc_range| Location::StartEnd {
|
||||||
Location::StartEnd {
|
|
||||||
begin: Address::Symbol {
|
begin: Address::Symbol {
|
||||||
symbol: self.symbol,
|
symbol: self.symbol,
|
||||||
addend: i64::from(value_loc_range.start),
|
addend: i64::from(value_loc_range.start),
|
||||||
|
@ -269,8 +266,9 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||||
symbol: self.symbol,
|
symbol: self.symbol,
|
||||||
addend: i64::from(value_loc_range.end),
|
addend: i64::from(value_loc_range.end),
|
||||||
},
|
},
|
||||||
data: Expression(translate_loc(value_loc_range.loc, &context.func.stack_slots).unwrap()),
|
data: Expression(
|
||||||
}
|
translate_loc(value_loc_range.loc, &context.func.stack_slots).unwrap(),
|
||||||
|
),
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
);
|
);
|
||||||
|
@ -283,7 +281,6 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue