Allow to pass path to LocalSymbolizer.
Change-Id: I6fb900302249111e169d375290eaf45e850cfc2e
diff --git a/src/profiling/symbolizer/local_symbolizer.cc b/src/profiling/symbolizer/local_symbolizer.cc
index 27a5a9f..597a5f0 100644
--- a/src/profiling/symbolizer/local_symbolizer.cc
+++ b/src/profiling/symbolizer/local_symbolizer.cc
@@ -75,7 +75,9 @@
#include <sys/types.h>
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
-#define F_OK 0
+constexpr const char* kDefaultSymbolizer = "llvm-symbolizer.exe";
+#else
+constexpr const char* kDefaultSymbolizer = "llvm-symbolizer";
#endif
namespace perfetto {
@@ -584,13 +586,13 @@
LocalBinaryFinder::~LocalBinaryFinder() = default;
-LLVMSymbolizerProcess::LLVMSymbolizerProcess()
+LLVMSymbolizerProcess::LLVMSymbolizerProcess(const std::string& symbolizer_path)
:
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
- subprocess_("llvm-symbolizer.exe", {}) {
+ subprocess_(symbolizer_path, {}) {
}
#else
- subprocess_("llvm-symbolizer", {"llvm-symbolizer"}) {
+ subprocess_(symbolizer_path, {"llvm-symbolizer"}) {
}
#endif
@@ -662,6 +664,13 @@
return result;
}
+LocalSymbolizer::LocalSymbolizer(const std::string& symbolizer_path,
+ std::unique_ptr<BinaryFinder> finder)
+ : llvm_symbolizer_(symbolizer_path), finder_(std::move(finder)) {}
+
+LocalSymbolizer::LocalSymbolizer(std::unique_ptr<BinaryFinder> finder)
+ : LocalSymbolizer(kDefaultSymbolizer, std::move(finder)) {}
+
LocalSymbolizer::~LocalSymbolizer() = default;
} // namespace profiling