Skip to content

Commit e27de2a

Browse files
chore(deps): update rust crate gimli to 0.33.0 (#648)
* chore(deps): update rust crate gimli to 0.33.0 * update to new gimli version --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: JonasKruckenberg <iterpre@protonmail.com>
1 parent 916137e commit e27de2a

File tree

12 files changed

+75
-30
lines changed

12 files changed

+75
-30
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ lock_api = "0.4.13"
109109
static_assertions = "1.1.0"
110110
rand = { version = "0.9.2", default-features = false }
111111
rand_chacha = { version = "0.9.0", default-features = false }
112-
gimli = { version = "0.31.1", default-features = false, features = ["read"] }
112+
gimli = { version = "0.33.0", default-features = false, features = ["read"] }
113113
talc = { version = "4.4.2", default-features = false, features = ["lock_api", "counters"] }
114114
smallvec = { version = "1", default-features = false }
115115
rustc-demangle = "0.1"

libs/abort/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ pub fn abort() -> ! {
3030
} else if #[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))] {
3131
riscv::exit(1);
3232
} else {
33-
compile_error!("unsupported target architecture")
33+
loop {}
34+
// compile_error!("unsupported target architecture")
3435
}
3536
}
3637
}

libs/addr2line/src/function.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use alloc::boxed::Box;
99
use alloc::vec::Vec;
1010
use core::cmp::Ordering;
1111

12+
use gimli::ReaderOffset;
13+
1214
// use crate::lazy::LazyResult;
1315
use crate::{Context, DebugFile, Error, RangeAttributes};
1416
use crate::{LazyResult, maybe_small};
@@ -304,7 +306,7 @@ impl<R: gimli::Reader> Function<R> {
304306
}
305307

