2016-03-16 31 views
8

Czy istnieje standardowa metodologia debugowania przepełnienia stosu? Uzyskanie śladu zwrotnego byłoby miłe.Debugowanie przepełnienia stosu w Rust

$ 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. 
+1

Czy próbowałeś z 'RUST_BACKTRACE test' = 1 cargo? (Nie jestem pewien, czy wyświetla coś ekstra przy przepełnieniu stosu, ale robi to w przypadku innej paniki) – viraptor

+1

Tak. Nie działa. – dhardy

Odpowiedz

5

Oczywiście, istnieje prosta odpowiedź:

$ 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 
...