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>

[ROCm/rocprofiler-systems commit: 1b8f09aa2d]
이 커밋은 다음에 포함됨:
Mészáros Gergely
2022-11-11 09:32:57 +01:00
커밋한 사람 GitHub
부모 7c9534e601
커밋 0e963e47c8
8개의 변경된 파일과 115개의 추가작업 그리고 1개의 파일을 삭제
+22 -1
파일 보기
@@ -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
{