Skip to content

Commit 99376a9

Browse files
authored
Merge pull request #30 from bjorn3/update_gimli
Bump gimli to 0.18.0
2 parents ee6030a + b626014 commit 99376a9

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: rust
2+
cache: cargo
3+
4+
os:
5+
- linux
6+
# - osx
7+
8+
rust: stable
9+
10+
script:
11+
- cd unwind && cargo build && (cargo run --example demo || true) && cargo run --example trace
12+
13+
env:
14+
- RUST_BACKTRACE=pretty

unwind/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
authors = ["main() <[email protected]>"]
55

66
[dependencies]
7-
gimli = "0.17"
7+
gimli = "0.18"
88
libc = "0.2"
99
fallible-iterator = "0.1"
1010
log = "0.4"

unwind/src/lib.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct ObjectRecord {
4646

4747
pub struct DwarfUnwinder {
4848
cfi: Vec<ObjectRecord>,
49-
ctx: Option<UninitializedUnwindContext<EhFrame<StaticReader>, StaticReader>>,
49+
ctx: UninitializedUnwindContext<StaticReader>,
5050
}
5151

5252
impl Default for DwarfUnwinder {
@@ -77,7 +77,7 @@ impl Default for DwarfUnwinder {
7777

7878
DwarfUnwinder {
7979
cfi,
80-
ctx: Some(UninitializedUnwindContext::new()),
80+
ctx: UninitializedUnwindContext::new(),
8181
}
8282
}
8383
}
@@ -96,28 +96,26 @@ struct UnwindInfo<R: Reader> {
9696
personality: Option<Pointer>,
9797
lsda: Option<Pointer>,
9898
initial_address: u64,
99-
ctx: UninitializedUnwindContext<EhFrame<StaticReader>, StaticReader>,
10099
}
101100

102101
impl ObjectRecord {
103-
fn unwind_info_for_address(&self,
104-
ctx: UninitializedUnwindContext<EhFrame<StaticReader>, StaticReader>,
105-
address: u64) -> gimli::Result<UnwindInfo<StaticReader>> {
102+
fn unwind_info_for_address(
103+
&self,
104+
ctx: &mut UninitializedUnwindContext<StaticReader>,
105+
address: u64,
106+
) -> gimli::Result<UnwindInfo<StaticReader>> {
106107
let &ObjectRecord {
107108
ref eh_frame_hdr,
108-
eh_frame: ref sel,
109+
ref eh_frame,
109110
ref bases,
110111
..
111112
} = self;
112113

113114
let fde = eh_frame_hdr.table().unwrap()
114-
.lookup_and_parse(address, bases, sel.clone(), |offset| sel.cie_from_offset(bases, offset))?;
115-
115+
.fde_for_address(eh_frame, bases, address, EhFrame::cie_from_offset)?;
116116
let mut result_row = None;
117-
let mut ctx = ctx.initialize(fde.cie()).unwrap();
118-
119117
{
120-
let mut table = UnwindTable::new(&mut ctx, &fde);
118+
let mut table = UnwindTable::new(eh_frame, bases, ctx, &fde)?;
121119
while let Some(row) = table.next_row()? {
122120
if row.contains(address) {
123121
result_row = Some(row.clone());
@@ -129,7 +127,6 @@ impl ObjectRecord {
129127
match result_row {
130128
Some(row) => Ok(UnwindInfo {
131129
row,
132-
ctx: ctx.reset(),
133130
personality: fde.personality(),
134131
lsda: fde.lsda(),
135132
initial_address: fde.initial_address(),
@@ -198,9 +195,7 @@ impl<'a> FallibleIterator for StackFrames<'a> {
198195

199196
let rec = self.unwinder.cfi.iter().filter(|x| x.er.text.contains(caller)).next().ok_or(gimli::Error::NoUnwindInfoForAddress)?;
200197

201-
let ctx = self.unwinder.ctx.take().unwrap_or_else(UninitializedUnwindContext::new);
202-
let UnwindInfo { row, personality, lsda, initial_address, ctx } = rec.unwind_info_for_address(ctx, caller)?;
203-
self.unwinder.ctx = Some(ctx);
198+
let UnwindInfo { row, personality, lsda, initial_address } = rec.unwind_info_for_address(&mut self.unwinder.ctx, caller)?;
204199

205200
trace!("ok: {:?} (0x{:x} - 0x{:x})", row.cfa(), row.start_address(), row.end_address());
206201
let cfa = match *row.cfa() {

unwind/src/unwind_helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
asm (
32
".global unwind_trampoline \n"
43
"unwind_trampoline: \n"

0 commit comments

Comments
 (0)