This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Accessing user-space global variables in timer.profile?
- From: Josh Stone <jistone at redhat dot com>
- To: agentzh <agentzh at gmail dot com>
- Cc: David Smith <dsmith at redhat dot com>, systemtap at sourceware dot org
- Date: Mon, 03 Jun 2013 16:21:15 -0700
- Subject: Re: Accessing user-space global variables in timer.profile?
- References: <CAB4Tn6OYi=Vx19H4BLojphuuvjSp2drjvJFd3HxzAGj7=yD5cA at mail dot gmail dot com> <51755D3D dot 6020004 at redhat dot com> <CAB4Tn6OubWF71F9b3hNqXo85h96sr1Rp77-NmZAjmLPt=vAzyA at mail dot gmail dot com> <5175E28B dot 9050500 at redhat dot com> <CAB4Tn6ORHjkv+CuAN90Ju+gKEohSyNvpdvoq-fEsEEdUgAzjgg at mail dot gmail dot com> <51AD1B9A dot 3050907 at redhat dot com>
(resending this followup, because my client glitched and I don't see
that this made it to the list...)
On 06/03/2013 03:41 PM, Josh Stone wrote:
>> 2. There's some code duplication between this early @var expansion and
>> the existing dwarf_var_expanding_visitor. Maybe we could merge them
>> two or just abstract out some common logic?
>
> I think that could be helped a little by deferring the current @var
> expansion into your new visitor. This would be much like how the
> dwarf_var_expanding_visitor::visit_cast_op() only sets the module name,
> so dwarf_cast_expanding_visitor has the right context later.
Ugh, now it occurs to me that this suggestion only makes sense for @var
globals, where there's a cu_name and no module name. For plain
@var("name") it could be a local variable, and this really does need to
be processed on the spot in dwarf_var_expanding_visitor.
Here's a possible outline to accomplish that with separate atvar_op:
* Make target_symbol::sym_name virtual, and make this one deal only with
the plain ->name case.
* Add the atvar_op::sym_name override which does target_name munging.
* Add something like:
void
dwarf_var_expanding_visitor::visit_atvar_op (atvar_op *e)
{
if (e->module.empty() && e->cu_name.empty())
{
// process like any other local
// e->sym_name() will do the right thing
visit_target_symbol(e);
return;
}
// Fill in our current module context if needed
if (e->module.empty())
e->module = q.dw.module_name;
}
* Then dwarf_atvar_query/visitor can handle the globals that make it
through.
Hope I'm not over-engineering this... what do you think?