Skip to content

Commit 9f24a93

Browse files
authored
Use the symbol table if the DWARF only has line numbers (#401)
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 9f24a93

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.github/workflows/main.yml

+2
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

+1-1
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

+1-1
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

+5-1
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
}

0 commit comments

Comments
 (0)