summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-10-06 20:01:13 -0700
committerJosh Stone <jistone@redhat.com>2009-10-06 20:01:13 -0700
commit038c38c6119e29189be83c3a214c635c0d02ee58 (patch)
tree52dcb2eccaee50dc4ab6684b4aec80f8b6a4663d
parent47f025139d1c2e75781cdab40dc9195396133754 (diff)
downloadsystemtap-steved-038c38c6119e29189be83c3a214c635c0d02ee58.tar.gz
systemtap-steved-038c38c6119e29189be83c3a214c635c0d02ee58.tar.xz
systemtap-steved-038c38c6119e29189be83c3a214c635c0d02ee58.zip
Remove the global derived_probe->semaphore map
Instead just make the semaphore address a member of derived_probe. * session.h (systemtap_session): Remove the map sdt_semaphore_addr. * elaborate.h (derived_probe): Add sdt_semaphore_addr directly. * tapsets.cxx (sdt_query::record_semaphore): Write the addr directly. (uprobe_derived_probe_group::emit_module_decls): Read it directly. * tapset-utrace.cxx (utrace_derived_probe_group::emit_probe_decl): Ditto
-rw-r--r--elaborate.cxx4
-rw-r--r--elaborate.h7
-rw-r--r--session.h4
-rw-r--r--tapset-utrace.cxx7
-rw-r--r--tapsets.cxx7
5 files changed, 14 insertions, 15 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index 01c6e3cd..2d75058d 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -55,7 +55,7 @@ expression* add_condition (expression* a, expression* b)
derived_probe::derived_probe (probe *p):
- base (p)
+ base (p), sdt_semaphore_addr(0)
{
assert (p);
this->locations = p->locations;
@@ -66,7 +66,7 @@ derived_probe::derived_probe (probe *p):
derived_probe::derived_probe (probe *p, probe_point *l):
- base (p)
+ base (p), sdt_semaphore_addr(0)
{
assert (p);
this->tok = p->tok;
diff --git a/elaborate.h b/elaborate.h
index cd60b8bb..28294aa9 100644
--- a/elaborate.h
+++ b/elaborate.h
@@ -18,6 +18,10 @@
#include <sstream>
#include <map>
+extern "C" {
+#include <elfutils/libdw.h>
+}
+
// ------------------------------------------------------------------------
struct derived_probe;
@@ -153,6 +157,9 @@ public:
virtual bool needs_global_locks () { return true; }
// by default, probes need locks around global variables
+
+ // Location of semaphores to activate sdt probes
+ Dwarf_Addr sdt_semaphore_addr;
};
// ------------------------------------------------------------------------
diff --git a/session.h b/session.h
index 760b610a..a2176793 100644
--- a/session.h
+++ b/session.h
@@ -221,10 +221,6 @@ struct systemtap_session
void print_error_source (std::ostream&, std::string&, const token* tok);
void print_warning (const std::string& w, const token* tok = 0);
-
- // Location of semaphores to activate sdt probes
- std::map<derived_probe*, Dwarf_Addr> sdt_semaphore_addr;
-
// NB: It is very important for all of the above (and below) fields
// to be cleared in the systemtap_session ctor (elaborate.cxx)
// and/or main.cxx(main).
diff --git a/tapset-utrace.cxx b/tapset-utrace.cxx
index b13dc290..d2ce9dd7 100644
--- a/tapset-utrace.cxx
+++ b/tapset-utrace.cxx
@@ -717,12 +717,9 @@ utrace_derived_probe_group::emit_probe_decl (systemtap_session& s,
}
s.op->line() << " .engine_attached=0,";
- map<derived_probe*, Dwarf_Addr>::iterator its = s.sdt_semaphore_addr.find(p);
- if (its == s.sdt_semaphore_addr.end())
- s.op->line() << " .sdt_sem_address=(unsigned long)0x0,";
- else
+ if (p->sdt_semaphore_addr != 0)
s.op->line() << " .sdt_sem_address=(unsigned long)0x"
- << hex << its->second << dec << "ULL,";
+ << hex << p->sdt_semaphore_addr << dec << "ULL,";
s.op->line() << " .tsk=0,";
s.op->line() << " },";
diff --git a/tapsets.cxx b/tapsets.cxx
index 6267f314..09ead991 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -3699,7 +3699,7 @@ sdt_query::record_semaphore (vector<derived_probe *> & results, unsigned start)
if (dwfl_module_relocations (dw.module) > 0)
dwfl_module_relocate_address (dw.module, &addr);
for (unsigned i = start; i < results.size(); ++i)
- sess.sdt_semaphore_addr.insert(make_pair(results[i], addr));
+ results[i]->sdt_semaphore_addr = addr;
}
}
@@ -4447,10 +4447,9 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
s.op->line() << " .pp=" << lex_cast_qstring (*p->sole_location()) << ",";
s.op->line() << " .ph=&" << p->name << ",";
- map<derived_probe*, Dwarf_Addr>::iterator its = s.sdt_semaphore_addr.find(p);
- if (its != s.sdt_semaphore_addr.end())
+ if (p->sdt_semaphore_addr != 0)
s.op->line() << " .sdt_sem_address=(unsigned long)0x"
- << hex << its->second << dec << "ULL,";
+ << hex << p->sdt_semaphore_addr << dec << "ULL,";
if (p->has_return)
s.op->line() << " .return_p=1,";