]> sourceware.org Git - systemtap.git/commitdiff
Improve static probe: c++ navigation, -l output.
authorStan Cox <scox@redhat.com>
Mon, 23 Feb 2009 22:14:52 +0000 (17:14 -0500)
committerStan Cox <scox@redhat.com>
Mon, 23 Feb 2009 22:14:52 +0000 (17:14 -0500)
* tapsets.cxx (dwflpp::build): Improve c+ method navigation.
Use .label for listing mode.
* systemtap.base/static_uprobes.exp: Test multiple invocations of the same
probe per block. (SW9770)

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

index 5d9d062fc4535cae01d84eea780af2e855a7bf61..77e2efcc4512e79b393080df7f9146e89e667bf8 100644 (file)
@@ -1341,13 +1341,11 @@ struct dwflpp
        Dwarf_Attribute *attr = dwarf_attr (&die, DW_AT_name, &attr_mem);
        int tag = dwarf_tag(&die);
        const char *name = dwarf_formstring (attr);
-       if (name == NULL)
-         continue;
-       if (tag == DW_TAG_subprogram)
+       if (tag == DW_TAG_subprogram && name != 0)
          {
            function_name = name;
          }
-       else if (tag == DW_TAG_label
+       else if (tag == DW_TAG_label && name != 0
                 && ((strncmp(name, sym, strlen(sym)) == 0)
                     || (name_has_wildcard (sym)
                         && function_name_matches_pattern (name, sym))))
@@ -5727,7 +5725,7 @@ dwarf_builder::build(systemtap_session & sess,
          }
       }
     
-    if (probe_type == probes_and_dwarf)
+    if (probe_type == probes_and_dwarf && ! sess.listing_mode)
       {
        Elf_Data *pdata = elf_getdata_rawchunk (elf, shdr->sh_offset, shdr->sh_size, ELF_T_BYTE);
        assert (pdata != NULL);
@@ -5751,17 +5749,22 @@ dwarf_builder::build(systemtap_session & sess,
            if (probe_scn_offset % (sizeof(__uint64_t)))
              probe_scn_offset += sizeof(__uint64_t) - (probe_scn_offset % sizeof(__uint64_t));
            probe_arg = *((__uint64_t*)((char*)pdata->d_buf + probe_scn_offset));
-           if (strcmp (location->components[1]->arg->tok->content.c_str(), probe_name.c_str()) == 0)
-             {
-               probe_found = true;
-               break;
-             }
            if (probe_scn_offset % (sizeof(__uint64_t)*2))
              probe_scn_offset = (probe_scn_offset + sizeof(__uint64_t)*2) - (probe_scn_offset % (sizeof(__uint64_t)*2));
+           if (strcmp (location->components[1]->arg->tok->content.c_str(), probe_name.c_str()) == 0)
+             probe_found = true;
+           else
+             continue;
+           const token* sv_tok = location->components[1]->arg->tok;
+           location->components[1]->functor = TOK_STATEMENT;
+           location->components[1]->arg = new literal_number((int)probe_arg);
+           location->components[1]->arg->tok = sv_tok;
+           ((literal_map_t&)parameters)[TOK_STATEMENT] = location->components[1]->arg;
+           dwarf_query q(sess, base, location, *dw, parameters, finished_results);
+           dw->query_modules(&q);
          }
-       location->components[1]->functor = TOK_STATEMENT;
-       location->components[1]->arg = new literal_number((int)probe_arg);
-       ((literal_map_t&)parameters)[TOK_STATEMENT] = location->components[1]->arg;
+       if (probe_found)
+         return;
       }
 
     if (probe_type == dwarf_no_probes || ! probe_found)
index c76d48057ad2b031d04afb8cffb4a04e777229c1..a4bd5e2c8f16b83da48be7e97fc3f240799a66ed 100644 (file)
@@ -14,6 +14,7 @@ puts $fp "
 void
 bar (int i)
 {
+  STATIC_UPROBES_TEST_PROBE_2(i);
   if (i == 0)
     i = 1000;
   STAP_PROBE1(static_uprobes,test_probe_2,i);
@@ -158,7 +159,7 @@ expect {
 
 wait
 
-if {$ok == 4} { pass "$test C" } { fail "$test C ($ok)" }
+if {$ok == 5} { pass "$test C" } { fail "$test C ($ok)" }
 
 set ok 0
 
@@ -169,7 +170,6 @@ verbose -log "spawn stap -c $sup_exepath $sup_stppath"
 spawn stap -c $sup_exepath $sup_stppath
 expect {
     -timeout 180
-    -re {In test_probe_1 probe} { incr ok; exp_continue }
     -re {In test_probe_2 probe 0x2} { incr ok; exp_continue }
     -re {In test_probe_0 probe 0x3} { incr ok; exp_continue }
     -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue }
@@ -180,7 +180,7 @@ expect {
 
 wait
 
-if {$ok == 4} { pass "$test C++" } { fail "$test C++ ($ok)" }
+if {$ok == 5} { pass "$test C++" } { fail "$test C++ ($ok)" }
 
 # catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_hpath $sup_stppath}
 
This page took 0.038358 seconds and 5 git commands to generate.