diff options
author | Dave Brolley <brolley@redhat.com> | 2009-11-05 15:23:35 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-11-05 15:23:35 -0500 |
commit | ffe4285b81564e098aa7a2d056ff62a8700f321d (patch) | |
tree | 8b2145ec5de1929efd04c5d7207d659e93df4fbd /main.cxx | |
parent | dcb95d9a7c3abc823699d7c096219f9e09ea5921 (diff) | |
parent | c39cdd5565f718302057242bbfe50e71b69c4f4d (diff) | |
download | systemtap-steved-ffe4285b81564e098aa7a2d056ff62a8700f321d.tar.gz systemtap-steved-ffe4285b81564e098aa7a2d056ff62a8700f321d.tar.xz systemtap-steved-ffe4285b81564e098aa7a2d056ff62a8700f321d.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'main.cxx')
-rw-r--r-- | main.cxx | 46 |
1 files changed, 35 insertions, 11 deletions
@@ -162,8 +162,10 @@ printscript(systemtap_session& s, ostream& o) if (s.listing_mode) { // We go through some heroic measures to produce clean output. - set<string> seen; + // Record the alias and probe pointer as <name, set<derived_probe *> > + map<string,set<derived_probe *> > probe_list; + // Pre-process the probe alias for (unsigned i=0; i<s.probes.size(); i++) { if (pending_interrupts) return; @@ -198,24 +200,46 @@ printscript(systemtap_session& s, ostream& o) // Now duplicate-eliminate. An alias may have expanded to // several actual derived probe points, but we only want to // print the alias head name once. - if (seen.find (pp) == seen.end()) + probe_list[pp].insert(p); + } + + // print probe name and variables if there + for (map<string, set<derived_probe *> >::iterator it=probe_list.begin(); it!=probe_list.end(); ++it) + { + o << it->first; // probe name or alias + + // Print the locals and arguments for -L mode only + if (s.listing_mode_vars) { - o << pp; - // Print the locals for -L mode only - if (s.listing_mode_vars) + map<string,unsigned> var_list; // format <"name:type",count> + map<string,unsigned> arg_list; + // traverse set<derived_probe *> to collect all locals and arguments + for (set<derived_probe *>::iterator ix=it->second.begin(); ix!=it->second.end(); ++ix) { + derived_probe* p = *ix; + // collect available locals of the probe for (unsigned j=0; j<p->locals.size(); j++) { - o << " "; + stringstream tmps; vardecl* v = p->locals[j]; - v->printsig (o); + v->printsig (tmps); + var_list[tmps.str()]++; } - // Print arguments of probe if there - p->printargs(o); + // collect arguments of the probe if there + set<string> arg_set; + p->getargs(arg_set); + for (set<string>::iterator ia=arg_set.begin(); ia!=arg_set.end(); ++ia) + arg_list[*ia]++; } - o << endl; - seen.insert (pp); + // print the set-intersection only + for (map<string,unsigned>::iterator ir=var_list.begin(); ir!=var_list.end(); ++ir) + if (ir->second == it->second.size()) // print locals + o << " " << ir->first; + for (map<string,unsigned>::iterator ir=arg_list.begin(); ir!=arg_list.end(); ++ir) + if (ir->second == it->second.size()) // print arguments + o << " " << ir->first; } + o << endl; } } else |