#include "Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h"
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
#include "Plugins/Platform/Android/PlatformAndroid.h"
#include "Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h"
#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
#include "TestingSupport/SubsystemRAII.h"
#include "TestingSupport/TestUtilities.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Target.h"
#include "gmock/gmock.h"
usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacelldb_private::platform_android;
usingnamespacelldb_private::platform_linux;
usingnamespacelldb_private::breakpad;
usingnamespacetesting;
namespace {
constexpr llvm::StringLiteral k_process_plugin("mock-process-plugin");
constexpr llvm::StringLiteral k_platform_dir("remote-android");
constexpr llvm::StringLiteral k_cache_dir(".cache");
constexpr llvm::StringLiteral k_module_file("AndroidModule.so");
constexpr llvm::StringLiteral k_symbol_file("AndroidModule.unstripped.so");
constexpr llvm::StringLiteral k_breakpad_symbol_file("AndroidModule.so.sym");
constexpr llvm::StringLiteral k_arch("aarch64-none-linux");
constexpr llvm::StringLiteral
k_module_uuid("80008338-82A0-51E5-5922-C905D23890DA-BDDEFECC");
constexpr llvm::StringLiteral k_function_symbol("boom");
constexpr llvm::StringLiteral k_hidden_function_symbol("boom_hidden");
const size_t k_module_size = …;
ModuleSpec GetTestModuleSpec();
class MockProcess : public Process { … };
FileSpec GetTestDir() { … }
FileSpec GetRemotePath() { … }
FileSpec GetUuidView(FileSpec spec) { … }
void BuildEmptyCacheDir(const FileSpec &test_dir) { … }
FileSpec BuildCacheDir(const FileSpec &test_dir) { … }
FileSpec GetSymFileSpec(const FileSpec &uuid_view) { … }
FileSpec BuildCacheDirWithSymbol(const FileSpec &test_dir) { … }
FileSpec BuildCacheDirWithBreakpadSymbol(const FileSpec &test_dir) { … }
ModuleSpec GetTestModuleSpec() { … }
void CheckModule(const ModuleSP &module_sp) { … }
SymbolContextList FindFunctions(const ModuleSP &module_sp,
const llvm::StringRef &name) { … }
void CheckStrippedSymbol(const ModuleSP &module_sp) { … }
void CheckUnstrippedSymbol(const ModuleSP &module_sp) { … }
ProcessSP MockProcessCreateInstance(TargetSP target_sp, ListenerSP listener_sp,
const FileSpec *crash_file_path,
bool can_connect) { … }
class LocateModuleCallbackTest : public testing::Test { … };
}
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleWithCachedModule) { … }
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleWithCachedModuleAndSymbol) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleWithCachedModuleAndBreakpadSymbol) { … }
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleFailure) { … }
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleCallbackFailureNoCache) { … }
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleCallbackFailureCached) { … }
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleCallbackNoFiles) { … }
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleCallbackNonExistentModule) { … }
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleCallbackNonExistentSymbol) { … }
TEST_F(LocateModuleCallbackTest, GetOrCreateModuleCallbackSuccessWithModule) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithSymbolAsModule) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithSymbolAsModuleAndSymbol) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithModuleAndSymbol) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithModuleAndBreakpadSymbol) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithOnlySymbol) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithOnlyBreakpadSymbol) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithMultipleSymbols) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleNoCacheWithCallbackOnlySymbol) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleNoCacheWithCallbackOnlyBreakpadSymbol) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithModuleByPlatformUUID) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithSymbolByPlatformUUID) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithBreakpadSymbolByPlatformUUID) { … }
TEST_F(LocateModuleCallbackTest,
GetOrCreateModuleCallbackSuccessWithOnlyBreakpadSymbolByPlatformUUID) { … }