[UNSTABLE][PATCH v2] UBUNTU: [Packaging] Build and include GDB Python scripts into debug packages

Dimitri John Ledkov dimitri.ledkov at canonical.com
Mon May 17 19:37:19 UTC 2021


Hi,

On Mon, May 17, 2021 at 7:50 PM Krzysztof Kozlowski
<krzysztof.kozlowski at canonical.com> wrote:
>
> The kernel comes with useful GDB debugging scripts/commands (enabled
> with CONFIG_GDB_SCRIPTS), however these are built either with "all" make
> target or with "scripts_gdb".  Build these in
> "$(stampdir)/stamp-build-%" target and package in "install-%" under
> /usr/lib/debug/share.
>

I'm still not too sure about this location. Where did it come from?

Normally, when running under gdb it has autoload functionality of
loading auxiliary scripts.

Ie. python3.9-gdb for the interpreter ships the below
/usr/share/gdb/auto-load/usr/bin/python3.9-dbg-gdb.py

Would it not make more sense to ship the gdb kernel scripts under like

/usr/share/gdb/auto-load/boot/vmlinuz-X.Y.Z-gdb.py ? Or do they at all
cannot work with gdb auto-load functionality? Can we store them
somewhere by build-id note (if that is at all helpful)?

Where do other distributions ship these gdb scripts? Cause i have not
seen /usr/lib/debug/share before.

> BugLink: https://bugs.launchpad.net/bugs/1928715
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at canonical.com>
>
> ---
>
> Changes since v1 (RFC):
> 1. Add a comment inside .mk.
> 2. More tests.
> ---
>  debian/rules.d/2-binary-arch.mk | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 0b008df5a853..d297dc84ff48 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -49,6 +49,13 @@ $(stampdir)/stamp-build-%: $(stampdir)/stamp-prepare-%
>         @echo Debug: $@ build_image $(build_image) bldimg $(bldimg)
>         $(build_cd) $(kmake) $(build_O) $(conc_level) $(bldimg) modules $(if $(filter true,$(do_dtbs)),dtbs)
>
> +ifneq ($(skipdbg),true)
> +       # The target scripts_gdb is part of "all", so we need to call it manually
> +       if grep -q CONFIG_GDB_SCRIPTS=y $(builddir)/build-$*/.config; then \
> +               $(build_cd) $(kmake) $(build_O) $(conc_level) scripts_gdb ; \
> +       fi
> +endif
> +
>         @touch $@
>
>  define build_dkms_sign =
> @@ -295,6 +302,12 @@ ifneq ($(skipdbg),true)
>         # Debug image is simple
>         install -m644 -D $(builddir)/build-$*/vmlinux \
>                 $(dbgpkgdir)/usr/lib/debug/boot/vmlinux-$(abi_release)-$*
> +       if [ -d $(builddir)/build-$*/scripts/gdb/linux ]; then \
> +               install -m644 -D $(builddir)/build-$*/vmlinux-gdb.py \
> +                       $(dbgpkgdir)/usr/lib/debug/share/$(abi_release)-$*/vmlinux-gdb.py; \
> +               install -m644 -D $(builddir)/build-$*/scripts/gdb/linux/* \
> +                       --target-directory=$(dbgpkgdir)/usr/lib/debug/share/$(abi_release)-$*/scripts/gdb/linux; \
> +       fi
>         $(build_cd) $(kmake) $(build_O) modules_install $(vdso) \
>                 INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
>         # Add .gnu_debuglink sections only after all/DKMS modules are built.
> --
> 2.27.0
>
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team



-- 
Regards,

Dimitri.



More information about the kernel-team mailing list