summaryrefslogtreecommitdiff
path: root/simpleperf/environment.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2020-07-22 13:01:31 -0700
committerYabin Cui <yabinc@google.com>2020-07-22 15:49:53 -0700
commitea105c86bb4e90afccdfc1a78c4efddee3ad743c (patch)
tree713b33e6f49c5db8650f0cee2f562cc57b905ba2 /simpleperf/environment.cpp
parent9a615c405f3d7dc7316bad16733a7304a9aad7f4 (diff)
downloadextras-ea105c86bb4e90afccdfc1a78c4efddee3ad743c.tar.gz
simpleperf: Fix GetModuleBuildId.
Bug: 161546498 Test: run simpleperf_unit_test Change-Id: Ic3b6cb37325ea125ecc1bd690ddfef865f421bc9
Diffstat (limited to 'simpleperf/environment.cpp')
-rw-r--r--simpleperf/environment.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/simpleperf/environment.cpp b/simpleperf/environment.cpp
index da49f71e..b779aba1 100644
--- a/simpleperf/environment.cpp
+++ b/simpleperf/environment.cpp
@@ -251,9 +251,10 @@ bool GetKernelBuildId(BuildId* build_id) {
return result == ElfStatus::NO_ERROR;
}
-bool GetModuleBuildId(const std::string& module_name, BuildId* build_id) {
- std::string notefile = "/sys/module/" + module_name + "/notes/.note.gnu.build-id";
- return GetBuildIdFromNoteFile(notefile, build_id);
+bool GetModuleBuildId(const std::string& module_name, BuildId* build_id,
+ const std::string& sysfs_dir) {
+ std::string notefile = sysfs_dir + "/module/" + module_name + "/notes/.note.gnu.build-id";
+ return GetBuildIdFromNoteFile(notefile, build_id) == ElfStatus::NO_ERROR;
}
bool GetValidThreadsFromThreadString(const std::string& tid_str, std::set<pid_t>* tid_set) {