#include "SymbolFileCTF.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/Config.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/Symtab.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StreamBuffer.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
#include "llvm/Support/MemoryBuffer.h"
#include "Plugins/ExpressionParser/Clang/ClangASTMetadata.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include <memory>
#include <optional>
#if LLVM_ENABLE_ZLIB
#include <zlib.h>
#endif
usingnamespacellvm;
usingnamespacelldb;
usingnamespacelldb_private;
LLDB_PLUGIN_DEFINE(…)
char SymbolFileCTF::ID;
SymbolFileCTF::SymbolFileCTF(lldb::ObjectFileSP objfile_sp)
: … { … }
void SymbolFileCTF::Initialize() { … }
void SymbolFileCTF::Terminate() { … }
llvm::StringRef SymbolFileCTF::GetPluginDescriptionStatic() { … }
SymbolFile *SymbolFileCTF::CreateInstance(ObjectFileSP objfile_sp) { … }
bool SymbolFileCTF::ParseHeader() { … }
void SymbolFileCTF::InitializeObject() { … }
llvm::StringRef SymbolFileCTF::ReadString(lldb::offset_t str_offset) const { … }
static uint32_t GetEncoding(uint32_t data) { … }
static uint32_t GetBits(uint32_t data) { … }
uint32_t GetKind(uint32_t data) { … }
uint32_t GetVLen(uint32_t data) { … }
static uint32_t GetBytes(uint32_t bits) { … }
static clang::TagTypeKind TranslateRecordKind(CTFType::Kind type) { … }
llvm::Expected<TypeSP>
SymbolFileCTF::CreateInteger(const CTFInteger &ctf_integer) { … }
llvm::Expected<lldb::TypeSP>
SymbolFileCTF::CreateModifier(const CTFModifier &ctf_modifier) { … }
llvm::Expected<lldb::TypeSP>
SymbolFileCTF::CreateTypedef(const CTFTypedef &ctf_typedef) { … }
llvm::Expected<lldb::TypeSP>
SymbolFileCTF::CreateArray(const CTFArray &ctf_array) { … }
llvm::Expected<lldb::TypeSP>
SymbolFileCTF::CreateEnum(const CTFEnum &ctf_enum) { … }
llvm::Expected<lldb::TypeSP>
SymbolFileCTF::CreateFunction(const CTFFunction &ctf_function) { … }
llvm::Expected<lldb::TypeSP>
SymbolFileCTF::CreateRecord(const CTFRecord &ctf_record) { … }
bool SymbolFileCTF::CompleteType(CompilerType &compiler_type) { … }
llvm::Expected<lldb::TypeSP>
SymbolFileCTF::CreateForward(const CTFForward &ctf_forward) { … }
llvm::Expected<TypeSP> SymbolFileCTF::CreateType(CTFType *ctf_type) { … }
llvm::Expected<std::unique_ptr<CTFType>>
SymbolFileCTF::ParseType(lldb::offset_t &offset, lldb::user_id_t uid) { … }
size_t SymbolFileCTF::ParseTypes(CompileUnit &cu) { … }
size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) { … }
static DWARFExpression CreateDWARFExpression(ModuleSP module_sp,
const Symbol &symbol) { … }
size_t SymbolFileCTF::ParseObjects(CompileUnit &comp_unit) { … }
uint32_t SymbolFileCTF::CalculateAbilities() { … }
uint32_t SymbolFileCTF::ResolveSymbolContext(const Address &so_addr,
SymbolContextItem resolve_scope,
SymbolContext &sc) { … }
CompUnitSP SymbolFileCTF::ParseCompileUnitAtIndex(uint32_t idx) { … }
size_t
SymbolFileCTF::ParseVariablesForContext(const lldb_private::SymbolContext &sc) { … }
void SymbolFileCTF::AddSymbols(Symtab &symtab) { … }
lldb_private::Type *SymbolFileCTF::ResolveTypeUID(lldb::user_id_t type_uid) { … }
void SymbolFileCTF::FindTypes(const lldb_private::TypeQuery &match,
lldb_private::TypeResults &results) { … }
void SymbolFileCTF::FindTypesByRegex(
const lldb_private::RegularExpression ®ex, uint32_t max_matches,
lldb_private::TypeMap &types) { … }
void SymbolFileCTF::FindFunctions(
const lldb_private::Module::LookupInfo &lookup_info,
const lldb_private::CompilerDeclContext &parent_decl_ctx,
bool include_inlines, lldb_private::SymbolContextList &sc_list) { … }
void SymbolFileCTF::FindFunctions(const lldb_private::RegularExpression ®ex,
bool include_inlines,
lldb_private::SymbolContextList &sc_list) { … }
void SymbolFileCTF::FindGlobalVariables(
lldb_private::ConstString name,
const lldb_private::CompilerDeclContext &parent_decl_ctx,
uint32_t max_matches, lldb_private::VariableList &variables) { … }
void SymbolFileCTF::FindGlobalVariables(
const lldb_private::RegularExpression ®ex, uint32_t max_matches,
lldb_private::VariableList &variables) { … }