Comment 4 for bug 669641

Revision history for this message
Ritesh Raj Sarraf (rrs) wrote : Re: [Bug 669641] [NEW] systemtap fails to discover installed debug modules

You might also want to take a look at how we fixed this in Debian.

On 11/02/2010 02:04 AM, Peter Petrakis wrote:
> # stap -l 'kernel.function("acpi_*")' | sort
>
> will succeed
>
> and this will fail.
>
> # stap -l 'module("ohci1394").function("*")' | sort
>
> Now there's no shortage of blogs and wikis on how to work
> around this but no one has seemingly ever investigated the root
> cause. If one were to run this through strace you would find
> the following.
>
> open("/usr/lib/debug/.build-id/3b/6eb5a0f22ba2bc92c3c3f1fcb14fe7f31f3807.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/lib/modules/2.6.32-25-generic/kernel/drivers/ieee1394/ohci1394.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/lib/modules/2.6.32-25-generic/kernel/drivers/ieee1394/.debug/ohci1394.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/usr/lib/debug/lib/modules/2.6.32-25-generic/kernel/drivers/ieee1394/ohci1394.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/lib/modules/2.6.32-25-generic/kernel/drivers/ieee1394/build/ohci1394.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
>
> Note that the path is correct, it's the name of the KO that stap is expecting that is wrong,
> Kernel debug symbols provided by Ubuntu are unstripped yet maintain the .ko extension,
> systemtap (actually libelf/elfutils) is expecting the filename to be module.ko.debug.
>
> After discussing this on #systemtap on Freenode, the following script was proposed to
> generate a symlink tree, by build id, in /usr/lib/debug, with the proper extension. This
> completely solves the issue, and is also of benefit to things like gdb and oprofile.
>
> #!/bin/sh
>
> for file in `find /usr/lib/debug -name '*.ko' -print`
> do
> buildid=`eu-readelf -n $file| grep Build.ID: | awk '{print $3}'`
> dir=`echo $buildid | cut -c1-2`
> fn=`echo $buildid | cut -c3-`
> mkdir -p /usr/lib/debug/.build-id/$dir
> ln -s $file /usr/lib/debug/.build-id/$dir/$fn
> ln -s $file /usr/lib/debug/.build-id/$dir/${fn}.debug
> done
>
> If we could integrate this into the ddeb postinstall script, the problem would
> be solved.
>
>

--
Ritesh Raj Sarraf | http://people.debian.org/~rrs
Debian - The Universal Operating System