Error ELFLinuxPrPsInfo::Parse(DataExtractor &data, ArchSpec &arch) { Error error; ByteOrder byteorder = data.GetByteOrder(); if (GetSize(arch) > data.GetByteSize()) { error.SetErrorStringWithFormat("NT_PRPSINFO size should be %lu, but the remaining bytes are: %lu", GetSize(arch), data.GetByteSize()); return error; } switch(arch.GetCore()) { case ArchSpec::eCore_s390x_generic: case ArchSpec::eCore_x86_64_x86_64: data.ExtractBytes(0, sizeof(ELFLinuxPrPsInfo), byteorder, this); break; case ArchSpec::eCore_x86_32_i386: case ArchSpec::eCore_x86_32_i486: { // Parsing from a 32 bit ELF core file, and populating/reusing the structure // properly, because the struct is for the 64 bit version size_t size = 0; offset_t offset = 0; pr_state = data.GetU8(&offset); pr_sname = data.GetU8(&offset); pr_zomb = data.GetU8(&offset); pr_nice = data.GetU8(&offset); pr_flag = data.GetU32(&offset); pr_uid = data.GetU16(&offset); pr_gid = data.GetU16(&offset); pr_pid = data.GetU32(&offset); pr_ppid = data.GetU32(&offset); pr_pgrp = data.GetU32(&offset); pr_sid = data.GetU32(&offset); size = 16; data.ExtractBytes(offset, size, byteorder, pr_fname); offset += size; size = 80; data.ExtractBytes(offset, size, byteorder, pr_psargs); offset += size; break; } default: error.SetErrorStringWithFormat("ELFLinuxPrPsInfo::%s Unknown architecture", __FUNCTION__); break; } return error; }
Error ELFLinuxPrStatus::Parse(DataExtractor &data, ArchSpec &arch) { Error error; ByteOrder byteorder = data.GetByteOrder(); if (GetSize(arch) > data.GetByteSize()) { error.SetErrorStringWithFormat("NT_PRSTATUS size should be %lu, but the remaining bytes are: %lu", GetSize(arch), data.GetByteSize()); return error; } switch(arch.GetCore()) { case ArchSpec::eCore_s390x_generic: case ArchSpec::eCore_x86_64_x86_64: data.ExtractBytes(0, sizeof(ELFLinuxPrStatus), byteorder, this); break; case ArchSpec::eCore_x86_32_i386: case ArchSpec::eCore_x86_32_i486: { // Parsing from a 32 bit ELF core file, and populating/reusing the structure // properly, because the struct is for the 64 bit version offset_t offset = 0; si_signo = data.GetU32(&offset); si_code = data.GetU32(&offset); si_errno = data.GetU32(&offset); pr_cursig = data.GetU16(&offset); offset += 2; // pad pr_sigpend = data.GetU32(&offset); pr_sighold = data.GetU32(&offset); pr_pid = data.GetU32(&offset); pr_ppid = data.GetU32(&offset); pr_pgrp = data.GetU32(&offset); pr_sid = data.GetU32(&offset); pr_utime.tv_sec = data.GetU32(&offset); pr_utime.tv_usec = data.GetU32(&offset); pr_stime.tv_sec = data.GetU32(&offset); pr_stime.tv_usec = data.GetU32(&offset); pr_cutime.tv_sec = data.GetU32(&offset); pr_cutime.tv_usec = data.GetU32(&offset); pr_cstime.tv_sec = data.GetU32(&offset); pr_cstime.tv_usec = data.GetU32(&offset); break; } default: error.SetErrorStringWithFormat("ELFLinuxPrStatus::%s Unknown architecture", __FUNCTION__); break; } return error; }
RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64( Thread &thread, RegisterInfoInterface *register_info, const DataExtractor &gpregset, const DataExtractor &fpregset) : RegisterContextPOSIX_x86(thread, 0, register_info) { size_t size, len; size = GetGPRSize(); m_gpregset.reset(new uint8_t[size]); len = gpregset.ExtractBytes(0, size, lldb::eByteOrderLittle, m_gpregset.get()); if (len != size) m_gpregset.reset(); size = sizeof(FXSAVE); m_fpregset.reset(new uint8_t[size]); len = fpregset.ExtractBytes(0, size, lldb::eByteOrderLittle, m_fpregset.get()); if (len != size) m_fpregset.reset(); }
bool ELFLinuxPrPsInfo::Parse(DataExtractor &data, ArchSpec &arch) { ByteOrder byteorder = data.GetByteOrder(); size_t len; switch(arch.GetCore()) { case ArchSpec::eCore_x86_64_x86_64: len = data.ExtractBytes(0, ELFLINUXPRPSINFO64_SIZE, byteorder, this); return len == ELFLINUXPRPSINFO64_SIZE; default: return false; } }