306308
fn skip(
307-
entries: &mut gimli::EntriesRaw<'_, '_, R>,
309+
entries: &mut gimli::EntriesRaw<'_, R>,
308310
abbrev: &gimli::Abbreviation,
309311
depth: isize,
310312
) -> Result<(), Error> {
@@ -458,7 +460,7 @@ impl<R: gimli::Reader> InlinedFunction<R> {
458460

459461
struct InlinedState<'a, R: gimli::Reader> {
460462
// Mutable fields.
461-
entries: gimli::EntriesRaw<'a, 'a, R>,
463+
entries: gimli::EntriesRaw<'a, R>,
462464
functions: Vec<InlinedFunction<R>>,
463465
addresses: Vec<InlinedFunctionAddress>,
464466

@@ -520,7 +522,7 @@ where
520522
let abbrev = if let Some(abbrev) = entries.read_abbreviation()? {
521523
abbrev
522524
} else {
523-
return Err(gimli::Error::NoEntryAtGivenOffset);
525+
return Err(gimli::Error::NoEntryAtGivenOffset(offset.0.into_u64()));
524526
};
525527

526528
let mut name = None;

libs/addr2line/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ extern crate alloc;
2929
use alloc::sync::Arc;
3030
use core::ops::ControlFlow;
3131

32+
use gimli::ReaderOffset;
33+
3234
use crate::function::{Function, InlinedFunction, LazyFunctions};
3335
use crate::line::{LazyLines, LineLocationRangeIter, Lines};
3436
use crate::lookup::{LoopingLookup, SimpleLookup};
@@ -90,6 +92,9 @@ impl<R: gimli::Reader> Context<R> {
9092
debug_rnglists: gimli::DebugRngLists<R>,
9193
debug_str: gimli::DebugStr<R>,
9294
debug_str_offsets: gimli::DebugStrOffsets<R>,
95+
debug_macinfo: gimli::DebugMacinfo<R>,
96+
debug_macro: gimli::DebugMacro<R>,
97+
debug_names: gimli::DebugNames<R>,
9398
default_section: R,
9499
) -> Result<Self, Error> {
95100
Self::from_dwarf(gimli::Dwarf {
@@ -101,6 +106,9 @@ impl<R: gimli::Reader> Context<R> {
101106
debug_line_str,
102107
debug_str,
103108
debug_str_offsets,
109+
debug_macinfo,
110+
debug_macro,
111+
debug_names,
104112
debug_types: default_section.clone().into(),
105113
locations: gimli::LocationLists::new(
106114
default_section.clone().into(),
@@ -214,12 +222,12 @@ impl<R: gimli::Reader> Context<R> {
214222
let unit = match file {
215223
DebugFile::Primary => self.units.find_offset(offset)?,
216224
DebugFile::Supplementary => self.sup_units.find_offset(offset)?,
217-
DebugFile::Dwo => return Err(gimli::Error::NoEntryAtGivenOffset),
225+
DebugFile::Dwo => return Err(gimli::Error::NoEntryAtGivenOffset(offset.0.into_u64())),
218226
};
219227

220228
let unit_offset = offset
221229
.to_unit_offset(&unit.header)
222-
.ok_or(gimli::Error::NoEntryAtGivenOffset)?;
230+
.ok_or(gimli::Error::NoEntryAtGivenOffset(offset.0.into_u64()))?;
223231
Ok((unit, unit_offset))
224232
}
225233
}

libs/addr2line/src/unit.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use alloc::vec::Vec;
1111
use core::cmp;
1212

1313
use fallible_iterator::FallibleIterator;
14+
use gimli::ReaderOffset;
1415

1516
use crate::{
1617
Context, DebugFile, Error, Function, LazyFunctions, LazyLines, LazyResult,
@@ -203,7 +204,7 @@ impl<R: gimli::Reader> ResUnits<R> {
203204
let mut units = sections.units();
204205
while let Some(header) = units.next()? {
205206
let unit_id = res_units.len();
206-
let offset = match header.offset().as_debug_info_offset() {
207+
let offset = match header.offset().to_debug_info_offset(&header) {
207208
Some(offset) => offset,
208209
None => continue,
209210
};
@@ -365,7 +366,7 @@ impl<R: gimli::Reader> ResUnits<R> {
365366
.binary_search_by_key(&offset.0, |unit| unit.offset.0)
366367
{
367368
// There is never a DIE at the unit offset or before the first unit.
368-
Ok(_) | Err(0) => Err(gimli::Error::NoEntryAtGivenOffset),
369+
Ok(_) | Err(0) => Err(gimli::Error::NoEntryAtGivenOffset(offset.0.into_u64())),
369370
Err(i) => Ok(&self.units[i - 1].dw_unit),
370371
}
371372
}
@@ -479,7 +480,7 @@ impl<R: gimli::Reader> SupUnits<R> {
479480
let mut sup_units = Vec::new();
480481
let mut units = sections.units();
481482
while let Some(header) = units.next()? {
482-
let offset = match header.offset().as_debug_info_offset() {
483+
let offset = match header.offset().to_debug_info_offset(&header) {
483484
Some(offset) => offset,
484485
None => continue,
485486
};
@@ -503,7 +504,7 @@ impl<R: gimli::Reader> SupUnits<R> {
503504
.binary_search_by_key(&offset.0, |unit| unit.offset.0)
504505
{
505506
// There is never a DIE at the unit offset or before the first unit.
506-
Ok(_) | Err(0) => Err(gimli::Error::NoEntryAtGivenOffset),
507+
Ok(_) | Err(0) => Err(gimli::Error::NoEntryAtGivenOffset(offset.0.into_u64())),
507508
Err(i) => Ok(&self.units[i - 1].dw_unit),
508509
}
509510
}

libs/unwind/src/arch/aarch64.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use core::{fmt, ops};
1111

1212
use cfg_if::cfg_if;
13-
use gimli::{AArch64, Register};
13+
use gimli::{AArch64, Register, RegisterRule};
1414

1515
// Match DWARF_FRAME_REGISTERS in libgcc
1616
pub const MAX_REG_RULES: usize = 97;
@@ -30,6 +30,25 @@ cfg_if! {
3030
}
3131
}
3232

33+
/// Returns the default register rule for the given register on this architecture.
34+
pub fn default_register_rule_for(reg: Register) -> RegisterRule<usize> {
35+
// the AArch64 DWARF standard requires rules for callee-saved registers and
36+
// "registers intentionally unused by the program, for example as a consequence of the procedure call standard"
37+
// to be initialized to `RegisterRule::SameValue` while other registers should be initialized to `RegisterRule::Undefined`.
38+
// <https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#43common-information-entries>
39+
//
40+
// <https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#61machine-registers>
41+
// defines callee-saved registers to be
42+
//
43+
// general purpose registers r19-r28
44+
// and SIMD/fp registers v8-v15
45+
match reg {
46+
Register(19..=28) => RegisterRule::SameValue,
47+
Register(72..=79) => RegisterRule::SameValue,
48+
_ => RegisterRule::Undefined,
49+
}
50+
}
51+
3352
/// Register context when unwinding.
3453
///
3554
/// This type is architecture-dependent, but generally holds a copy of all registers that are required

libs/unwind/src/arch/riscv64.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use core::{fmt, ops};
1111

1212
use cfg_if::cfg_if;
13-
use gimli::{Register, RiscV};
13+
use gimli::{Register, RegisterRule, RiscV};
1414

1515
// Match DWARF_FRAME_REGISTERS in libgcc
1616
pub const MAX_REG_RULES: usize = 65;
@@ -33,6 +33,12 @@ pub const UNWIND_DATA_REG: (Register, Register) = (RiscV::A0, RiscV::A1);
3333
#[cfg(all(target_feature = "f", not(target_feature = "d")))]
3434
compile_error!("RISC-V with only F extension is not supported");
3535

36+
/// Returns the default register rule for the given register on this architecture.
37+
pub fn default_register_rule_for(_reg: Register) -> RegisterRule<usize> {
38+
// As far as I can tell RISCV has no special requirements
39+
RegisterRule::Undefined
40+
}
41+
3642
/// Register context when unwinding.
3743
///
3844
/// This type is architecture-dependent, but generally holds a copy of all registers that are required

libs/unwind/src/arch/x86_64.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@
44
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
55
// http://opensource.org/licenses/MIT>, at your option. This file may not be
66
// copied, modified, or distributed except according to those terms.
7+
8+
/// Returns the default register rule for the given register on this architecture.
9+
pub fn default_register_rule_for(_reg: Register) -> RegisterRule<usize> {
10+
// As far as I can tell x86_64 has no special requirements
11+
RegisterRule::Undefined
12+
}

libs/unwind/src/eh_action.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,20 @@ fn read_encoded_pointer(
143143
constants::DW_EH_PE_pcrel => input.slice().as_ptr() as u64,
144144
constants::DW_EH_PE_funcrel => {
145145
if frame.symbol_address() == 0 {
146-
return Err(gimli::Error::UnsupportedPointerEncoding);
146+
return Err(gimli::Error::UnsupportedPointerEncoding(encoding));
147147
}
148148
frame.symbol_address()
149149
}
150150
constants::DW_EH_PE_textrel => frame
151151
.text_rel_base()
152-
.ok_or(gimli::Error::UnsupportedPointerEncoding)?,
152+
.ok_or(gimli::Error::UnsupportedPointerEncoding(encoding))?,
153153
constants::DW_EH_PE_datarel => frame
154154
.data_rel_base()
155-
.ok_or(gimli::Error::UnsupportedPointerEncoding)?,
155+
.ok_or(gimli::Error::UnsupportedPointerEncoding(encoding))?,
156156
constants::DW_EH_PE_aligned => {
157-
return Err(gimli::Error::UnsupportedPointerEncoding);
157+
return Err(gimli::Error::UnsupportedPointerEncoding(encoding));
158158
}
159-
_ => return Err(gimli::Error::UnsupportedPointerEncoding),
159+
_ => return Err(gimli::Error::UnsupportedPointerEncoding(encoding)),
160160
};
161161

162162
debug_assert_ne!(base, 0);

0 commit comments

Comments
 (0)