py-spy
py-spy copied to clipboard
test_coredump: fix unaligned pointer dereference
This fixes the test but I still cannot get a coredump to load locally - the executable cannot be located in it, same goes for any other dump I tried. I'll add details in a comment.
The panic observed on master.
$ cargo test test_coredump
Compiling py-spy v0.3.14 (/home/karoline/IDE/py-spy)
Finished test [unoptimized + debuginfo] target(s) in 4.80s
Running unittests src/lib.rs (target/debug/deps/py_spy-6453fb3149eb3ee2)
running 1 test
thread 'coredump::test::test_coredump' panicked at src/coredump.rs:94:30:
misaligned pointer dereference: address must be a multiple of 0x8 but is 0x7fa7adbaa334
stack backtrace:
0: rust_begin_unwind
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
1: core::panicking::panic_nounwind_fmt::runtime
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:110:18
2: core::panicking::panic_nounwind_fmt
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:122:9
3: core::panicking::panic_misaligned_pointer_dereference
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:221:5
4: py_spy::coredump::CoreDump::new
at ./src/coredump.rs:94:30
5: py_spy::coredump::test::test_coredump
at ./src/coredump.rs:438:20
6: py_spy::coredump::test::test_coredump::{{closure}}
at ./src/coredump.rs:434:23
7: core::ops::function::FnOnce::call_once
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
8: core::ops::function::FnOnce::call_once
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread caused non-unwinding panic. aborting.
error: test failed, to rerun pass `--lib`
Caused by:
process didn't exit successfully: `/home/karoline/IDE/py-spy/target/debug/deps/py_spy-6453fb3149eb3ee2 test_coredump` (signal: 6, SIGABRT: process abort signal)
In [1]: 0x7fa7adbaa334 % 8
Out[1]: 4
$ cargo rustc --bin py-spy -- -V
Compiling py-spy v0.3.14 (/home/karoline/IDE/py-spy)
rustc 1.76.0 (07dca489a 2024-02-04)
$ uname -a
Linux hostname 5.15.0-97-lowlatency #107-Ubuntu SMP PREEMPT Fri Feb 9 11:16:34 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux