On 10/7/22 13:35, Jelle van der Waa wrote:
...

This all needs some further debugging :)


Thanks a lot for the detailed info. I've done additional rounds of
testing using the latest pacman patches [0]:

There are rumors that the pacman patch "strip: fix unique source paths"
may have side-effects, but using that one puts rust sources into the
correct place:

 bsdtar tf arch-rebuild-order-debug-0.3.1-0-x86_64.pkg.tar.zst
...
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/args.rs
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/error.rs
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/lib.rs
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/main.rs


Also works for none git clones via tarball archives:

 bsdtar tf dfrs-debug-0.0.7-0-x86_64.pkg.tar.zst
...
usr/src/debug/dfrs/dfrs-0.0.7/src/args.rs
usr/src/debug/dfrs/dfrs-0.0.7/src/main.rs
usr/src/debug/dfrs/dfrs-0.0.7/src/mount.rs
usr/src/debug/dfrs/dfrs-0.0.7/src/theme.rs
usr/src/debug/dfrs/dfrs-0.0.7/src/util.rs


It is important to note that this requires to set DEBUG_RUSTFLAGS to
"-C debuginfo=2" as commented in makepkg.conf. The reason for this is
that the cargo release profile provides a default of debuginfo=0 which
means no debug info at all.
That setting is the only real important one out of the release profile
as the dev profile pulls in quite a lot of debug behavior that has
great influence not just on runtime speed but also on runtime behavior
like debug-asserts etc [2]. Either way we would only need to find the
correct options to use for the release profile, as all that profiles
like dev do is set options.



With a local pacman/makepkg that contains patches up to [0] plus
using DEBUG_RUSTFLAGS with debuginfo=2, we achieve the correct behavior
in gdb without further adjustments in project PKGBUILD's besides setting
the correct options=():

 rust-gdb /usr/bin/arch-rebuild-order
Reading symbols from /usr/bin/arch-rebuild-order...
Reading symbols from /usr/lib/debug/usr/bin/arch-rebuild-order.debug...
 (gdb) b arch_rebuild_order::find_package_anywhere
 (gdb) r cowfortune
Breakpoint 1, arch_rebuild_order::find_package_anywhere (pkgname="cowfortune", pacman=0x7fffffffc0b0) at src/lib.rs:19
19          let dbs = pacman.syncdbs();
...


The current debug package of arch-rebuild-order also seems to contain
exactly what is expected:

 bsdtar tf arch-rebuild-order-debug-0.3.1-0-x86_64.pkg.tar.zst
.BUILDINFO
.MTREE
.PKGINFO
usr/
usr/lib/
usr/lib/debug/
usr/lib/debug/.build-id/
usr/lib/debug/.build-id/6e/
usr/lib/debug/.build-id/6e/47e7e3a5651158b1cbf8efde21a08ef379cf04
usr/lib/debug/.build-id/6e/47e7e3a5651158b1cbf8efde21a08ef379cf04.debug
usr/lib/debug/usr/
usr/lib/debug/usr/bin/
usr/lib/debug/usr/bin/arch-rebuild-order.debug
usr/src/
usr/src/debug/
usr/src/debug/arch-rebuild-order/
usr/src/debug/arch-rebuild-order/arch-rebuild-order/
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/args.rs
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/error.rs
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/lib.rs
usr/src/debug/arch-rebuild-order/arch-rebuild-order/src/main.rs


So far so good :)


[0] https://gitlab.archlinux.org/pacman/pacman/-/commit/478af273dfe24ded197ec54ae977ddc3719d74a0
[1] https://doc.rust-lang.org/cargo/reference/profiles.html#debug
[2] https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to