ASSERT_TRUE(symbolizer.symbolize(reinterpret_cast<uintptr_t>(foo), a));
EXPECT_EQ("folly::symbolizer::test::foo()", a.demangledName());
- auto path = a.location.file.toString();
- folly::StringPiece basename(path);
- auto pos = basename.rfind('/');
- if (pos != folly::StringPiece::npos) {
- basename.advance(pos + 1);
+ // The version of clang we use doesn't generate a `.debug_aranges` section,
+ // which the symbolizer needs to lookup the filename.
+ constexpr bool built_with_clang =
+ #ifdef __clang__
+ true;
+ #else
+ false;
+ #endif
+ if (!built_with_clang) {
+ auto path = a.location.file.toString();
+ folly::StringPiece basename(path);
+ auto pos = basename.rfind('/');
+ if (pos != folly::StringPiece::npos) {
+ basename.advance(pos + 1);
+ }
+ EXPECT_EQ("SymbolizerTest.cpp", basename.str());
}
- EXPECT_EQ("SymbolizerTest.cpp", basename.str());
}
FrameArray<100> goldenFrames;
namespace {
std::string getHelperPath() {
+ const auto basename = "nested_command_line_app_test_helper";
auto path = fs::executable_path();
- path.remove_filename() /= "nested_command_line_app_test_helper";
+ path.remove_filename() /= basename;
+ if (!fs::exists(path)) {
+ path = path.parent_path().parent_path() / basename / basename;
+ }
return path.native();
}
namespace {
std::string getHelperPath() {
+ const auto basename = "program_options_test_helper";
auto path = fs::executable_path();
- path.remove_filename() /= "program_options_test_helper";
+ path.remove_filename() /= basename;
+ if (!fs::exists(path)) {
+ path = path.parent_path().parent_path() / basename / basename;
+ }
return path.native();
}