From 41211ba31d863acbff6603446f7eefa28c874ddf Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 8 Aug 2008 13:47:27 -0500 Subject: Moved details of utrace detach to stap_utrace_detach(). 2008-08-08 David Smith * tapsets.cxx (utrace_derived_probe_group::emit_module_decls): Calls stap_utrace_detach() to perform detach. 2008-08-08 David Smith * task_finder.c (stap_utrace_detach): New function. (stap_utrace_detach_ops): Calls stap_utrace_detach(). (__stp_utrace_attach_match_filename): Ditto. --- tapsets.cxx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 71c92470..c5679043 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -6290,13 +6290,7 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "case UDPF_SYSCALL:"; s.op->newline() << "case UDPF_SYSCALL_RETURN:"; s.op->indent(1); - s.op->newline() << "engine = utrace_attach(tsk, UTRACE_ATTACH_MATCH_OPS, &p->ops, 0);"; - s.op->newline() << "if (! IS_ERR(engine) && engine != NULL) {"; - s.op->indent(1); - s.op->newline() << "utrace_detach(tsk, engine);"; - s.op->newline() << "debug_task_finder_detach();"; - - s.op->newline(-1) << "}"; + s.op->newline() << "stap_utrace_detach(tsk, &p->ops);"; s.op->newline() << "break;"; s.op->indent(-1); } -- cgit From 32dad3b4df2a4b82898443cf45e5e894350308e2 Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 11 Aug 2008 11:05:53 -0500 Subject: Indentation fix. 2008-08-11 David Smith * tapsets.cxx (utrace_builder::build): Fixed indentation. --- tapsets.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index c5679043..639af099 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -5905,7 +5905,7 @@ struct utrace_builder: public derived_probe_builder // If we have a path, we need to validate it. if (has_path) - { + { string::size_type start_pos, end_pos; string component; @@ -5914,33 +5914,33 @@ struct utrace_builder: public derived_probe_builder // Make sure it starts with '/'. if (path[0] != '/') - throw semantic_error ("process path must start with a '/'", - location->tok); + throw semantic_error ("process path must start with a '/'", + location->tok); start_pos = 1; // get past the initial '/' while ((end_pos = path.find('/', start_pos)) != string::npos) - { + { component = path.substr(start_pos, end_pos - start_pos); // Make sure it isn't empty. if (component.size() == 0) - throw semantic_error ("process path component cannot be empty", - location->tok); + throw semantic_error ("process path component cannot be empty", + location->tok); // Make sure it isn't relative. else if (component == "." || component == "..") - throw semantic_error ("process path cannot be relative (and contain '.' or '..')", location->tok); + throw semantic_error ("process path cannot be relative (and contain '.' or '..')", location->tok); start_pos = end_pos + 1; - } + } component = path.substr(start_pos); // Make sure it doesn't end with '/'. if (component.size() == 0) - throw semantic_error ("process path cannot end with a '/'", location->tok); + throw semantic_error ("process path cannot end with a '/'", location->tok); // Make sure it isn't relative. else if (component == "." || component == "..") - throw semantic_error ("process path cannot be relative (and contain '.' or '..')", location->tok); + throw semantic_error ("process path cannot be relative (and contain '.' or '..')", location->tok); - sess.unwindsym_modules.insert (path); - } + sess.unwindsym_modules.insert (path); + } finished_results.push_back(new utrace_derived_probe(sess, base, location, has_path, path, pid, -- cgit From 2ed8949fe42a23489b130716aea9fe8ce1e94b78 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 11 Aug 2008 13:18:12 -0400 Subject: PR5049: prefix with "*" any filenames given in "fn@filename:line" probes --- tapsets.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 639af099..d4745b9f 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -855,9 +855,14 @@ struct dwflpp bool cu_name_matches(string pattern) { assert(cu); - bool t = (fnmatch(pattern.c_str(), cu_name.c_str(), 0) == 0); + + // PR 5049: implicit * in front of given path pattern. + // NB: fnmatch() is used without FNM_PATHNAME. + string prefixed_pattern = string("*") + pattern; + + bool t = (fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0); if (t && sess.verbose>3) - clog << "pattern '" << pattern << "' " + clog << "pattern '" << prefixed_pattern << "' " << "matches " << "CU '" << cu_name << "'" << "\n"; return t; @@ -1365,13 +1370,17 @@ struct dwflpp size_t nfiles; Dwarf_Files *srcfiles; + // PR 5049: implicit * in front of given path pattern. + // NB: fnmatch() is used without FNM_PATHNAME. + string prefixed_pattern = string("*") + pattern; + dwarf_assert ("dwarf_getsrcfiles", dwarf_getsrcfiles (cu, &srcfiles, &nfiles)); { for (size_t i = 0; i < nfiles; ++i) { char const * fname = dwarf_filesrc (srcfiles, i, NULL, NULL); - if (fnmatch (pattern.c_str(), fname, 0) == 0) + if (fnmatch (prefixed_pattern.c_str(), fname, 0) == 0) { filtered_srcfiles.insert (fname); if (sess.verbose>2) -- cgit From 79640c29c5bcf8de20f013dcc80e1a9c7a93811f Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 11 Aug 2008 16:18:19 -0400 Subject: PR5049: fix overbroad effects of naive "*" prefixing; instead use optional "*/" only. --- tapsets.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index d4745b9f..af9fda52 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -858,11 +858,12 @@ struct dwflpp // PR 5049: implicit * in front of given path pattern. // NB: fnmatch() is used without FNM_PATHNAME. - string prefixed_pattern = string("*") + pattern; + string prefixed_pattern = string("*/") + pattern; - bool t = (fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0); + bool t = (fnmatch(pattern.c_str(), cu_name.c_str(), 0) == 0 || + fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0); if (t && sess.verbose>3) - clog << "pattern '" << prefixed_pattern << "' " + clog << "pattern '" << pattern << "' " << "matches " << "CU '" << cu_name << "'" << "\n"; return t; @@ -1372,7 +1373,7 @@ struct dwflpp // PR 5049: implicit * in front of given path pattern. // NB: fnmatch() is used without FNM_PATHNAME. - string prefixed_pattern = string("*") + pattern; + string prefixed_pattern = string("*/") + pattern; dwarf_assert ("dwarf_getsrcfiles", dwarf_getsrcfiles (cu, &srcfiles, &nfiles)); @@ -1380,7 +1381,8 @@ struct dwflpp for (size_t i = 0; i < nfiles; ++i) { char const * fname = dwarf_filesrc (srcfiles, i, NULL, NULL); - if (fnmatch (prefixed_pattern.c_str(), fname, 0) == 0) + if (fnmatch (pattern.c_str(), fname, 0) == 0 || + fnmatch (prefixed_pattern.c_str(), fname, 0) == 0) { filtered_srcfiles.insert (fname); if (sess.verbose>2) -- cgit