public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Huang jw <huangjiangwei@gmail.com>
To: Roland McGrath <roland@redhat.com>
Cc: systemtap@sourceware.org
Subject: Re: about probe libc
Date: Tue, 10 Aug 2010 06:32:00 -0000	[thread overview]
Message-ID: <AANLkTinFF9wusngvLV8cfRGaY4_Fe24_VJVVXUm-SUti@mail.gmail.com> (raw)
In-Reply-To: <20100810055955.A8600401DA@magilla.sf.frob.com>

Thanks for your suggestion. In my exp, I want to get the statistics of
memory activity of the whole system, such as memcpy, malloc, free. For
malloc and free, we can use hook. For memcpy, I tried ltrace, but
ltrace still has problem with pthread. So I choose systemtap.  As you
said, it's difficult to trace memcpy by systemtap because of inline or
Macros. Any more suggestions about memcpy tracing ?

2010/8/10 Roland McGrath <roland@redhat.com>:
> The RHEL5 debuginfo for libc (perhaps for all .so's?) has a CRC mismatch
> with the .gnu_debuglink section embedded in the binary.  This indicates a
> problem in the rpm build procedure, but the binaries are already built.
> To avoid the CRC checking you can use a SYSTEMTAP_DEBUGINFO_PATH setting
> that begins with - instead of +, for example:
>
> SYSTEMTAP_DEBUGINFO_PATH=-/usr/lib/debug  stap -e 'probe process("/lib/libc.so.6").function("memcpy").return{println(probefunc())}' -c 'ls'
>
> worked for me where it before got the same failure mode you saw.
> ("Worked" just meaning doesn't get that "No DWARF" error any more.)
>
> The systemtap default path is:
>        +:.debug:/usr/lib/debug:/var/cache/abrt-di/usr/lib/debug:build
> That leading + flag (vs -) enables the CRC checking by default.
>
> When disabling this check, you always need to double-check by hand that you
> really have the correct .debug files installed to match the binaries you
> are using (i.e. from foo-N-V-R.A.rpm and foo-debuginfo-N-V-R-A.rpm with
> exactly matching N-V-R.A), because you are no longer getting any kind of
> automatic checking that they are an exact match.
>
> On systems newer than RHEL5 (e.g. Fedora >= 8, RHEL6), all the binaries and
> .debug files will have build IDs.  When binaries have build IDs, those are
> a reliable verification that you have the right files installed, and so the
> CRC check is never consulted (whether it's correct, or broken as for RHEL5
> libc.so.debug).  The - flag in the debuginfo path setting has no effect on
> build ID checking, so, if you like, you can use a uniform setting both for
> RHEL5 and for systems that do have build IDs, and lose nothing in the newer
> and better environments.
>
> Note that in this example I didn't see any probe hits, and that may well be
> "correct".  memcpy is one of several special-case functions that (in
> optimized code) are almost always either defined as macros or inlines in
> header files, or directly compiled away by the compiler as a special built-in.
>
> You are unlikely to be able to get any reliable probing of memcpy (or some
> other examples like other simple <string.h> functions), except perhaps for
> the calls in your own code if it is compiled without optimization (-O0).
>
>
> Thanks,
> Roland
>

  reply	other threads:[~2010-08-10  6:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-10  4:49 Huang jw
2010-08-10  5:27 ` Srikar Dronamraju
2010-08-10  5:43   ` Huang jw
2010-08-10  6:03   ` Roland McGrath
2010-08-10  6:00 ` Roland McGrath
2010-08-10  6:32   ` Huang jw [this message]
2010-08-11 15:03     ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinFF9wusngvLV8cfRGaY4_Fe24_VJVVXUm-SUti@mail.gmail.com \
    --to=huangjiangwei@gmail.com \
    --cc=roland@redhat.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).