instrumentation: include functions with specific calls (#202)

* instrumentation: include functions with specific calls

Add the option `--caller-include <regex>` or environment variable
`OMNITRACE_REGEX_CALLER_INCLUDE` to instrument functions which contain
call to a set of functions, E.g. `--caller-include foo` instruments any
function which calls `foo`.

* Serialize caller include information

* Add test for caller include

* Tweak to the caller include test

- tweak environment
- tweak pass regexes

* Set rewrite caller example to debug

, to avoid optimizing out the call expressions that it relies on.

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
Mészáros Gergely
2022-11-11 09:32:57 +01:00
committed by GitHub
orang tua 654beef6ab
melakukan 1b8f09aa2d
8 mengubah file dengan 115 tambahan dan 1 penghapusan
+22 -1
Melihat File
@@ -333,7 +333,7 @@ module_function::is_user_included() const
}
}
return false;
return contains_user_callsite();
}
bool
@@ -534,6 +534,27 @@ module_function::contains_dynamic_callsites() const
return false;
}
bool
module_function::contains_user_callsite() const
{
if(caller_include.empty()) return false;
bpvector_t<BPatch_point*> call_points;
function->getCallPoints(call_points);
for(const auto& call_point : call_points)
{
if(check_regex_restrictions(
std::string(get_name(call_point->getCalledFunction())), caller_include))
{
messages.emplace_back(2, "Forcing", "function", "caller-include-regex",
function_name);
return true;
}
}
return false;
}
bool
module_function::is_dynamic_callsite_forced() const
{