llvm/lldb/source/Core/Module.cpp

//===-- Module.cpp --------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/Core/Module.h"

#include "lldb/Core/AddressRange.h"
#include "lldb/Core/AddressResolverFileLine.h"
#include "lldb/Core/DataFileCache.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/Section.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolLocator.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/FileSpecList.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"

#if defined(_WIN32)
#include "lldb/Host/windows/PosixApi.h"
#endif

#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"

#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DJB.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"

#include <cassert>
#include <cinttypes>
#include <cstdarg>
#include <cstdint>
#include <cstring>
#include <map>
#include <optional>
#include <type_traits>
#include <utility>

namespace lldb_private {
class CompilerDeclContext;
}
namespace lldb_private {
class VariableList;
}

usingnamespacelldb;
usingnamespacelldb_private;

// Shared pointers to modules track module lifetimes in targets and in the
// global module, but this collection will track all module objects that are
// still alive
ModuleCollection;

static ModuleCollection &GetModuleCollection() {}

std::recursive_mutex &Module::GetAllocationModuleCollectionMutex() {}

size_t Module::GetNumberAllocatedModules() {}

Module *Module::GetAllocatedModuleAtIndex(size_t idx) {}

Module::Module(const ModuleSpec &module_spec)
    :{}

Module::Module(const FileSpec &file_spec, const ArchSpec &arch,
               ConstString object_name, lldb::offset_t object_offset,
               const llvm::sys::TimePoint<> &object_mod_time)
    :{}

Module::Module()
    :{}

Module::~Module() {}

ObjectFile *Module::GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
                                        lldb::addr_t header_addr, Status &error,
                                        size_t size_to_read) {}

const lldb_private::UUID &Module::GetUUID() {}

void Module::SetUUID(const lldb_private::UUID &uuid) {}

llvm::Expected<TypeSystemSP>
Module::GetTypeSystemForLanguage(LanguageType language) {}

void Module::ForEachTypeSystem(
    llvm::function_ref<bool(lldb::TypeSystemSP)> callback) {}

void Module::ParseAllDebugSymbols() {}

void Module::CalculateSymbolContext(SymbolContext *sc) {}

ModuleSP Module::CalculateSymbolContextModule() {}

void Module::DumpSymbolContext(Stream *s) {}

size_t Module::GetNumCompileUnits() {}

CompUnitSP Module::GetCompileUnitAtIndex(size_t index) {}

bool Module::ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) {}

uint32_t Module::ResolveSymbolContextForAddress(
    const Address &so_addr, lldb::SymbolContextItem resolve_scope,
    SymbolContext &sc, bool resolve_tail_call_address) {}

uint32_t Module::ResolveSymbolContextForFilePath(
    const char *file_path, uint32_t line, bool check_inlines,
    lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) {}

uint32_t Module::ResolveSymbolContextsForFileSpec(
    const FileSpec &file_spec, uint32_t line, bool check_inlines,
    lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) {}

void Module::FindGlobalVariables(ConstString name,
                                 const CompilerDeclContext &parent_decl_ctx,
                                 size_t max_matches, VariableList &variables) {}

void Module::FindGlobalVariables(const RegularExpression &regex,
                                 size_t max_matches, VariableList &variables) {}

void Module::FindCompileUnits(const FileSpec &path,
                              SymbolContextList &sc_list) {}

Module::LookupInfo::LookupInfo(ConstString name,
                               FunctionNameType name_type_mask,
                               LanguageType language)
    :{}

bool Module::LookupInfo::NameMatchesLookupInfo(
    ConstString function_name, LanguageType language_type) const {}

void Module::LookupInfo::Prune(SymbolContextList &sc_list,
                               size_t start_idx) const {}

void Module::FindFunctions(const Module::LookupInfo &lookup_info,
                           const CompilerDeclContext &parent_decl_ctx,
                           const ModuleFunctionSearchOptions &options,
                           SymbolContextList &sc_list) {}

void Module::FindFunctions(ConstString name,
                           const CompilerDeclContext &parent_decl_ctx,
                           FunctionNameType name_type_mask,
                           const ModuleFunctionSearchOptions &options,
                           SymbolContextList &sc_list) {}

