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/Host/FileSystem.h" 14 #include "lldb/Host/HostInfo.h" 15 #include "lldb/Symbol/LocateSymbolFile.h" 16 #include "lldb/Target/Target.h" 17 #include "lldb/Utility/Reproducer.h" 18 19 using namespace lldb_private; 20 21 namespace { 22 class SymbolsTest : public ::testing::Test { 23 public: 24 SubsystemRAII<repro::Reproducer, FileSystem, HostInfo> subsystems; 25 }; 26 } // namespace 27 28 TEST_F( 29 SymbolsTest, 30 TerminateLocateExecutableSymbolFileForUnknownExecutableAndUnknownSymbolFile) { 31 ModuleSpec module_spec; 32 FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); 33 FileSpec symbol_file_spec = 34 Symbols::LocateExecutableSymbolFile(module_spec, search_paths); 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 "4A524676-B24B-4F4E-968A-551D465EBAF1.so", FileSpec::Style::native); 44 FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); 45 FileSpec symbol_file_spec = 46 Symbols::LocateExecutableSymbolFile(module_spec, search_paths); 47 EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty()); 48 } 49