diff options
author | Josh Stone <jistone@redhat.com> | 2009-09-17 16:51:40 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-09-17 16:52:31 -0700 |
commit | 5c34cc891d6929ff9cd52b6fe725873c181b094e (patch) | |
tree | 998ff3c63715eaabfd14b9a835a07d8b71198b7d /tapsets.cxx | |
parent | 4ddb6dd03ee4364bdb36bc32888846faad48a080 (diff) | |
download | systemtap-steved-5c34cc891d6929ff9cd52b6fe725873c181b094e.tar.gz systemtap-steved-5c34cc891d6929ff9cd52b6fe725873c181b094e.tar.xz systemtap-steved-5c34cc891d6929ff9cd52b6fe725873c181b094e.zip |
Simplify sdt's record_semaphore
* tapsets.cxx (sdt_query::record_semaphore): Use lookup_symbol_address.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index 4bede3c9..ed9e1d56 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3709,22 +3709,11 @@ sdt_query::get_next_probe() void sdt_query::record_semaphore (vector<derived_probe *> & results, unsigned start) { - int sym_count = dwfl_module_getsymtab(dw.module); - assert (sym_count >= 0); - for (int i = 0; i < sym_count; i++) - { - GElf_Sym sym; - GElf_Word shndxp; - char *sym_str = (char*)dwfl_module_getsym (dw.module, i, &sym, &shndxp); - if (strcmp(sym_str, string(probe_name + "_semaphore").c_str()) == 0) - { - string process_name; - derived_probe_builder::get_param(params, TOK_PROCESS, process_name); - for (unsigned i = start; i < results.size(); ++i) - sess.sdt_semaphore_addr.insert(make_pair(results[i], sym.st_value)); - break; - } - } + string semaphore = probe_name + "_semaphore"; + Dwarf_Addr addr = lookup_symbol_address(dw.module, semaphore.c_str()); + if (addr) + for (unsigned i = start; i < results.size(); ++i) + sess.sdt_semaphore_addr.insert(make_pair(results[i], addr)); } |