I am working through the book Rust In Action (currently available through the Manning Early Access Program), and one of the author's debugging instructions is not working as expected. I don't know if there's actually anything wrong, maybe it's just a matter of peculiarities of different systems.
Anyway, there is an example program that is supposed to illustrate heap allocation, and the instructions say to compile the program with
cargo build, then execute as follows:
timeout 20 ltrace -T -o trace.txt -e -*+malloc+free+realloc ./target/debug/particle
But for me, the
trace.txt file does not contain any information, except for:
--- SIGTERM (Terminated) --- +++ killed by SIGTERM +++
I searched for relevant info and didn't find much, but I did see a forum post somewhere indicating that ltrace might not work on PIE executables, so I tried
RUSTFLAGS='-g -C relocation-model=dynamic-no-pic' cargo build
... but that did not make any difference.
Anybody have an idea what I can do to make ltrace work as expected? I'm using Rust 1.47 on Manjaro Linux.