cargo-call-stack
cargo-call-stack copied to clipboard
Unable to get the call stack of a simple hello world project: BUG: callee `SOME_FUNC` is unknown
I tried cargo-call-stack in a brand new Linux environment with the simplest hello world project(by cargo new hello_world), but the tool complains BUG: SOME_FUNC is unknown
.
The whole process can be produced step by step like this:
rustup install stable # Follow the tips in the README file that: NOTE always use the latest stable release
rustup +nightly component add rust-src
cargo new hello_world
cd hello_world
# Add the following configs to Cargo.toml:
[profile.release]
# `lto = true` should also work
lto = 'fat'
cargo call-stack --bin my_hello --target x86_64-unknown-linux-gnu
Then the whole log is like this:
Compiling my_hello v0.1.0 (/home/lance/Development/rust/my_hello)
Finished release [optimized] target(s) in 2.19s
[2023-10-25T11:09:05Z WARN cargo_call_stack] no stack usage information for `_init`
[2023-10-25T11:09:05Z WARN cargo_call_stack] no type information for `_init`
[2023-10-25T11:09:05Z WARN cargo_call_stack] no stack usage information for `_start`
[2023-10-25T11:09:05Z WARN cargo_call_stack] no type information for `_start`
[2023-10-25T11:09:05Z WARN cargo_call_stack] no stack usage information for `_fini`
[2023-10-25T11:09:05Z WARN cargo_call_stack] no type information for `_fini`
thread 'main' panicked at /home/lance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-call-stack-0.1.15/src/main.rs:708:25:
BUG: callee `malloc` is unknown
stack backtrace:
0: rust_begin_unwind
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
1: core::panicking::panic_fmt
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
2: cargo_call_stack::run
3: cargo_call_stack::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The toolchain binary versions:
rustup --version
rustup 1.26.0 (2023-05-04)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.73.0 (cc66ad468 2023-10-03)`
rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03)
cargo --version
cargo 1.73.0 (9c4383fb5 2023-08-26)
cargo +nightly call-stack --version
cargo-call-stack 0.1.15
I've followed the solution in #61 to run with target x86_64-unknown-linux-musl:
rustup target add x86_64-unknown-linux-musl --toolchain nightly
pacman -S musl #install the musl lib in system level
cargo call-stack --bin my_hello --target x86_64-unknown-linux-gnu
This time it complains another unknown callee:
...
...
...lots of call stack info
...
BUG: callee `__cxa_thread_atexit_impl` is unknown
Is there any clue on this?