void Module::FindFunctions(llvm::ArrayRef<CompilerContext> compiler_ctx,
                           FunctionNameType name_type_mask,
                           const ModuleFunctionSearchOptions &options,
                           SymbolContextList &sc_list) {}

void Module::FindFunctions(const RegularExpression &regex,
                           const ModuleFunctionSearchOptions &options,
                           SymbolContextList &sc_list) {}

void Module::FindAddressesForLine(const lldb::TargetSP target_sp,
                                  const FileSpec &file, uint32_t line,
                                  Function *function,
                                  std::vector<Address> &output_local,
                                  std::vector<Address> &output_extern) {}

void Module::FindTypes(const TypeQuery &query, TypeResults &results) {}

static Debugger::DebuggerList
DebuggersOwningModuleRequestingInterruption(Module &module) {}

SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) {}

Symtab *Module::GetSymtab() {}

void Module::SetFileSpecAndObjectName(const FileSpec &file,
                                      ConstString object_name) {}

const ArchSpec &Module::GetArchitecture() const {}

std::string Module::GetSpecificationDescription() const {}

void Module::GetDescription(llvm::raw_ostream &s,
                            lldb::DescriptionLevel level) {}

bool Module::FileHasChanged() const {}

void Module::ReportWarningOptimization(
    std::optional<lldb::user_id_t> debugger_id) {}

void Module::ReportWarningUnsupportedLanguage(
    LanguageType language, std::optional<lldb::user_id_t> debugger_id) {}

void Module::ReportErrorIfModifyDetected(
    const llvm::formatv_object_base &payload) {}

void Module::ReportError(const llvm::formatv_object_base &payload) {}

void Module::ReportWarning(const llvm::formatv_object_base &payload) {}

void Module::LogMessage(Log *log, const llvm::formatv_object_base &payload) {}

void Module::LogMessageVerboseBacktrace(
    Log *log, const llvm::formatv_object_base &payload) {}

void Module::Dump(Stream *s) {}

ConstString Module::GetObjectName() const {}

ObjectFile *Module::GetObjectFile() {}

SectionList *Module::GetSectionList() {}

void Module::SectionFileAddressesChanged() {}

UnwindTable &Module::GetUnwindTable() {}

SectionList *Module::GetUnifiedSectionList() {}

const Symbol *Module::FindFirstSymbolWithNameAndType(ConstString name,
                                                     SymbolType symbol_type) {}
void Module::SymbolIndicesToSymbolContextList(
    Symtab *symtab, std::vector<uint32_t> &symbol_indexes,
    SymbolContextList &sc_list) {}

void Module::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
                                 SymbolContextList &sc_list) {}

void Module::FindSymbolsWithNameAndType(ConstString name,
                                        SymbolType symbol_type,
                                        SymbolContextList &sc_list) {}

void Module::FindSymbolsMatchingRegExAndType(
    const RegularExpression &regex, SymbolType symbol_type,
    SymbolContextList &sc_list, Mangled::NamePreference mangling_preference) {}

void Module::PreloadSymbols() {}

void Module::SetSymbolFileFileSpec(const FileSpec &file) {}

bool Module::IsExecutable() {}

bool Module::IsLoadedInTarget(Target *target) {}

bool Module::LoadScriptingResourceInTarget(Target *target, Status &error,
                                           Stream &feedback_stream) {}

bool Module::SetArchitecture(const ArchSpec &new_arch) {}

bool Module::SetLoadAddress(Target &target, lldb::addr_t value,
                            bool value_is_offset, bool &changed) {}

bool Module::MatchesModuleSpec(const ModuleSpec &module_ref) {}

bool Module::FindSourceFile(const FileSpec &orig_spec,
                            FileSpec &new_spec) const {}

std::optional<std::string> Module::RemapSourceFile(llvm::StringRef path) const {}

void Module::RegisterXcodeSDK(llvm::StringRef sdk_name,
                              llvm::StringRef sysroot) {}

bool Module::MergeArchitecture(const ArchSpec &arch_spec) {}

llvm::VersionTuple Module::GetVersion() {}

bool Module::GetIsDynamicLinkEditor() {}

uint32_t Module::Hash() {}

std::string Module::GetCacheKey() {}

DataFileCache *Module::GetIndexCache() {}