LLDB mainline
Classes | Macros | Typedefs | Enumerations | Functions | Variables
ObjectFileMachO.cpp File Reference
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringRef.h"
#include "Plugins/Process/Utility/RegisterContextDarwin_arm.h"
#include "Plugins/Process/Utility/RegisterContextDarwin_arm64.h"
#include "Plugins/Process/Utility/RegisterContextDarwin_i386.h"
#include "Plugins/Process/Utility/RegisterContextDarwin_x86_64.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Progress.h"
#include "lldb/Core/Section.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadList.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/FileSpecList.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#include "lldb/Host/SafeMachO.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "ObjectFileMachO.h"
#include "lldb/Utility/AppleUuidCompatibility.h"
#include <bitset>
#include <memory>
#include <optional>

Go to the source code of this file.

Classes

class  RegisterContextDarwin_x86_64_Mach
 
class  RegisterContextDarwin_i386_Mach
 
class  RegisterContextDarwin_arm_Mach
 
class  RegisterContextDarwin_arm64_Mach
 
struct  ObjectFileMachO::SegmentParsingContext
 
class  MachSymtabSectionInfo
 
struct  MachSymtabSectionInfo::SectionInfo
 
struct  TrieEntry
 
struct  TrieEntryWithOffset
 
struct  lldb_copy__dyld_process_cache_info
 
struct  all_image_infos_header
 
struct  image_entry
 
struct  segment_vmaddr
 
struct  page_object
 

Macros

#define THUMB_ADDRESS_BIT_MASK   0xfffffffffffffffeull
 
#define MACHO_NLIST_ARM_SYMBOL_IS_THUMB   0x0008
 
#define TRIE_SYMBOL_IS_THUMB   (1ULL << 63)
 

Typedefs

typedef void * dyld_process_info
 

Enumerations

enum  { DebugSymbols = true , NonDebugSymbols = false }
 

Functions

static void PrintRegisterValue (RegisterContext *reg_ctx, const char *name, const char *alt_name, size_t reg_byte_size, Stream &data)
 
static uint32_t MachHeaderSizeFromMagic (uint32_t magic)
 
static uint32_t GetSegmentPermissions (const llvm::MachO::segment_command_64 &seg_cmd)
 
static lldb::SectionType GetSectionType (uint32_t flags, ConstString section_name)
 
static bool ParseTrieEntries (DataExtractor &data, lldb::offset_t offset, const bool is_arm, addr_t text_seg_base_addr, std::vector< llvm::StringRef > &nameSlices, std::set< lldb::addr_t > &resolver_addresses, std::vector< TrieEntryWithOffset > &reexports, std::vector< TrieEntryWithOffset > &ext_symbols)
 
static SymbolType GetSymbolType (const char *&symbol_name, bool &demangled_is_synthesized, const SectionSP &text_section_sp, const SectionSP &data_section_sp, const SectionSP &data_dirty_section_sp, const SectionSP &data_const_section_sp, const SectionSP &symbol_section)
 
static std::optional< struct nlist_64 > ParseNList (DataExtractor &nlist_data, lldb::offset_t &nlist_data_offset, size_t nlist_byte_size)
 
static llvm::StringRef GetOSName (uint32_t cmd)
 
unsigned int mach_task_self ()
 
static llvm::VersionTuple FindMinimumVersionInfo (DataExtractor &data, lldb::offset_t offset, size_t ncmds)
 
static offset_t CreateAllImageInfosPayload (const lldb::ProcessSP &process_sp, offset_t initial_file_offset, StreamString &all_image_infos_payload, lldb_private::SaveCoreOptions &options)
 

Variables

static constexpr llvm::StringLiteral g_loader_path = "@loader_path"
 
static constexpr llvm::StringLiteral g_executable_path = "@executable_path"
 

Macro Definition Documentation

◆ MACHO_NLIST_ARM_SYMBOL_IS_THUMB

#define MACHO_NLIST_ARM_SYMBOL_IS_THUMB   0x0008

Definition at line 789 of file ObjectFileMachO.cpp.

◆ THUMB_ADDRESS_BIT_MASK

#define THUMB_ADDRESS_BIT_MASK   0xfffffffffffffffeull

Definition at line 135 of file ObjectFileMachO.cpp.

◆ TRIE_SYMBOL_IS_THUMB

#define TRIE_SYMBOL_IS_THUMB   (1ULL << 63)

Definition at line 2018 of file ObjectFileMachO.cpp.

Typedef Documentation

◆ dyld_process_info

typedef void* dyld_process_info

Definition at line 5959 of file ObjectFileMachO.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DebugSymbols 
NonDebugSymbols 

Definition at line 2223 of file ObjectFileMachO.cpp.

Function Documentation

◆ CreateAllImageInfosPayload()

static offset_t CreateAllImageInfosPayload ( const lldb::ProcessSP process_sp,
offset_t  initial_file_offset,
StreamString all_image_infos_payload,
lldb_private::SaveCoreOptions options 
)
static

◆ FindMinimumVersionInfo()

