Patchwork [quantal/precise,SRU] bug #669641 - UBUNTU PACKAGING - systemtap fails to discover installed debug modules

login
register
mail settings
Submitter Chris J Arges
Date June 22, 2012, 9:29 p.m.
Message ID <4FE4E3CB.3000904@canonical.com>
Download mbox | patch
Permalink /patch/166678/
State New
Headers show

Comments

Chris J Arges - June 22, 2012, 9:29 p.m.
BugLink: https://bugs.launchpad.net/bugs/669641

== Precise SRU Justification ==

    Impact: When using systemtap with Ubuntu kernels, the proper debug
modules cannot be automatically discovered.

== Fix ==

This patch allows for the build system to insert the .gnu_debuglink
sections in the .ko files pointing to the full unstripped .ko in
/usr/lib/debug/.. in the dbgsym ddebs. In addition there are checks to
ensure the debug symbol actually exists before creating the
.gnu_debuglink section.

== Testcase ==

1) Install systemtap.
2) Run "stap -l 'module("serio_raw").function("*")'"
3) This should show list all the probe points for that module.

Thanks,
--chris j arges
Herton Ronaldo Krzesinski - June 25, 2012, 2:10 p.m.
On Fri, Jun 22, 2012 at 04:29:47PM -0500, Chris J Arges wrote:
> BugLink: https://bugs.launchpad.net/bugs/669641
> 
> == Precise SRU Justification ==
> 
>     Impact: When using systemtap with Ubuntu kernels, the proper debug
> modules cannot be automatically discovered.
> 
> == Fix ==
> 
> This patch allows for the build system to insert the .gnu_debuglink
> sections in the .ko files pointing to the full unstripped .ko in
> /usr/lib/debug/.. in the dbgsym ddebs. In addition there are checks to
> ensure the debug symbol actually exists before creating the
> .gnu_debuglink section.
> 
> == Testcase ==
> 
> 1) Install systemtap.
> 2) Run "stap -l 'module("serio_raw").function("*")'"
> 3) This should show list all the probe points for that module.
> 
> Thanks,
> --chris j arges

> From cf63b6edab8e47ecb09f1603e3a3d26fe3cda6c6 Mon Sep 17 00:00:00 2001
> From: John Rigby <john.rigby@linaro.org>
> Date: Thu, 14 Jun 2012 21:17:38 +0100
> Subject: [PATCH] UBUNTU: PACKAGING: add .gnu_debuglink sections to .ko files
> 
> BugLink: http://launchpad.net/bugs/669641
> 
> Kernel module .ko files now have .gnu_debuglink sections pointing
> to the full unstripped .ko in /usr/lib/debug/.. in the dbgsym ddebs.
> 
> [Peter Petrakis <peter.petrakis@canonical.com>]
> Check that debug symbol ko exists before attempting to create
> .gnu_debuglink section.

Ack, it looks ok. Just one related suggestion (not a problem with this
change, could be a separate patch): we could use --only-keep-debug with
objcopy to strip the .ko from the dbgsym package also, if it isn't
stripped anywhere else already.

> 
> Signed-off-by: Peter Petrakis <peter.petrakis@canonical.com>
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> ---
>  debian/rules.d/2-binary-arch.mk |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index a2555ee..d3460bb 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -168,6 +168,15 @@ ifneq ($(skipdbg),true)
>  		$(dbgpkgdir)/usr/lib/debug/boot/vmlinux-$(abi_release)-$*
>  	$(build_cd) $(kmake) $(build_O) modules_install \
>  		INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
> +	# Add .gnu_debuglink sections to each stripped .ko
> +	# pointing to unstripped verson
> +	find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
> +		if [[ -f "$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \
> +			$(CROSS_COMPILE)objcopy \
> +				--add-gnu-debuglink=$(dbgpkgdir)/usr/lib/debug/$$module \
> +				$(pkgdir)/$$module; \
> +		fi; \
> +	done
>  	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/build
>  	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/source
>  	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/modules.*
> -- 
> 1.7.9.5
> 

> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Tim Gardner - June 25, 2012, 4:11 p.m.

Patch

From cf63b6edab8e47ecb09f1603e3a3d26fe3cda6c6 Mon Sep 17 00:00:00 2001
From: John Rigby <john.rigby@linaro.org>
Date: Thu, 14 Jun 2012 21:17:38 +0100
Subject: [PATCH] UBUNTU: PACKAGING: add .gnu_debuglink sections to .ko files

BugLink: http://launchpad.net/bugs/669641

Kernel module .ko files now have .gnu_debuglink sections pointing
to the full unstripped .ko in /usr/lib/debug/.. in the dbgsym ddebs.

[Peter Petrakis <peter.petrakis@canonical.com>]
Check that debug symbol ko exists before attempting to create
.gnu_debuglink section.

Signed-off-by: Peter Petrakis <peter.petrakis@canonical.com>
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
 debian/rules.d/2-binary-arch.mk |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index a2555ee..d3460bb 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -168,6 +168,15 @@  ifneq ($(skipdbg),true)
 		$(dbgpkgdir)/usr/lib/debug/boot/vmlinux-$(abi_release)-$*
 	$(build_cd) $(kmake) $(build_O) modules_install \
 		INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
+	# Add .gnu_debuglink sections to each stripped .ko
+	# pointing to unstripped verson
+	find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
+		if [[ -f "$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \
+			$(CROSS_COMPILE)objcopy \
+				--add-gnu-debuglink=$(dbgpkgdir)/usr/lib/debug/$$module \
+				$(pkgdir)/$$module; \
+		fi; \
+	done
 	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/build
 	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/source
 	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/modules.*
-- 
1.7.9.5