Invalid symbols and missing location for DWARF files when using samply-symbols crate
Hello, I encountered the following problem when using [samply-symbols](https://github.com/mstange/samply/tree/main/samply-symbols): for a binary compiled for Linux, it is not possible to obtain normal symbols and location, file name and line number. Moreover, everything is in the file itself. I made a small [MVP](https://github.com/bugrazoid/symbolic-fail/tree/master) for Linux, which shows that there are both symbols for the function and data on its location.
This is what I get for the `lib_fn` function from my MVP:
```
[app/src/main.rs:66:9] &symbol = AddressInfo {
symbol: SymbolInfo {
address: 43312,
size: Some(
50,
),
name: "lib_fn\0_Unwind_Resume@@GCC_3.0\0__cxa_finalize@@GLIBC_2.2.5\0_Unwind_SetIP@@GCC_3.0\0",
},
frames: None,
}
```
It can be seen that `symbol.name` contains the desired name, but there are also extra symbols. And for some reason there are no frames in which, in PDB and Mach-o, both the normal function names and their locations were located.
If you inspect the file itself, you can see that there is a function name there:
```
$ readelf -s -W liblib.so | grep lib_fn
51: 000000000000a930 50 FUNC GLOBAL DEFAULT 11 lib_fn
795: 000000000000a930 50 FUNC GLOBAL DEFAULT 11 lib_fn
```
and data about the file and line:
```
$ readelf --debug-dump=decodedline liblib.so | head -n11
Contents of the .debug_line section:
CU: lib/src/lib.rs:
File name Line number Starting address View
lib.rs 2 0xa930
lib.rs 3 0xa934
lib.rs 2 0xa947
lib.rs 3 0xa94d
lib.rs 4 0xa95d
lib.rs 4 0xa962
```
Please tell me, maybe I'm doing something wrong? Or is there some other problem?
Details:
```toml
samply-symbols = "0.24.1"
```
```
$ hostnamectl
Static hostname: ---some hostname---
Icon name: computer-desktop
Chassis: desktop
Machine ID: ec82cd0f07dc4e8693659ac3d73b5b87
Boot ID: 45b78bb348744e6b93637eb6b5f90c78
Operating System: CentOS Linux 8
CPE OS Name: cpe:/o:centos:centos:8
Kernel: Linux 4.18.0-348.7.1.el8_5.x86_64
Architecture: x86-64
```
关闭于 2026-02-02 3 条评论