rust - 在 Rust 中调试堆栈溢出是否有任何标准方法?

标签 rust stack-overflow

获得回溯会很好。

$ cargo test
    Running target/debug/partition_ops-b31bcf7b82e2e8d5

running 1 test

thread 'create_small' has overflowed its stack
Process didn't exit successfully: `/home/dhardy/other/pippin/target/debug/partition_ops-b31bcf7b82e2e8d5` (signal: 11)

To learn more, run the command again with --verbose.

最佳答案

简单的答案是使用 GDB:

$ gdb --args target/debug/partition_ops-b31bcf7b82e2e8d5
...
(gdb) run
Starting program: /home/dhardy/other/pippin/target/debug/partition_ops-b31bcf7b82e2e8d5 
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.22-7.fc23.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

running 1 test
[New Thread 0x7ffff67ff700 (LWP 30769)]
[New Thread 0x7ffff5fff700 (LWP 30770)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff5fff700 (LWP 30770)]
0x00005555555f8a96 in pippin::detail::elt::PartId::from_num (n=1099511627775) at src/detail/elt.rs:36
36              assert!(n > 0 && n <= Self::max().into_num(), "PartId::from_num(n): n is invalid");
Missing separate debuginfos, use: dnf debuginfo-install libgcc-5.3.1-2.fc23.x86_64
(gdb) bt
#0  0x00005555555f8a96 in pippin::detail::elt::PartId::from_num (n=1099511627775) at src/detail/elt.rs:36
#1  0x00005555555f8b57 in pippin::detail::elt::PartId::max () at src/detail/elt.rs:56
#2  0x00005555555f8ab3 in pippin::detail::elt::PartId::from_num (n=1099511627775) at src/detail/elt.rs:36
#3  0x00005555555f8b57 in pippin::detail::elt::PartId::max () at src/detail/elt.rs:56
...

关于rust - 在 Rust 中调试堆栈溢出是否有任何标准方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36041974/

相关文章:

不同模块中的 Rust 常量?

c# - JsonConvert.DeserializeObject() 抛出 StackOverflow 异常

c - 线程堆栈溢出

java - 使用quickSort时出现stackoverflowerror,我可以增加堆栈和堆吗?

GUI 中的 Java StackOverflowException

rust - 打印!借用或拥有变量?

git - 如何让 git config ReplaceOf 与 Cargo 一起使用?

rust - 如何将具有 `Read`特征的字符串形式的东西传递给 `From`的实现?

rust - rust-toolchain.toml 可以作为开发环境描述符吗

java - KeyListener 中出现意外的 StackOverflowError