simpleperf: inject: Support --allow-mismatched-build-id for vmlinux
1. When --allow-mismatched-build-id is used, use empty build id
in BinaryKey.
2. Move ModifyBranchMapForKernel() to BranchListMerger,
so ETMBinary with different kernel_start_addr can
be merged.
3. Use vmlinux in SearchFileMapByPath.
Bug: none
Test: run simpleperf_unit_test
Change-Id: I6f7c5e657dddb74cfb5579bcde44cf4a0dbeacf7
diff --git a/simpleperf/dso.cpp b/simpleperf/dso.cpp
index 3c8393f..e953acf 100644
--- a/simpleperf/dso.cpp
+++ b/simpleperf/dso.cpp
@@ -221,9 +221,12 @@
return add_symfs_prefix(elf_path);
}
-std::optional<std::string> DebugElfFileFinder::SearchFileMapByPath(const std::string& path) {
- std::string filename;
- if (size_t pos = path.rfind('/'); pos != std::string::npos) {
+std::optional<std::string> DebugElfFileFinder::SearchFileMapByPath(std::string_view path) {
+ if (path == "[kernel.kallsyms]") {
+ path = "vmlinux";
+ }
+ std::string_view filename;
+ if (size_t pos = path.rfind('/'); pos != path.npos) {
filename = path.substr(pos + 1);
} else {
filename = path;