From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Sergio Durigan Junior <sergiodj@redhat.com>
Subject: Re: [PATCH 3/6] Modify internalvar mechanism
Date: Tue, 19 Apr 2011 18:40:00 -0000 [thread overview]
Message-ID: <m3oc423x1y.fsf@fleche.redhat.com> (raw)
In-Reply-To: <201104191852.58106.pedro@codesourcery.com> (Pedro Alves's message of "Tue, 19 Apr 2011 18:52:57 +0100")
>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
Pedro> Do I understand correctly that this still creates
Pedro> a regular trap tracepoint at the probe location?
Pedro> A fast tracepoint ("ftrace") at that spec would
Pedro> create a fast tracepoint at the probe's location, and
Pedro> things would magically work, because $_probe_argN is just
Pedro> sugar for collecting memory and registers, right?
I believe it should all work, but I did not think to try fast
tracepoints. I don't know whether Sergio did.
Yes, the probe arguments are just a wrapper around some kind of
assembly-level operand. These are known statically to gdb; the operands
are encoded as strings in the appropriate section. A good part of the
main patch is devoted to parsing these.
It might be nice if we had a way to print the operand strings. This
isn't always useful, but maybe we could add some optional flag to "info
probe". Or, maybe just another flag to readelf.
Pedro> I noticed that patch 4 does some changes to
Pedro> start_tracing to tweak the probes' semaphores, if any.
Pedro> What are these semaphores? How do other stap tools
Pedro> handle them? I ask because that bends a bit the definition
Pedro> of "trace" being a regular tracepoint at a given
Pedro> location, so I'd like to understand it.
A probe can optionally have an associated "semaphore". A semaphore in
the sdt.h sense is just a global variable (of type unsigned short) which
can be used to gate the probe. Typically these are only generated by
code using the dtrace compatibility wrappers.
Without a semaphore a probe may look like:
STAB_PROBE (provider, name, arg);
But with a semaphore it would more typically be written (though I think
in practice there may be macros expanding to the semaphore name):
if (provider_name_semaphore)
STAB_PROBE (provider, name, arg);
Aside from providing some source compatibility with dtrace probes, this
can also be used in a situation where computing the probe arguments is
expensive. In Fedora 15, at least Python takes this approach. But,
OTOH, libgcc and glibc do not.
The only other tool I know of that deals with these probe points is
SystemTap. It treats the semaphore as a counter. I don't know the
specifics, but basically it is incremented by stap at "attach" and
decremented at "detach". We made gdb work the same way, for
compatibility. (I have not done it but I believe it is possible to use
stap and gdb to probe the same process at the same time.)
So, since setting the semaphore is necessary to make the probe even
trigger, it seemed to make sense to have gdb set it, and to leave it set
during the trace experiment. One reason we decided to make `probe:'
linespecs special with regard to semaphores is because it makes it clear
that the user has asked for some additional behavioral change on top of
the breakpoint. (We could alternatively have made `break *0xaddress'
magically work at a probe point, the way we did for probe arguments...)
Tom
next prev parent reply other threads:[~2011-04-19 18:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-04 3:08 Sergio Durigan Junior
2011-04-11 21:08 ` Jan Kratochvil
2011-04-12 11:24 ` Pedro Alves
2011-04-12 20:40 ` Tom Tromey
2011-04-12 22:33 ` Sergio Durigan Junior
2011-04-19 17:53 ` Pedro Alves
2011-04-19 18:40 ` Tom Tromey [this message]
2011-04-19 20:01 ` Tom Tromey
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=m3oc423x1y.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=sergiodj@redhat.com \
/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