本文整理汇总了C++中DataExtractor::SetByteOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ DataExtractor::SetByteOrder方法的具体用法?C++ DataExtractor::SetByteOrder怎么用?C++ DataExtractor::SetByteOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataExtractor
的用法示例。
在下文中一共展示了DataExtractor::SetByteOrder方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetData
uint32_t Opcode::GetData(DataExtractor &data) const {
uint32_t byte_size = GetByteSize();
uint8_t swap_buf[8];
const void *buf = nullptr;
if (byte_size > 0) {
if (!GetEndianSwap()) {
if (m_type == Opcode::eType16_2) {
// 32 bit thumb instruction, we need to sizzle this a bit
swap_buf[0] = m_data.inst.bytes[2];
swap_buf[1] = m_data.inst.bytes[3];
swap_buf[2] = m_data.inst.bytes[0];
swap_buf[3] = m_data.inst.bytes[1];
buf = swap_buf;
} else {
buf = GetOpcodeDataBytes();
}
} else {
switch (m_type) {
case Opcode::eTypeInvalid:
break;
case Opcode::eType8:
buf = GetOpcodeDataBytes();
break;
case Opcode::eType16:
*(uint16_t *)swap_buf = llvm::ByteSwap_16(m_data.inst16);
buf = swap_buf;
break;
case Opcode::eType16_2:
swap_buf[0] = m_data.inst.bytes[1];
swap_buf[1] = m_data.inst.bytes[0];
swap_buf[2] = m_data.inst.bytes[3];
swap_buf[3] = m_data.inst.bytes[2];
buf = swap_buf;
break;
case Opcode::eType32:
*(uint32_t *)swap_buf = llvm::ByteSwap_32(m_data.inst32);
buf = swap_buf;
break;
case Opcode::eType64:
*(uint32_t *)swap_buf = llvm::ByteSwap_64(m_data.inst64);
buf = swap_buf;
break;
case Opcode::eTypeBytes:
buf = GetOpcodeDataBytes();
break;
}
}
}
if (buf != nullptr) {
DataBufferSP buffer_sp;
buffer_sp.reset(new DataBufferHeap(buf, byte_size));
data.SetByteOrder(GetDataByteOrder());
data.SetData(buffer_sp);
return byte_size;
}
data.Clear();
return 0;
}
示例2: data_sp
size_t
Disassembler::ParseInstructions
(
const ExecutionContext *exe_ctx,
const AddressRange &range,
DataExtractor& data
)
{
Target *target = exe_ctx->target;
const addr_t byte_size = range.GetByteSize();
if (target == NULL || byte_size == 0 || !range.GetBaseAddress().IsValid())
return 0;
DataBufferHeap *heap_buffer = new DataBufferHeap (byte_size, '\0');
DataBufferSP data_sp(heap_buffer);
Error error;
const size_t bytes_read = target->ReadMemory (range.GetBaseAddress(), heap_buffer->GetBytes(), heap_buffer->GetByteSize(), error);
if (bytes_read > 0)
{
if (bytes_read != heap_buffer->GetByteSize())
heap_buffer->SetByteSize (bytes_read);
data.SetData(data_sp);
if (exe_ctx->process)
{
data.SetByteOrder(exe_ctx->process->GetByteOrder());
data.SetAddressByteSize(exe_ctx->process->GetAddressByteSize());
}
else
{
data.SetByteOrder(target->GetArchitecture().GetDefaultEndian());
data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
}
return DecodeInstructions (data, 0, UINT32_MAX);
}
return 0;
}
示例3: GetByteSize
uint32_t
Opcode::GetData (DataExtractor &data, lldb::AddressClass address_class) const
{
uint32_t byte_size = GetByteSize ();
DataBufferSP buffer_sp;
if (byte_size > 0)
{
switch (m_type)
{
case Opcode::eTypeInvalid:
break;
case Opcode::eType8: buffer_sp.reset (new DataBufferHeap (&m_data.inst8, byte_size)); break;
case Opcode::eType16: buffer_sp.reset (new DataBufferHeap (&m_data.inst16, byte_size)); break;
case Opcode::eType32:
{
// The only thing that uses eAddressClassCodeAlternateISA currently
// is Thumb. If this ever changes, we will need to pass in more
// information like an additional "const ArchSpec &arch". For now
// this will do
if (address_class == eAddressClassCodeAlternateISA)
{
// 32 bit thumb instruction, we need to sizzle this a bit
uint8_t buf[4];
buf[0] = m_data.inst.bytes[2];
buf[1] = m_data.inst.bytes[3];
buf[2] = m_data.inst.bytes[0];
buf[3] = m_data.inst.bytes[1];
buffer_sp.reset (new DataBufferHeap (buf, byte_size));
break;
}
buffer_sp.reset (new DataBufferHeap (&m_data.inst32, byte_size));
}
break;
case Opcode::eType64: buffer_sp.reset (new DataBufferHeap (&m_data.inst64, byte_size)); break;
case Opcode::eTypeBytes:buffer_sp.reset (new DataBufferHeap (GetOpcodeBytes(), byte_size)); break;
break;
}
}
if (buffer_sp)
{
data.SetByteOrder(GetDataByteOrder());
data.SetData (buffer_sp);
return byte_size;
}
data.Clear();
return 0;
}
示例4: if
size_t
ObjectFilePECOFF::GetModuleSpecifications (const lldb_private::FileSpec& file,
lldb::DataBufferSP& data_sp,
lldb::offset_t data_offset,
lldb::offset_t file_offset,
lldb::offset_t length,
lldb_private::ModuleSpecList &specs)
{
const size_t initial_count = specs.GetSize();
if (ObjectFilePECOFF::MagicBytesMatch(data_sp))
{
DataExtractor data;
data.SetData(data_sp, data_offset, length);
data.SetByteOrder(eByteOrderLittle);
dos_header_t dos_header;
coff_header_t coff_header;
if (ParseDOSHeader(data, dos_header))
{
lldb::offset_t offset = dos_header.e_lfanew;
uint32_t pe_signature = data.GetU32(&offset);
if (pe_signature != IMAGE_NT_SIGNATURE)
return false;
if (ParseCOFFHeader(data, &offset, coff_header))
{
ArchSpec spec;
if (coff_header.machine == MachineAmd64)
{
spec.SetTriple("x86_64-pc-windows");
specs.Append(ModuleSpec(file, spec));
}
else if (coff_header.machine == MachineX86)
{
spec.SetTriple("i386-pc-windows");
specs.Append(ModuleSpec(file, spec));
spec.SetTriple("i686-pc-windows");
specs.Append(ModuleSpec(file, spec));
}
}
}
}
return specs.GetSize() - initial_count;
}
示例5: section_data_sp
size_t
Section::MemoryMapSectionDataFromObjectFile(const ObjectFile* objfile, DataExtractor& section_data) const
{
if (objfile == NULL)
return 0;
const FileSpec& file = objfile->GetFileSpec();
if (file)
{
size_t section_file_size = GetFileSize();
if (section_file_size > 0)
{
off_t section_file_offset = GetFileOffset() + objfile->GetOffset();
DataBufferSP section_data_sp(file.MemoryMapFileContents(section_file_offset, section_file_size));
section_data.SetByteOrder(objfile->GetByteOrder());
section_data.SetAddressByteSize(objfile->GetAddressByteSize());
return section_data.SetData (section_data_sp);
}
}
return 0;
}
示例6: if
Error
Value::GetValueAsData (ExecutionContext *exe_ctx,
DataExtractor &data,
uint32_t data_offset,
Module *module)
{
data.Clear();
Error error;
lldb::addr_t address = LLDB_INVALID_ADDRESS;
AddressType address_type = eAddressTypeFile;
Address file_so_addr;
const CompilerType &ast_type = GetCompilerType();
switch (m_value_type)
{
case eValueTypeVector:
if (ast_type.IsValid())
data.SetAddressByteSize (ast_type.GetPointerByteSize());
else
data.SetAddressByteSize(sizeof(void *));
data.SetData(m_vector.bytes, m_vector.length, m_vector.byte_order);
break;
case eValueTypeScalar:
{
data.SetByteOrder (endian::InlHostByteOrder());
if (ast_type.IsValid())
data.SetAddressByteSize (ast_type.GetPointerByteSize());
else
data.SetAddressByteSize(sizeof(void *));
uint32_t limit_byte_size = UINT32_MAX;
if (ast_type.IsValid() && ast_type.IsScalarType())
{
uint64_t type_encoding_count = 0;
lldb::Encoding type_encoding = ast_type.GetEncoding(type_encoding_count);
if (type_encoding == eEncodingUint || type_encoding == eEncodingSint)
limit_byte_size = ast_type.GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
}
if (m_value.GetData (data, limit_byte_size))
return error; // Success;
error.SetErrorStringWithFormat("extracting data from value failed");
break;
}
case eValueTypeLoadAddress:
if (exe_ctx == NULL)
{
error.SetErrorString ("can't read load address (no execution context)");
}
else
{
Process *process = exe_ctx->GetProcessPtr();
if (process == NULL || !process->IsAlive())
{
Target *target = exe_ctx->GetTargetPtr();
if (target)
{
// Allow expressions to run and evaluate things when the target
// has memory sections loaded. This allows you to use "target modules load"
// to load your executable and any shared libraries, then execute
// commands where you can look at types in data sections.
const SectionLoadList &target_sections = target->GetSectionLoadList();
if (!target_sections.IsEmpty())
{
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
if (target_sections.ResolveLoadAddress(address, file_so_addr))
{
address_type = eAddressTypeLoad;
data.SetByteOrder(target->GetArchitecture().GetByteOrder());
data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
}
else
address = LLDB_INVALID_ADDRESS;
}
// else
// {
// ModuleSP exe_module_sp (target->GetExecutableModule());
// if (exe_module_sp)
// {
// address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
// if (address != LLDB_INVALID_ADDRESS)
// {
// if (exe_module_sp->ResolveFileAddress(address, file_so_addr))
// {
// data.SetByteOrder(target->GetArchitecture().GetByteOrder());
// data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
// address_type = eAddressTypeFile;
// }
// else
// {
// address = LLDB_INVALID_ADDRESS;
// }
// }
// }
// }
}
//.........这里部分代码省略.........
示例7: if
static bool
SkinnyMachOFileContainsArchAndUUID
(
const FileSpec &file_spec,
const ArchSpec *arch,
const lldb_private::UUID *uuid, // the UUID we are looking for
off_t file_offset,
DataExtractor& data,
uint32_t data_offset,
const uint32_t magic
)
{
assert(magic == HeaderMagic32 || magic == HeaderMagic32Swapped || magic == HeaderMagic64 || magic == HeaderMagic64Swapped);
if (magic == HeaderMagic32 || magic == HeaderMagic64)
data.SetByteOrder (lldb::endian::InlHostByteOrder());
else if (lldb::endian::InlHostByteOrder() == eByteOrderBig)
data.SetByteOrder (eByteOrderLittle);
else
data.SetByteOrder (eByteOrderBig);
uint32_t i;
const uint32_t cputype = data.GetU32(&data_offset); // cpu specifier
const uint32_t cpusubtype = data.GetU32(&data_offset); // machine specifier
data_offset+=4; // Skip mach file type
const uint32_t ncmds = data.GetU32(&data_offset); // number of load commands
const uint32_t sizeofcmds = data.GetU32(&data_offset); // the size of all the load commands
data_offset+=4; // Skip flags
// Check the architecture if we have a valid arch pointer
if (arch)
{
ArchSpec file_arch(eArchTypeMachO, cputype, cpusubtype);
if (file_arch != *arch)
return false;
}
// The file exists, and if a valid arch pointer was passed in we know
// if already matches, so we can return if we aren't looking for a specific
// UUID
if (uuid == NULL)
return true;
if (magic == HeaderMagic64Swapped || magic == HeaderMagic64)
data_offset += 4; // Skip reserved field for in mach_header_64
// Make sure we have enough data for all the load commands
if (magic == HeaderMagic64Swapped || magic == HeaderMagic64)
{
if (data.GetByteSize() < sizeof(struct mach_header_64) + sizeofcmds)
{
DataBufferSP data_buffer_sp (file_spec.ReadFileContents (file_offset, sizeof(struct mach_header_64) + sizeofcmds));
data.SetData (data_buffer_sp);
}
}
else
{
if (data.GetByteSize() < sizeof(struct mach_header) + sizeofcmds)
{
DataBufferSP data_buffer_sp (file_spec.ReadFileContents (file_offset, sizeof(struct mach_header) + sizeofcmds));
data.SetData (data_buffer_sp);
}
}
for (i=0; i<ncmds; i++)
{
const uint32_t cmd_offset = data_offset; // Save this data_offset in case parsing of the segment goes awry!
uint32_t cmd = data.GetU32(&data_offset);
uint32_t cmd_size = data.GetU32(&data_offset);
if (cmd == LoadCommandUUID)
{
lldb_private::UUID file_uuid (data.GetData(&data_offset, 16), 16);
if (file_uuid == *uuid)
return true;
// Emit some warning messages since the UUIDs do not match!
char path_buf[PATH_MAX];
path_buf[0] = '\0';
const char *path = file_spec.GetPath(path_buf, PATH_MAX) ? path_buf
: file_spec.GetFilename().AsCString();
Host::SystemLog (Host::eSystemLogWarning,
"warning: UUID mismatch detected between binary and:\n\t'%s'\n",
path);
return false;
}
data_offset = cmd_offset + cmd_size;
}
return false;
}
示例8: data_buffer_sp
bool
UniversalMachOFileContainsArchAndUUID
(
const FileSpec &file_spec,
const ArchSpec *arch,
const lldb_private::UUID *uuid,
off_t file_offset,
DataExtractor& data,
uint32_t data_offset,
const uint32_t magic
)
{
assert(magic == UniversalMagic || magic == UniversalMagicSwapped);
// Universal mach-o files always have their headers encoded as BIG endian
data.SetByteOrder(eByteOrderBig);
uint32_t i;
const uint32_t nfat_arch = data.GetU32(&data_offset); // number of structs that follow
const uint32_t fat_header_and_arch_size = sizeof(struct fat_header) + nfat_arch * sizeof(struct fat_arch);
if (data.GetByteSize() < fat_header_and_arch_size)
{
DataBufferSP data_buffer_sp (file_spec.ReadFileContents (file_offset, fat_header_and_arch_size));
data.SetData (data_buffer_sp);
}
for (i=0; i<nfat_arch; i++)
{
cpu_type_t arch_cputype = data.GetU32(&data_offset); // cpu specifier (int)
cpu_subtype_t arch_cpusubtype = data.GetU32(&data_offset); // machine specifier (int)
uint32_t arch_offset = data.GetU32(&data_offset); // file offset to this object file
// uint32_t arch_size = data.GetU32(&data_offset); // size of this object file
// uint32_t arch_align = data.GetU32(&data_offset); // alignment as a power of 2
data_offset += 8; // Skip size and align as we don't need those
// Only process this slice if the cpu type/subtype matches
if (arch)
{
ArchSpec fat_arch(eArchTypeMachO, arch_cputype, arch_cpusubtype);
if (fat_arch != *arch)
continue;
}
// Create a buffer with only the arch slice date in it
DataExtractor arch_data;
DataBufferSP data_buffer_sp (file_spec.ReadFileContents (file_offset + arch_offset, 0x1000));
arch_data.SetData(data_buffer_sp);
uint32_t arch_data_offset = 0;
uint32_t arch_magic = arch_data.GetU32(&arch_data_offset);
switch (arch_magic)
{
case HeaderMagic32:
case HeaderMagic32Swapped:
case HeaderMagic64:
case HeaderMagic64Swapped:
if (SkinnyMachOFileContainsArchAndUUID (file_spec, arch, uuid, file_offset + arch_offset, arch_data, arch_data_offset, arch_magic))
return true;
break;
}
}
return false;
}
示例9: if
static bool
SkinnyMachOFileContainsArchAndUUID
(
const FileSpec &file_spec,
const ArchSpec *arch,
const lldb_private::UUID *uuid, // the UUID we are looking for
off_t file_offset,
DataExtractor& data,
lldb::offset_t data_offset,
const uint32_t magic
)
{
assert(magic == HeaderMagic32 || magic == HeaderMagic32Swapped || magic == HeaderMagic64 || magic == HeaderMagic64Swapped);
if (magic == HeaderMagic32 || magic == HeaderMagic64)
data.SetByteOrder (lldb::endian::InlHostByteOrder());
else if (lldb::endian::InlHostByteOrder() == eByteOrderBig)
data.SetByteOrder (eByteOrderLittle);
else
data.SetByteOrder (eByteOrderBig);
uint32_t i;
const uint32_t cputype = data.GetU32(&data_offset); // cpu specifier
const uint32_t cpusubtype = data.GetU32(&data_offset); // machine specifier
data_offset+=4; // Skip mach file type
const uint32_t ncmds = data.GetU32(&data_offset); // number of load commands
const uint32_t sizeofcmds = data.GetU32(&data_offset); // the size of all the load commands
data_offset+=4; // Skip flags
// Check the architecture if we have a valid arch pointer
if (arch)
{
ArchSpec file_arch(eArchTypeMachO, cputype, cpusubtype);
if (!file_arch.IsCompatibleMatch(*arch))
return false;
}
// The file exists, and if a valid arch pointer was passed in we know
// if already matches, so we can return if we aren't looking for a specific
// UUID
if (uuid == NULL)
return true;
if (magic == HeaderMagic64Swapped || magic == HeaderMagic64)
data_offset += 4; // Skip reserved field for in mach_header_64
// Make sure we have enough data for all the load commands
if (magic == HeaderMagic64Swapped || magic == HeaderMagic64)
{
if (data.GetByteSize() < sizeof(struct mach_header_64) + sizeofcmds)
{
DataBufferSP data_buffer_sp (file_spec.ReadFileContents (file_offset, sizeof(struct mach_header_64) + sizeofcmds));
data.SetData (data_buffer_sp);
}
}
else
{
if (data.GetByteSize() < sizeof(struct mach_header) + sizeofcmds)
{
DataBufferSP data_buffer_sp (file_spec.ReadFileContents (file_offset, sizeof(struct mach_header) + sizeofcmds));
data.SetData (data_buffer_sp);
}
}
for (i=0; i<ncmds; i++)
{
const lldb::offset_t cmd_offset = data_offset; // Save this data_offset in case parsing of the segment goes awry!
uint32_t cmd = data.GetU32(&data_offset);
uint32_t cmd_size = data.GetU32(&data_offset);
if (cmd == LoadCommandUUID)
{
lldb_private::UUID file_uuid (data.GetData(&data_offset, 16), 16);
if (file_uuid == *uuid)
return true;
return false;
}
data_offset = cmd_offset + cmd_size;
}
return false;
}
示例10: if
Error
Value::GetValueAsData (ExecutionContext *exe_ctx,
clang::ASTContext *ast_context,
DataExtractor &data,
uint32_t data_offset,
Module *module)
{
data.Clear();
Error error;
lldb::addr_t address = LLDB_INVALID_ADDRESS;
AddressType address_type = eAddressTypeFile;
Address file_so_addr;
switch (m_value_type)
{
default:
error.SetErrorStringWithFormat("invalid value type %i", m_value_type);
break;
case eValueTypeScalar:
data.SetByteOrder (lldb::endian::InlHostByteOrder());
if (m_context_type == eContextTypeClangType && ast_context)
{
uint32_t ptr_bit_width = ClangASTType::GetClangTypeBitWidth (ast_context,
ClangASTContext::GetVoidPtrType(ast_context, false));
uint32_t ptr_byte_size = (ptr_bit_width + 7) / 8;
data.SetAddressByteSize (ptr_byte_size);
}
else
data.SetAddressByteSize(sizeof(void *));
if (m_value.GetData (data))
return error; // Success;
error.SetErrorStringWithFormat("extracting data from value failed");
break;
case eValueTypeLoadAddress:
if (exe_ctx == NULL)
{
error.SetErrorString ("can't read load address (no execution context)");
}
else
{
Process *process = exe_ctx->GetProcessPtr();
if (process == NULL)
{
error.SetErrorString ("can't read load address (invalid process)");
}
else
{
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
address_type = eAddressTypeLoad;
data.SetByteOrder(process->GetTarget().GetArchitecture().GetByteOrder());
data.SetAddressByteSize(process->GetTarget().GetArchitecture().GetAddressByteSize());
}
}
break;
case eValueTypeFileAddress:
if (exe_ctx == NULL)
{
error.SetErrorString ("can't read file address (no execution context)");
}
else if (exe_ctx->GetTargetPtr() == NULL)
{
error.SetErrorString ("can't read file address (invalid target)");
}
else
{
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
if (address == LLDB_INVALID_ADDRESS)
{
error.SetErrorString ("invalid file address");
}
else
{
if (module == NULL)
{
// The only thing we can currently lock down to a module so that
// we can resolve a file address, is a variable.
Variable *variable = GetVariable();
if (variable)
{
SymbolContext var_sc;
variable->CalculateSymbolContext(&var_sc);
module = var_sc.module_sp.get();
}
}
if (module)
{
bool resolved = false;
ObjectFile *objfile = module->GetObjectFile();
if (objfile)
{
Address so_addr(address, objfile->GetSectionList());
addr_t load_address = so_addr.GetLoadAddress (exe_ctx->GetTargetPtr());
bool process_launched_and_stopped = exe_ctx->GetProcessPtr()
? StateIsStoppedState(exe_ctx->GetProcessPtr()->GetState(), true /* must_exist */)
: false;
// Don't use the load address if the process has exited.
//.........这里部分代码省略.........
示例11: data
bool
DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure ()
{
std::lock_guard<std::recursive_mutex> guard(m_mutex);
// the all image infos is already valid for this process stop ID
if (m_process->GetStopID() == m_dyld_all_image_infos_stop_id)
return true;
m_dyld_all_image_infos.Clear();
if (m_dyld_all_image_infos_addr != LLDB_INVALID_ADDRESS)
{
ByteOrder byte_order = m_process->GetTarget().GetArchitecture().GetByteOrder();
uint32_t addr_size = 4;
if (m_dyld_all_image_infos_addr > UINT32_MAX)
addr_size = 8;
uint8_t buf[256];
DataExtractor data (buf, sizeof(buf), byte_order, addr_size);
lldb::offset_t offset = 0;
const size_t count_v2 = sizeof (uint32_t) + // version
sizeof (uint32_t) + // infoArrayCount
addr_size + // infoArray
addr_size + // notification
addr_size + // processDetachedFromSharedRegion + libSystemInitialized + pad
addr_size; // dyldImageLoadAddress
const size_t count_v11 = count_v2 +
addr_size + // jitInfo
addr_size + // dyldVersion
addr_size + // errorMessage
addr_size + // terminationFlags
addr_size + // coreSymbolicationShmPage
addr_size + // systemOrderFlag
addr_size + // uuidArrayCount
addr_size + // uuidArray
addr_size + // dyldAllImageInfosAddress
addr_size + // initialImageCount
addr_size + // errorKind
addr_size + // errorClientOfDylibPath
addr_size + // errorTargetDylibPath
addr_size; // errorSymbol
const size_t count_v13 = count_v11 +
addr_size + // sharedCacheSlide
sizeof (uuid_t); // sharedCacheUUID
UNUSED_IF_ASSERT_DISABLED(count_v13);
assert (sizeof (buf) >= count_v13);
Error error;
if (m_process->ReadMemory (m_dyld_all_image_infos_addr, buf, 4, error) == 4)
{
m_dyld_all_image_infos.version = data.GetU32(&offset);
// If anything in the high byte is set, we probably got the byte
// order incorrect (the process might not have it set correctly
// yet due to attaching to a program without a specified file).
if (m_dyld_all_image_infos.version & 0xff000000)
{
// We have guessed the wrong byte order. Swap it and try
// reading the version again.
if (byte_order == eByteOrderLittle)
byte_order = eByteOrderBig;
else
byte_order = eByteOrderLittle;
data.SetByteOrder (byte_order);
offset = 0;
m_dyld_all_image_infos.version = data.GetU32(&offset);
}
}
else
{
return false;
}
const size_t count = (m_dyld_all_image_infos.version >= 11) ? count_v11 : count_v2;
const size_t bytes_read = m_process->ReadMemory (m_dyld_all_image_infos_addr, buf, count, error);
if (bytes_read == count)
{
offset = 0;
m_dyld_all_image_infos.version = data.GetU32(&offset);
m_dyld_all_image_infos.dylib_info_count = data.GetU32(&offset);
m_dyld_all_image_infos.dylib_info_addr = data.GetPointer(&offset);
m_dyld_all_image_infos.notification = data.GetPointer(&offset);
m_dyld_all_image_infos.processDetachedFromSharedRegion = data.GetU8(&offset);
m_dyld_all_image_infos.libSystemInitialized = data.GetU8(&offset);
// Adjust for padding.
offset += addr_size - 2;
m_dyld_all_image_infos.dyldImageLoadAddress = data.GetPointer(&offset);
if (m_dyld_all_image_infos.version >= 11)
{
offset += addr_size * 8;
uint64_t dyld_all_image_infos_addr = data.GetPointer(&offset);
// When we started, we were given the actual address of the all_image_infos
// struct (probably via TASK_DYLD_INFO) in memory - this address is stored in
// m_dyld_all_image_infos_addr and is the most accurate address we have.
// We read the dyld_all_image_infos struct from memory; it contains its own address.
// If the address in the struct does not match the actual address,
//.........这里部分代码省略.........