Skip to content

Commit ddbbb26

Browse files
committed
Update gimli
1 parent 36f6e2f commit ddbbb26

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/debuginfo.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use gimli::write::{
1111
RangeList, RangeListTable, Result, SectionId, StringTable, UnitEntryId, UnitId, UnitTable,
1212
Writer, FileId,
1313
};
14-
use gimli::{Endianity, Format, RunTimeEndian};
14+
use gimli::{Encoding, Format, RunTimeEndian};
1515

1616
use faerie::*;
1717

@@ -43,10 +43,8 @@ struct DebugReloc {
4343
}
4444

4545
pub struct DebugContext<'tcx> {
46+
encoding: Encoding,
4647
endian: RunTimeEndian,
47-
format: Format,
48-
version: u16,
49-
address_size: u8,
5048

5149
symbols: indexmap::IndexSet<String>,
5250

@@ -64,9 +62,13 @@ pub struct DebugContext<'tcx> {
6462

6563
impl<'a, 'tcx: 'a> DebugContext<'tcx> {
6664
pub fn new(tcx: TyCtxt, address_size: u8) -> Self {
67-
// TODO: this should be configurable
68-
let version = 3; // macOS doesn't seem to support DWARF > 3
69-
let format = Format::Dwarf32;
65+
let encoding = Encoding {
66+
format: Format::Dwarf32,
67+
// TODO: this should be configurable
68+
// macOS doesn't seem to support DWARF > 3
69+
version: 3,
70+
address_size,
71+
};
7072

7173
// FIXME: how to get version when building out of tree?
7274
// Normally this would use option_env!("CFG_VERSION").
@@ -83,9 +85,7 @@ impl<'a, 'tcx: 'a> DebugContext<'tcx> {
8385
let range_lists = RangeListTable::default();
8486

8587
let global_line_program = line_programs.add(LineProgram::new(
86-
version,
87-
address_size,
88-
format,
88+
encoding,
8989
1,
9090
1,
9191
-5,
@@ -95,7 +95,7 @@ impl<'a, 'tcx: 'a> DebugContext<'tcx> {
9595
None,
9696
));
9797

98-
let unit_id = units.add(CompilationUnit::new(version, address_size, format));
98+
let unit_id = units.add(CompilationUnit::new(encoding));
9999
{
100100
let name = strings.add(&*name);
101101
let comp_dir = strings.add(&*comp_dir);
@@ -124,10 +124,8 @@ impl<'a, 'tcx: 'a> DebugContext<'tcx> {
124124
}
125125

126126
DebugContext {
127+
encoding,
127128
endian: target_endian(tcx),
128-
format,
129-
version,
130-
address_size,
131129

132130
symbols: indexmap::IndexSet::new(),
133131

@@ -189,9 +187,7 @@ impl<'a, 'tcx: 'a> DebugContext<'tcx> {
189187
.write(
190188
&mut debug_ranges,
191189
&mut debug_rnglists,
192-
self.format,
193-
self.version,
194-
self.address_size,
190+
self.encoding
195191
)
196192
.unwrap();
197193
self.units
@@ -417,9 +413,7 @@ impl<'a, 'b, 'tcx: 'b> FunctionDebugContext<'a, 'tcx> {
417413
let unit = self.debug_context.units.get_mut(self.debug_context.unit_id);
418414
// FIXME: add to appropriate scope intead of root
419415
let entry = unit.get_mut(self.entry_id);
420-
let mut size_array = [0; 8];
421-
target_endian(tcx).write_u64(&mut size_array, code_size as u64);
422-
entry.set(gimli::DW_AT_high_pc, AttributeValue::Data8(size_array));
416+
entry.set(gimli::DW_AT_high_pc, AttributeValue::Data8(code_size as u64));
423417

424418
self.debug_context.unit_range_list.0.push(Range {
425419
begin: Address::Relative {

0 commit comments

Comments
 (0)