| 1 | //===-- SymbolsTest.cpp ---------------------------------------------------===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "gtest/gtest.h" |
| 10 | |
| 11 | #include "TestingSupport/SubsystemRAII.h" |
| 12 | #include "lldb/Core/ModuleSpec.h" |
| 13 | #include "lldb/Core/PluginManager.h" |
| 14 | #include "lldb/Host/FileSystem.h" |
| 15 | #include "lldb/Host/HostInfo.h" |
| 16 | #include "lldb/Target/Target.h" |
| 17 | |
| 18 | using namespace lldb_private; |
| 19 | |
| 20 | namespace { |
| 21 | class SymbolsTest : public ::testing::Test { |
| 22 | public: |
| 23 | SubsystemRAII<FileSystem, HostInfo> subsystems; |
| 24 | }; |
| 25 | } // namespace |
| 26 | |
| 27 | TEST_F( |
| 28 | SymbolsTest, |
| 29 | TerminateLocateExecutableSymbolFileForUnknownExecutableAndUnknownSymbolFile) { |
| 30 | ModuleSpec module_spec; |
| 31 | FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); |
| 32 | StatisticsMap map; |
| 33 | FileSpec symbol_file_spec = |
| 34 | PluginManager::LocateExecutableSymbolFile(module_spec, default_search_paths: search_paths, map); |
| 35 | EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty()); |
| 36 | } |
| 37 | |
| 38 | TEST_F(SymbolsTest, |
| 39 | LocateExecutableSymbolFileForUnknownExecutableAndMissingSymbolFile) { |
| 40 | ModuleSpec module_spec; |
| 41 | // using a GUID here because the symbol file shouldn't actually exist on disk |
| 42 | module_spec.GetSymbolFileSpec().SetFile( |
| 43 | path: "4A524676-B24B-4F4E-968A-551D465EBAF1.so", style: FileSpec::Style::native); |
| 44 | FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); |
| 45 | StatisticsMap map; |
| 46 | FileSpec symbol_file_spec = |
| 47 | PluginManager::LocateExecutableSymbolFile(module_spec, default_search_paths: search_paths, map); |
| 48 | EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty()); |
| 49 | } |
| 50 |
