This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: How to track the functions in self-written module using SystemTap?
- From: David Smith <dsmith at redhat dot com>
- To: Martin Cermak <mcermak at redhat dot com>
- Cc: Nan Xiao <xiaonan830818 at gmail dot com>, "Frank Ch. Eigler" <fche at redhat dot com>, systemtap at sourceware dot org
- Date: Fri, 7 Oct 2016 12:59:49 -0500
- Subject: Re: How to track the functions in self-written module using SystemTap?
- Authentication-results: sourceware.org; auth=none
- References: <CA+MhoaO9kbLCWJ4S3jSGxW2gr=TW8fGhZ8znG5pX5dXzLLoh6Q@mail.gmail.com> <565DCA83.6040102@redhat.com> <CA+MhoaOc18xQ0aa4e7uiKwVy6oEwHs-1GuP3pPPLyNtXyQA2nQ@mail.gmail.com> <565F65D4.4050005@redhat.com> <CA+MhoaOQEgOe_b-wdY-qbWPCgPdFdN2WkvMTU-L7c9W1bZs8pw@mail.gmail.com> <566075FA.40207@redhat.com> <CA+MhoaPeuEgwv9VQ85yYtXs9Nq-hFDR634eAurryVHUbPvA4zw@mail.gmail.com> <566183E6.9050101@redhat.com> <CA+MhoaPcgbu0NNWMHXsvx3movVMdCN+09q65Swe++XjQ_2d4NQ@mail.gmail.com> <5665E3CC.6000104@redhat.com> <20161006220507.GU4935@dhcp-24-165.brq.redhat.com>
On 10/06/2016 05:05 PM, Martin Cermak wrote:
> On Mon 2015-12-07 13:53 , David Smith wrote:
>> 1) Make sure your kernel was compiled with frame pointer support (which
>> it should if it is a standard RHEL kernel):
>>
>> # fgrep FRAME_POINTER /boot/config-`uname -r`
>> CONFIG_SCHED_OMIT_FRAME_POINTER=y
>> CONFIG_ARCH_WANT_FRAME_POINTERS=y
>> CONFIG_FRAME_POINTER=y
>>
>> 2) Let's make sure your module still has debuginfo present. First, run
>> "file" on your module, making sure it says "not stripped". Then go a bit
>> deeper and run "readelf --sections" on your module - there should be
>> several sections that start with '.debug', including one called
>> '.debug_frame'.
>
> I'm traying to trace my own stap module too. I'm using stap -B
> CONFIG_DEBUG_INFO=y to put the dfebuginfo into the module.
> However, this way I seem to get the '.debug_frame' section on
> RHEL6, but not on RHEL7 or recent Fedora. Because of this I'm
> failing to get reasonable backtraces. Any workaround?
We actually test this in the systemtap.context/context.exp test case. It
builds 2 external modules and tries to get backtraces from them (among
other things). On RHEL7.2 ppc64, the backtrace tests don't pass, but I
think that's really a test case problem.
====
backtrace from
module("systemtap_test_module2").function("yyy_func2@/root/rhel7-2.ppc64/testsuite/artifacts/systemtap.context/context/staptestMS19Tt/systemtap_test_module2.c:33"):
0xd000000006fd00a0 : yyy_func2+0x0/0x30 [systemtap_test_module2]
0xd000000006fd00e0 : yyy_func1+0x10/0x0 [systemtap_test_module2]
0xd0000000082c01b8 : stm_write_cmd+0x1b8/0x200 [systemtap_test_module1]
0x0 (inexact)
====
The test case expects the '0x0 (inexact)' line to be from the kernel.
This might be a ppc64-specific problem. But, the backtrace from the
modules themselves look fine.
Does your systemtap.context/context.exp test case output look similar?
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)