Misc debuginfo.rs changes

This commit is contained in:
bjorn3 2019-02-01 19:31:26 +01:00
parent 410d397bcd
commit 99e43822b4

View File

@ -46,7 +46,6 @@ fn line_program_add_file(line_program: &mut LineProgram, file: &FileName) -> Fil
)
}
}
}
struct DebugReloc {
@ -57,16 +56,20 @@ struct DebugReloc {
}
pub struct DebugContext<'tcx> {
// Encoding info
encoding: Encoding,
endian: RunTimeEndian,
symbols: indexmap::IndexSet<String>,
strings: StringTable,
// Main data
units: UnitTable,
line_programs: LineProgramTable,
// Side tables
strings: StringTable,
range_lists: RangeListTable,
// Global ids
unit_id: UnitId,
global_line_program: LineProgramId,
unit_range_list: RangeList,
@ -93,11 +96,12 @@ pub fn new(tcx: TyCtxt, address_size: u8) -> Self {
None => tcx.crate_name(LOCAL_CRATE).to_string(),
};
let mut units = UnitTable::default();
let mut strings = StringTable::default();
let mut line_programs = LineProgramTable::default();
let range_lists = RangeListTable::default();
let mut units = UnitTable::default();
let mut line_programs = LineProgramTable::default();
let global_line_program = line_programs.add(LineProgram::new(
encoding,
1,
@ -140,13 +144,13 @@ pub fn new(tcx: TyCtxt, address_size: u8) -> Self {
DebugContext {
encoding,
endian: target_endian(tcx),
symbols: indexmap::IndexSet::new(),
strings,
range_lists,
units,
line_programs,
range_lists,
unit_id,
global_line_program,
@ -194,8 +198,10 @@ pub fn emit(&mut self, artifact: &mut Artifact) {
let mut debug_ranges = DebugRanges::from(WriterRelocate::new(self));
let mut debug_rnglists = DebugRngLists::from(WriterRelocate::new(self));
let debug_line_offsets = self.line_programs.write(&mut debug_line).unwrap();
let debug_str_offsets = self.strings.write(&mut debug_str).unwrap();
let debug_line_offsets = self.line_programs.write(&mut debug_line).unwrap();
let range_list_offsets = self
.range_lists
.write(