FS#75869 - [rust] cannot debug stdlib source code
Attached to Project:
Arch Linux
Opened by Henrique (hdante) - Saturday, 10 September 2022, 18:20 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:25 GMT
Opened by Henrique (hdante) - Saturday, 10 September 2022, 18:20 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:25 GMT
|
Details
Description: Hello, please provide the source code for the
rust standard library in the package, so that it's possible
to debug programs. Currently, it's not possible to debug any
code because stepping in gdb results on it trying to step
somewhere in stdlib code.
Additional info: * package version(s) rust 1:1.63.0-1 * config and/or log files etc. * link to upstream bug report, if any Steps to reproduce: Example debugging session: $ rust-gdb target/debug/tictactoe GNU gdb (GDB) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from target/debug/tictactoe... (gdb) break main Breakpoint 1 at 0x30ee7: main. (2 locations) (gdb) bt No stack. (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> 1.1 y 0x0000000000030ee7 in tictactoe::main at src/main.rs:24 1.2 y 0x00000000000310b0 <main> (gdb) run Starting program: /home/hdante/backupbackup/clean/Code/tictactoe/tokio/tictactoe/target/debug/tictactoe This GDB supports auto-downloading debuginfo from the following URLs: https://debuginfod.archlinux.org Enable debuginfod for this session? (y or [n]) y Debuginfod has been enabled. To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit. [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Breakpoint 1, 0x00005555555850b0 in main () (gdb) step Single stepping until exit from function main, which has no line number information. std::rt::lang_start<std::process::ExitCode> (main=0x555555584ee0 <tictactoe::main>, argc=1, argv=0x7fffffffe548) at /rustc/1.63.0/library/std/src/rt.rs:145 145 /rustc/1.63.0/library/std/src/rt.rs: Directory not empty. (gdb) 144 in /rustc/1.63.0/library/std/src/rt.rs (gdb) std::rt::lang_start_internal (main=..., argc=1, argv=0x7fffffffe548) at library/std/src/rt.rs:127 127 library/std/src/rt.rs: No such file or directory. (gdb) std::panic::catch_unwind<std::rt::lang_start_internal::{closure_env#1}, ()> (f=...) at library/std/src/panic.rs:137 137 library/std/src/panic.rs: Directory not empty. (gdb) std::panicking::try<(), std::rt::lang_start_internal::{closure_env#1}> (f=...) at library/std/src/panicking.rs:456 456 library/std/src/panicking.rs: Directory not empty. (gdb) std::panicking::try::do_call<std::rt::lang_start_internal::{closure_env#1}, ()> ( data=<optimized out>) at library/std/src/panicking.rs:492 492 in library/std/src/panicking.rs (gdb) std::rt::lang_start_internal::{closure#1} () at library/std/src/rt.rs:127 127 library/std/src/rt.rs: No such file or directory. (gdb) std::rt::init (argc=<optimized out>, argv=<optimized out>) at library/std/src/rt.rs:78 78 in library/std/src/rt.rs (gdb) std::sys::unix::init (argc=<optimized out>, argv=<optimized out>) at library/std/src/sys/unix/mod.rs:56 56 library/std/src/sys/unix/mod.rs: Directory not empty. (gdb) std::sys::unix::init::sanitize_standard_fds () at library/std/src/sys/unix/mod.rs:95 95 in library/std/src/sys/unix/mod.rs (gdb) 101 in library/std/src/sys/unix/mod.rs (gdb) __GI___poll (fds=0x7fffffffe310, nfds=3, timeout=0) at ../sysdeps/unix/sysv/linux/poll.c:27 Downloading 0.00 MB source file /usr/src/debug/glibc/io/../sysdeps/unix/sysv/linux/poll.c 27 { (gdb) 29 return SYSCALL_CANCEL (poll, fds, nfds, timeout); (gdb) std::sys::unix::init::sanitize_standard_fds () at library/std/src/sys/unix/mod.rs:113 113 library/std/src/sys/unix/mod.rs: No such file or directory. (gdb) std::sys::unix::init (argc=<optimized out>, argv=<optimized out>) at library/std/src/sys/unix/mod.rs:65 65 in library/std/src/sys/unix/mod.rs (gdb) std::sys::unix::init::reset_sigpipe () at library/std/src/sys/unix/mod.rs:155 155 in library/std/src/sys/unix/mod.rs (gdb) __bsd_signal (sig=13, handler=0x1) at ../sysdeps/posix/signal.c:30 Downloading 0.00 MB source file /usr/src/debug/glibc/signal/../sysdeps/posix/signal.c 30 { (gdb) 34 if (handler == SIG_ERR || sig < 1 || sig >= NSIG (gdb) 35 || is_internal_signal (sig)) (gdb) is_internal_signal (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/internal-signals.h:53 53 ../sysdeps/unix/sysv/linux/internal-signals.h: Directory not empty. (gdb) 43 __sigaddset (&act.sa_mask, sig); (gdb) __sigaddset (sig=<optimized out>, set=<optimized out>) at ../sysdeps/posix/signal.c:41 41 act.sa_handler = handler; (gdb) 102 ../sysdeps/unix/sysv/linux/sigsetops.h: Directory not empty. (gdb) f #0 __bsd_signal (sig=13, handler=0x1) at ../sysdeps/unix/sysv/linux/sigsetops.h:102 102 in ../sysdeps/unix/sysv/linux/sigsetops.h (gdb) #0 __bsd_signal (sig=13, handler=0x1) at ../sysdeps/unix/sysv/linux/sigsetops.h:102 102 in ../sysdeps/unix/sysv/linux/sigsetops.h (gdb) #0 __bsd_signal (sig=13, handler=0x1) at ../sysdeps/unix/sysv/linux/sigsetops.h:102 102 in ../sysdeps/unix/sysv/linux/sigsetops.h (gdb) #0 __bsd_signal (sig=13, handler=0x1) at ../sysdeps/unix/sysv/linux/sigsetops.h:102 102 in ../sysdeps/unix/sysv/linux/sigsetops.h (gdb) finish Run till exit from #0 __bsd_signal (sig=13, handler=0x1) at ../sysdeps/unix/sysv/linux/sigsetops.h:102 0x00005555556a1fc8 in std::sys::unix::init::reset_sigpipe () at library/std/src/sys/unix/mod.rs:155 155 library/std/src/sys/unix/mod.rs: No such file or directory. Value returned is $1 = (*mut fn (int)) 0x0 (gdb) Run till exit from #0 0x00005555556a1fc8 in std::sys::unix::init::reset_sigpipe () at library/std/src/sys/unix/mod.rs:155 std::sys::unix::init (argc=<optimized out>, argv=<optimized out>) at library/std/src/sys/unix/mod.rs:67 67 in library/std/src/sys/unix/mod.rs (gdb) Run till exit from #0 std::sys::unix::init (argc=<optimized out>, argv=<optimized out>) at library/std/src/sys/unix/mod.rs:67 std::rt::init (argc=<optimized out>, argv=<optimized out>) at library/std/src/rt.rs:80 80 library/std/src/rt.rs: No such file or directory. (gdb) Run till exit from #0 std::rt::init (argc=<optimized out>, argv=<optimized out>) at library/std/src/rt.rs:80 std::rt::lang_start_internal (main=..., argc=<optimized out>, argv=<optimized out>) at library/std/src/rt.rs:128 128 in library/std/src/rt.rs (gdb) Run till exit from #0 std::rt::lang_start_internal (main=..., argc=<optimized out>, argv=<optimized out>) at library/std/src/rt.rs:128 Breakpoint 1, tictactoe::main () at src/main.rs:24 24 ExitCode::SUCCESS (gdb) step 9 async fn main() -> ExitCode { (gdb) core::future::from_generator<tictactoe::main::{async_block_env#0}> (gen=...) at /rustc/1.63.0/library/core/src/future/mod.rs:98 98 /rustc/1.63.0/library/core/src/future/mod.rs: Directory not empty. (gdb) [New Thread 0x7ffff7c956c0 (LWP 5428)] [New Thread 0x7fffeffff6c0 (LWP 5429)] [New Thread 0x7ffff7a946c0 (LWP 5430)] [New Thread 0x7ffff78936c0 (LWP 5431)] [New Thread 0x7ffff76926c0 (LWP 5432)] [New Thread 0x7ffff74916c0 (LWP 5433)] [New Thread 0x7ffff72906c0 (LWP 5434)] [New Thread 0x7ffff708f6c0 (LWP 5435)] ^C Thread 1 "tictactoe" received signal SIGINT, Interrupt. syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38 38 cmpq $-4095, %rax /* Check %rax for error. */ |
This task depends upon
Closed by Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:25 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/rust/issues/1
Saturday, 25 November 2023, 20:25 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/rust/issues/1
$ pacman -Si rust-src | grep Description
Description : Source code for the Rust standard library
I'm no Rustacean but does installing that help?
Meanwhile, I'll try to work around the problem with symbolic links. I'll post a reply after I test it.
Conclusion: I think the binary rust package (rust) should not be linked to the /rustc/1.63.0 directory. If it assumed that the source were at /usr/lib/rustlib/src/rust, debugging would work out of the box.
[1] https://wiki.archlinux.org/title/Rust#Installation
In any case: I'm already planning to replace the rust package by the rustup package. Even if I don't, both the bug and workaround is confirmed: the problem is the hardcoded path difference between the rust package (/rustc/1.63.0) and the rust-src package (/usr/lib/rustlib/src/rust). The workaround is trivial, create a symbolic link from one to the other. I'm currently able to develop and debug with gdb with only the rust and rust-src packages, plus this workaround (without the rustup package). The package fix should also be trivial (hardcode the same path in both packages, possibly changing the build location). So regardless of my usage, the package may still be fixed.
A last option is also to delete the debugger scripts from the rust package. In this case, the authoritative split would be coherent with packaging. In this case this bug report may be ignored, but the package would also need to be changed anyway.