public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Can't access argument of process marker
@ 2010-06-25 15:33 Wenji Huang
  2010-06-25 17:23 ` Josh Stone
  0 siblings, 1 reply; 3+ messages in thread
From: Wenji Huang @ 2010-06-25 15:33 UTC (permalink / raw)
  To: SystemTAP

Hi,

I got the failure when running test semok/thirtysix.stp. The error
is triggered by the following script,

$ stap -e 'probe process("stap").mark("*")? { 
println(@defined($arg1)?$arg1:$nosuchvar) }'
semantic error: invalid argument number: identifier '$nosuchvar' at 
<input>:1:66
         source: probe process("stap").mark("*")? { 
println(@defined($arg1)?$arg1:$nosuchvar) }
 
           ^
Pass 2: analysis failed.  Try again with another '--vp 01' option.

It seems arguments of marker aren't accessible. Moreover, I think
it's not very accurate to complain "invalid argument number". In fact, 
the variable doesn't follow the naming rule, it's better to make
a little modification and give some hints like $argN.


Regards,
Wenji

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can't access argument of process marker
  2010-06-25 15:33 Can't access argument of process marker Wenji Huang
@ 2010-06-25 17:23 ` Josh Stone
  2010-06-25 18:24   ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: Josh Stone @ 2010-06-25 17:23 UTC (permalink / raw)
  To: wenji.huang; +Cc: SystemTAP

On 06/24/2010 11:04 PM, Wenji Huang wrote:
> Hi,
> 
> I got the failure when running test semok/thirtysix.stp. The error
> is triggered by the following script,
> 
> $ stap -e 'probe process("stap").mark("*")? { 
> println(@defined($arg1)?$arg1:$nosuchvar) }'
> semantic error: invalid argument number: identifier '$nosuchvar' at 
> <input>:1:66
>          source: probe process("stap").mark("*")? { 
> println(@defined($arg1)?$arg1:$nosuchvar) }
>  
>            ^
> Pass 2: analysis failed.  Try again with another '--vp 01' option.
> 
> It seems arguments of marker aren't accessible.

I saw this too, and I think it's just a failed operation of @defined for
SDT.  There are two overrides:

sdt_kprobe_var_expanding_visitor::visit_defined_op - just calls the
parent class... harmless, but unnecessary.

sdt_uprobe_var_expanding_visitor::visit_defined_op - leaves the
defined_op untouched, without checking its argument.  This means later
it expands to "undefined" --> 0.

I believe that neither class really needs to customize visit_defined_op,
but I haven't had a chance to try removing them yet.  Stan, do you
recall why these were needed?

> Moreover, I think it's not very accurate to complain "invalid
> argument number". In fact, the variable doesn't follow the naming
> rule, it's better to make a little modification and give some hints
> like $argN.

I agree, and there's also a comment that it needs to check for the $arg
prefix in the first place.


Josh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can't access argument of process marker
  2010-06-25 17:23 ` Josh Stone
@ 2010-06-25 18:24   ` Frank Ch. Eigler
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Ch. Eigler @ 2010-06-25 18:24 UTC (permalink / raw)
  To: Josh Stone; +Cc: wenji.huang, SystemTAP

Josh Stone <jistone@redhat.com> writes:

> [...]
> sdt_kprobe_var_expanding_visitor::visit_defined_op - just calls the
> parent class... harmless, but unnecessary.
>
> sdt_uprobe_var_expanding_visitor::visit_defined_op - leaves the
> defined_op untouched, without checking its argument.  This means later
> it expands to "undefined" --> 0.
> [...]

One piece of background that may help explain this is that some of the
sdt.h options did not encode the actual number of arguments into the
.probe metadata, so stap couldn't actually tell how many arguments
there are supposed to be.  Perhaps this is why it was thought
appropriate to short-circuit @defined() there.

In any case, this shortage of metadata is fixed with SDT_V2, which
stap usually forces on for itself.  The translator-side code may not
have caught up.

- FChE

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-25 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-25 15:33 Can't access argument of process marker Wenji Huang
2010-06-25 17:23 ` Josh Stone
2010-06-25 18:24   ` Frank Ch. Eigler

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).