From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14108 invoked by alias); 27 Jun 2013 23:43:10 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 14041 invoked by uid 48); 27 Jun 2013 23:43:04 -0000 From: "agentzh at gmail dot com" To: systemtap@sourceware.org Subject: [Bug translator/11096] Getting global module vars in functions Date: Thu, 27 Jun 2013 23:43:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: translator X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: agentzh at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-q2/txt/msg00396.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=11096 agentzh changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #7 from agentzh --- A modified version of my patch has just been committed: commit bd1fcbad9165da8a96bcffbb1d1d3ca9f7ce3242 Author: Yichun Zhang (agentzh) Date: Fri Jun 14 17:44:00 2013 -0700 PR11096: Add support for the "module" argument to @var The notation @var("varname@cuname", "module") is now supported and @var can thus effectively be used almost everywhere like the context of stap functions, probe timer.profile, and probe kernel.trace(). Just like @cast, multiple module names can be specified by separating them with ":", for example, "module1:module2:module3". And they will be attempted in turn until a match is found. Refactored the code by introducing atvar_op as suggested by Josh Stone to make the implementation cleaner. The fields "target_name" and "cu_name" have been moved from target_symbol to its subclass atvar_op. @var now searches all the CUs that matches the "cuname" specified for the variable. And when "cuname" is missing, @var just searches all the CUs. Accessing global variables in PIE and DSO via @var with either "cuname" or "module" now mostly works for the default (kernel) runtime (but note PR15688). Thanks Josh Stone for reviewing this patch and providing a lot of invaluable suggestions. * parse.cxx: Add support for the optional "module" parameter to the parser. * staptree.h: Remove the "target_name" field from target_symbol and make sym_name() virtual. Define atvar_op which inherits target_symbol. Add method visit_atvar_op to the visitor classes. * staptree.cxx: Define visit_atvar_op for the visitor classes. Define methods of atvar_op. * tapsets.cxx: Define visit_atvar_op for dwarf_var_expanding_visitor, sdt_uprobe_var_expanding_visitor, and tracepoint_var_expanding_visitor. Define dwarf_atvar_expanding_visitor to run in series with dwarf_cast_expanding_visitor in dwarf_derived_probe. Add dwarf_atvar_query to handle the DWARF queres of dwarf_atvar_expanding_visitor. Postpone the processing of @var with either cu name or module name or both to dwarf_atvar_expanding_visitor in order to eliminate code duplication. * elaborate.h: Declare visit_atvar_op for typeresolution_info. void_statement_reducer. * elaborate.cxx: Define visit_atvar_op for symbol_fetcher, typeresolution_info, and void_statement_reducer. * translate.cxx: Define visit_atvar_op for c_unparser. * testsuite/systemtap.base/: Add many more test cases for @var. -- You are receiving this mail because: You are the assignee for the bug.