From ea105c86bb4e90afccdfc1a78c4efddee3ad743c Mon Sep 17 00:00:00 2001 From: Yabin Cui Date: Wed, 22 Jul 2020 13:01:31 -0700 Subject: simpleperf: Fix GetModuleBuildId. Bug: 161546498 Test: run simpleperf_unit_test Change-Id: Ic3b6cb37325ea125ecc1bd690ddfef865f421bc9 --- simpleperf/environment.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'simpleperf/environment.cpp') 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* tid_set) { -- cgit v1.2.3