]> sourceware.org Git - systemtap.git/commitdiff
Improve -l output for .label
authorStan Cox <scox@redhat.com>
Mon, 13 Apr 2009 21:51:58 +0000 (17:51 -0400)
committerStan Cox <scox@redhat.com>
Mon, 13 Apr 2009 21:51:58 +0000 (17:51 -0400)
* tapsets.cxx (iterate_over_cu_labels): Treat -l specially so the
output of a .label can be improved.
* labels.stp: Test -l

tapsets.cxx
testsuite/systemtap.base/labels.exp

index 2316a777f88477520cd133ab629d097697e3fd67..774821c78f67a828d74a9e4e33e4f510409af10d 100644 (file)
@@ -1339,8 +1339,12 @@ struct dwflpp
   }
 
   void
-  iterate_over_cu_labels (string label_val, string function, Dwarf_Die *cu,
-                         void *data,
+  iterate_over_cu_labels (string label_val,
+                         string function,
+                         Dwarf_Die *cu,
+                         vector<derived_probe *>  & results, 
+                         probe_point *base_loc,
+                         void *data, 
                          void (* callback)(const string &,
                                            const char *,
                                            int,
@@ -1375,7 +1379,7 @@ struct dwflpp
            function_name = name;
          default:
            if (dwarf_haschildren (&die))
-             iterate_over_cu_labels (label_val, function, &die, q, callback);
+             iterate_over_cu_labels (label_val, function, &die, results, base_loc, q, callback);
            continue;
          }
        
@@ -1420,8 +1424,13 @@ struct dwflpp
            int nscopes = 0;
            nscopes = dwarf_getscopes_die (&die, &scopes);
            if (nscopes > 1)
-             callback(function_name.c_str(), file,
-                      (int)dline, &scopes[1], stmt_addr, q);
+             {
+               callback(function_name.c_str(), file,
+                        (int)dline, &scopes[1], stmt_addr, q);
+               if (sess.listing_mode)
+                 results.back()->locations[0]->components.push_back
+                   (new probe_point::component(TOK_LABEL, new literal_string (name)));
+             }
          }
       }
     while (dwarf_siblingof (&die, &die) == 0);
@@ -4121,7 +4130,7 @@ query_cu (Dwarf_Die * cudie, void * arg)
            {
              // If we have a pattern string with target *label*, we
              // have to look at labels in all the matched srcfiles.
-             q->dw.iterate_over_cu_labels (q->label_val, q->function, q->dw.cu, q, query_statement);
+             q->dw.iterate_over_cu_labels (q->label_val, q->function, q->dw.cu, q->results, q->base_loc, q, query_statement);
            }
          else
            {
index 268bb3208ddf71db7669b627af6f2ac60437007a..88ed4619f6f6a005a8be96b5f7db50373fdcff4c 100644 (file)
@@ -55,8 +55,23 @@ if { $res != "" } {
     pass "compiling labels.c -g"
 }
 
+# list of labels
+
+spawn stap -l "process(\"$label_exepath\").function(\"*\").label(\"*\")"
+
+wait
+expect {
+    -timeout 180
+    -re {process.*function.*labels.c:5...label..init_an_int.*process.*function.*labels.c:16...label..init_an_int.*process.*function.*labels.c:18...label..init_an_int_again} { incr ok; exp_continue }
+    timeout { fail "$test (timeout)" }
+    eof { }
+}
+
+if {$ok == 1} { pass "$test -l .label" } { fail "$test -l .label $ok" }
+
 # label in an executable
 
+set ok 0
 verbose -log "spawn stap -c $label_exepath $label_stppath"
 spawn stap -c $label_exepath $label_stppath
 
This page took 0.038306 seconds and 5 git commands to generate.