Bug 7071 - optional $context variables
Summary: optional $context variables
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Rajan Arora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-05 18:54 UTC by Frank Ch. Eigler
Modified: 2009-03-17 18:21 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
patch for review (1.48 KB, patch)
2009-03-11 05:41 UTC, Rajan Arora
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2008-12-05 18:54:04 UTC
amacleod and others have occasionally asked for the ability for a script to
refer to $vars that may not actually exist at the given probe point for
whatever reason.  The idea would be to let the translator accept such scripts,
substituting a literal '0' and I guess a warning at translate time.

One possibility is to just make this a session-level flag driven by a new 
command line argument.  The effect would be to change tapsets.cxx:4634ish (the
catch semantic-error block in dwrf_var_expanding_copy_visitor) ... or perhaps
translate.cxx's c_unparser::visit_target_symbol to behave differently if this
flag is set.  (Other $var sources like markers might need this sort of
treatment too.)

Another possibility is to let individual variables/expressions be marked with
?, as in $?var, but that might require more guesswork from the user than
should be expected of her.
Comment 1 K.Prasad 2009-02-02 13:17:54 UTC
Such a functionality would help address name-space issues that might arise due 
to distinct variable names based on CONFIG_<>. Using a combination of '?' for 
function names and say $?var on variables, differences in kernel code based on 
CONFIG_<> option can be tolerated by the tapset/script.
Comment 2 Rajan Arora 2009-03-11 05:41:14 UTC
Created attachment 3808 [details]
patch for review

substitutes target symbol with literal 0 on enabling session level flag via
--ignore-context
Comment 3 Frank Ch. Eigler 2009-03-11 14:58:52 UTC
I'd rename "--ignore-context" to "--skip-badvars" or somesuch
and maybe tighten up the warning message, but otherwise looks
great.  A blurb in NEWS/stap.1.in and a test case would complete
the job.
Comment 4 Rajan Arora 2009-03-17 18:21:39 UTC
commit 3bd0d4d