LLDB mainline
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_riscv32.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_arm_Mach
class  RegisterContextDarwin_arm64_Mach
class  RegisterContextDarwin_riscv32_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

◆ THUMB_ADDRESS_BIT_MASK

#define THUMB_ADDRESS_BIT_MASK   0xfffffffffffffffeull

Definition at line 132 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::ParseSymtab(), and ParseTrieEntries().

◆ TRIE_SYMBOL_IS_THUMB

#define TRIE_SYMBOL_IS_THUMB   (1ULL << 63)

Definition at line 1939 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::ParseSymtab(), and ParseTrieEntries().

Typedef Documentation

◆ dyld_process_info

typedef void* dyld_process_info

Definition at line 5793 of file ObjectFileMachO.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DebugSymbols 
NonDebugSymbols 

Definition at line 2144 of file ObjectFileMachO.cpp.

Function Documentation

◆ CreateAllImageInfosPayload()

◆ FindMinimumVersionInfo()

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

◆ GetOSName()

llvm::StringRef GetOSName ( uint32_t cmd)
static

Definition at line 4678 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::GetAllArchSpecs().

◆ GetSectionType()

◆ GetSegmentPermissions()

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

Definition at line 1410 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::ProcessSegmentCommand().

◆ GetSymbolType()

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()

uint32_t MachHeaderSizeFromMagic ( uint32_t magic)
static

Definition at line 752 of file ObjectFileMachO.cpp.

◆ ParseNList()

◆ ParseTrieEntries()

◆ PrintRegisterValue()

Variable Documentation

◆ g_executable_path

llvm::StringLiteral g_executable_path = "@executable_path"
staticconstexpr

Definition at line 138 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::GetDependentModules().

◆ g_loader_path

llvm::StringLiteral g_loader_path = "@loader_path"
staticconstexpr

Definition at line 137 of file ObjectFileMachO.cpp.

Referenced by ObjectFileMachO::GetDependentModules().