Skip to content

Commit f675431

Browse files
committed
Use the symbol table if the DWARF only has line numbers
This can occur for skeleton units in split DWARF. Also bump addr2line to 0.14.1 to get a related fix there so that it returns the location in this case. This fixes backtraces with RUSTFLAGS="-Z split-dwarf=split -C save-temps".
1 parent 47069af commit f675431

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ jobs:
8989
if: contains(matrix.os, 'ubuntu')
9090
- run: cargo clean && RUSTFLAGS="-Z run-dsymutil=no" cargo test --features gimli-symbolize
9191
if: matrix.thing == 'macos-nightly'
92+
- run: cargo clean && RUSTFLAGS="-Z split-dwarf=split -C save-temps" cargo test --features gimli-symbolize
93+
if: matrix.thing == 'nightly'
9294
- run: cargo build --manifest-path crates/as-if-std/Cargo.toml
9395

9496
windows_arm64:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cpp_demangle = { default-features = false, version = "0.3.0", optional = true }
3535

3636
# Optional dependencies enabled through the `gimli-symbolize` feature, do not
3737
# use these features directly.
38-
addr2line = { version = "0.14.0", optional = true, default-features = false }
38+
addr2line = { version = "0.14.1", optional = true, default-features = false }
3939
miniz_oxide = { version = "0.4.0", optional = true, default-features = false }
4040
[dependencies.object]
4141
version = "0.22"

crates/as-if-std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ bench = false
1515
cfg-if = "1.0"
1616
rustc-demangle = "0.1.4"
1717
libc = { version = "0.2.45", default-features = false }
18-
addr2line = { version = "0.14.0", default-features = false }
18+
addr2line = { version = "0.14.1", default-features = false }
1919
miniz_oxide = { version = "0.4.0", default-features = false }
2020

2121
[dependencies.object]

src/symbolize/gimli.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,14 @@ pub unsafe fn resolve(what: ResolveWhat<'_>, cb: &mut dyn FnMut(&super::Symbol))
621621
if let Ok(mut frames) = cx.dwarf.find_frames(addr as u64) {
622622
while let Ok(Some(frame)) = frames.next() {
623623
any_frames = true;
624+
let name = match frame.function {
625+
Some(f) => Some(f.name.slice()),
626+
None => cx.object.search_symtab(addr as u64),
627+
};
624628
call(Symbol::Frame {
625629
addr: addr as *mut c_void,
626630
location: frame.location,
627-
name: frame.function.map(|f| f.name.slice()),
631+
name,
628632
});
629633
}
630634
}
@@ -633,10 +637,14 @@ pub unsafe fn resolve(what: ResolveWhat<'_>, cb: &mut dyn FnMut(&super::Symbol))
633637
if let Ok(mut frames) = object_cx.dwarf.find_frames(object_addr) {
634638
while let Ok(Some(frame)) = frames.next() {
635639
any_frames = true;
640+
let name = match frame.function {
641+
Some(f) => Some(f.name.slice()),
642+
None => cx.object.search_symtab(addr as u64),
643+
};
636644
call(Symbol::Frame {
637645
addr: addr as *mut c_void,
638646
location: frame.location,
639-
name: frame.function.map(|f| f.name.slice()),
647+
name,
640648
});
641649
}
642650
}

0 commit comments

Comments
 (0)