This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix redundant implicit probe points in listing mode.


Frank Ch. Eigler wrote:
[...]
@@ -1148,6 +1148,8 @@ semantic_pass_symbols (systemtap_session& s)
 void add_global_var_display (systemtap_session& s)
 {
   varuse_collecting_visitor vut;
+
+  if (s.listing_mode)  return;

That's not too bad, though perhaps a session flag for global_var_display per se could be used instead. (It'd default to "on"; not have any command line option to disable it directly yet; but "-l"/'-L" would clear it.)


@@ -173,7 +173,8 @@ printscript(systemtap_session& s, ostream& o)
               second->locations[0]->print(tmps); // XXX: [0] is less
arbitrary here, but still ...
             }
           string pp = tmps.str();
-
+          if (!pp.compare("begin(-1)")) continue;
+

This one can't go in. Instead, the tapset that includes that begin(-1) probe could be changed to do the initialization in a function (with a private initted-already? flag) rather than the begin probe. Future listings based on PR 3498 should make that workaround unnecessary.
Thanks for your comments.
The begin(-1) probe is only included in tapset/signal.stp. So only
stap -l signal.* will list begin(-1) probe.

Updated the signal tapset and change begin(-1) to local function to avoid the redundant one.

---
 elaborate.cxx     |    2 ++
 tapset/signal.stp |    7 +------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/elaborate.cxx b/elaborate.cxx
index 3dfc718..15ced84 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1148,6 +1148,8 @@ semantic_pass_symbols (systemtap_session& s)
 void add_global_var_display (systemtap_session& s)
 {
   varuse_collecting_visitor vut;
+
+  if (s.listing_mode) return; //avoid end probe in listing_mode
   for (unsigned i=0; i<s.probes.size(); i++)
     {
       s.probes[i]->body->visit (& vut);
diff --git a/tapset/signal.stp b/tapset/signal.stp
index 1128e6f..d08c0c1 100644
--- a/tapset/signal.stp
+++ b/tapset/signal.stp
@@ -609,12 +609,6 @@ function sa_handler_str(handler) {
  * Signals start from 1 not 0.
  */
 function signal_str(num) {
-       return __sig[num]
-}
-
-global __sig[64]
-
-probe begin(-1) {
        __sig[1] = "HUP"
        __sig[2] = "INT"
        __sig[3] = "QUIT"
@@ -679,4 +673,5 @@ probe begin(-1) {
        __sig[62] = "RTMIN+30"
        __sig[63] = "RTMIN+31"
        __sig[64] = "RTMIN+32"
+       return __sig[num]
 }
--


Regards, Wenji




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]