]> sourceware.org Git - systemtap.git/commitdiff
sdt_query: initialize probe_type/loc as unknown.
authorJosh Stone <jistone@redhat.com>
Thu, 12 Apr 2012 19:51:24 +0000 (12:51 -0700)
committerJosh Stone <jistone@redhat.com>
Thu, 12 Apr 2012 21:32:28 +0000 (14:32 -0700)
The fields, probe_type and probe_loc, are meaningless to start, and are
later set as the queried module is examined.  Commit 74fe61bc tried to
make sure that all POD types in this class are initialized, but these
two were essentially self-assigned.  Gcc misses this uninitialized use,
but clang caught it:

  CXX    stap-tapsets.o
../tapsets.cxx:6058:38: error: field is uninitialized when used here [-Werror,-Wuninitialized]
  base_query(dw, params), probe_type(probe_type), probe_loc(probe_loc), base_probe(base_probe),
                                     ^
../tapsets.cxx:6058:61: error: field is uninitialized when used here [-Werror,-Wuninitialized]
  base_query(dw, params), probe_type(probe_type), probe_loc(probe_loc), base_probe(base_probe),
                                                            ^

Values for "unknown" are now added to these enum types to initialize
with, and dealt with where needed.

sdt_types.h
tapsets.cxx

index 461da4c06c9fd85d39a2dfe79c6a1390eb33292d..74ef02a38754bb956218570488b6de5bbefc4cf2 100644 (file)
@@ -18,7 +18,8 @@ typedef enum
     kprobe1_type = KPROBE1_TYPE,
     uprobe2_type = UPROBE2_TYPE,
     kprobe2_type = KPROBE2_TYPE,
-    uprobe3_type = UPROBE3_TYPE
+    uprobe3_type = UPROBE3_TYPE,
+    unknown_probe_type = -1,
   } stap_sdt_probe_type;
 
 typedef struct
index 97cedc0c74acc793d02a249d6cfee80ad159e265..b998805a5eb8b44c741600a384bcc72f3da35066 100644 (file)
@@ -6009,7 +6009,7 @@ struct sdt_query : public base_query
 
 private:
   stap_sdt_probe_type probe_type;
-  enum {probe_section=0, note_section=1} probe_loc;
+  enum { probe_section=0, note_section=1, unknown_section=-1 } probe_loc;
   probe * base_probe;
   probe_point * base_loc;
   literal_map_t const & params;
@@ -6055,7 +6055,8 @@ private:
 sdt_query::sdt_query(probe * base_probe, probe_point * base_loc,
                      dwflpp & dw, literal_map_t const & params,
                      vector<derived_probe *> & results, const string user_lib):
-  base_query(dw, params), probe_type(probe_type), probe_loc(probe_loc), base_probe(base_probe),
+  base_query(dw, params), probe_type(unknown_probe_type),
+  probe_loc(unknown_section), base_probe(base_probe),
   base_loc(base_loc), params(params), results(results), user_lib(user_lib),
   probe_scn_offset(0), probe_scn_addr(0), arg_count(0), base(0), pc(0),
   semaphore(0)
@@ -6107,6 +6108,9 @@ sdt_query::handle_probe_entry()
        case kprobe2_type:
          clog << "kprobe2" << endl;
          break;
+       default:
+         clog << "unknown!" << endl;
+         break;
        }
     }
 
@@ -6218,7 +6222,7 @@ sdt_query::handle_query_module()
        base = 0;
       dw.iterate_over_notes ((void*) this, &sdt_query::setup_note_probe_entry_callback);
     }
-  else
+  else if (probe_loc == probe_section)
     iterate_over_probe_entries ();
 }
 
This page took 0.039775 seconds and 5 git commands to generate.