static llvm::VersionTuple FindMinimumVersionInfo ( DataExtractor data,
lldb::offset_t  offset,
size_t  ncmds 
)
static

◆ GetOSName()

static llvm::StringRef GetOSName ( uint32_t  cmd)
static

Definition at line 4867 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::GetAllArchSpecs().

◆ GetSectionType()

static lldb::SectionType GetSectionType ( uint32_t  flags,
ConstString  section_name 
)
static

Definition at line 1433 of file ObjectFileMachO.cpp.

References lldb::eSectionTypeCode, lldb::eSectionTypeCompactUnwind, lldb::eSectionTypeCTF, lldb::eSectionTypeData, lldb::eSectionTypeData16, lldb::eSectionTypeData4, lldb::eSectionTypeData8, lldb::eSectionTypeDataCString, lldb::eSectionTypeDataCStringPointers, lldb::eSectionTypeDataObjCCFStrings, lldb::eSectionTypeDataObjCMessageRefs, lldb::eSectionTypeDataPointers, lldb::eSectionTypeDebug, lldb::eSectionTypeDWARFAppleNames, lldb::eSectionTypeDWARFAppleNamespaces, lldb::eSectionTypeDWARFAppleObjC, lldb::eSectionTypeDWARFAppleTypes, lldb::eSectionTypeDWARFDebugAbbrev, lldb::eSectionTypeDWARFDebugAbbrevDwo, lldb::eSectionTypeDWARFDebugAddr, lldb::eSectionTypeDWARFDebugAranges, lldb::eSectionTypeDWARFDebugCuIndex, lldb::eSectionTypeDWARFDebugFrame, lldb::eSectionTypeDWARFDebugInfo, lldb::eSectionTypeDWARFDebugInfoDwo, lldb::eSectionTypeDWARFDebugLine, lldb::eSectionTypeDWARFDebugLineStr, lldb::eSectionTypeDWARFDebugLoc, lldb::eSectionTypeDWARFDebugLocLists, lldb::eSectionTypeDWARFDebugLocListsDwo, lldb::eSectionTypeDWARFDebugMacInfo, lldb::eSectionTypeDWARFDebugMacro, lldb::eSectionTypeDWARFDebugNames, lldb::eSectionTypeDWARFDebugPubNames, lldb::eSectionTypeDWARFDebugPubTypes, lldb::eSectionTypeDWARFDebugRanges, lldb::eSectionTypeDWARFDebugRngLists, lldb::eSectionTypeDWARFDebugStr, lldb::eSectionTypeDWARFDebugStrDwo, lldb::eSectionTypeDWARFDebugStrOffsets, lldb::eSectionTypeDWARFDebugStrOffsetsDwo, lldb::eSectionTypeDWARFDebugTuIndex, lldb::eSectionTypeDWARFDebugTypes, lldb::eSectionTypeEHFrame, lldb::eSectionTypeGoSymtab, lldb::eSectionTypeOther, lldb::eSectionTypeSwiftModules, and lldb::eSectionTypeZeroFill.

Referenced by ObjectFileMachO::ProcessSegmentCommand().

◆ GetSegmentPermissions()

static uint32_t GetSegmentPermissions ( const llvm::MachO::segment_command_64 &  seg_cmd)
static

Definition at line 1422 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::ProcessSegmentCommand().

◆ GetSymbolType()

static SymbolType GetSymbolType ( const char *&  symbol_name,
bool &  demangled_is_synthesized,
const SectionSP text_section_sp,
const SectionSP data_section_sp,
const SectionSP data_dirty_section_sp,
const SectionSP data_const_section_sp,
const SectionSP symbol_section 
)
static

◆ mach_task_self()

unsigned int mach_task_self ( )

◆ MachHeaderSizeFromMagic()

static uint32_t MachHeaderSizeFromMagic ( uint32_t  magic)
static

Definition at line 772 of file ObjectFileMachO.cpp.

◆ ParseNList()

static std::optional< struct nlist_64 > ParseNList ( DataExtractor nlist_data,
lldb::offset_t nlist_data_offset,
size_t  nlist_byte_size 
)
static

◆ ParseTrieEntries()

static bool ParseTrieEntries ( DataExtractor data,
lldb::offset_t  offset,
const bool  is_arm,
addr_t  text_seg_base_addr,
std::vector< llvm::StringRef > &  nameSlices,
std::set< lldb::addr_t > &  resolver_addresses,
std::vector< TrieEntryWithOffset > &  reexports,
std::vector< TrieEntryWithOffset > &  ext_symbols 
)
static

◆ PrintRegisterValue()

static void PrintRegisterValue ( RegisterContext reg_ctx,
const char *  name,
const char *  alt_name,
size_t  reg_byte_size,
Stream data 
)
static

Variable Documentation

◆ g_executable_path

constexpr llvm::StringLiteral g_executable_path = "@executable_path"
staticconstexpr

Definition at line 141 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::GetDependentModules().

◆ g_loader_path

constexpr llvm::StringLiteral g_loader_path = "@loader_path"
staticconstexpr

Definition at line 140 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::GetDependentModules().