19 res = qFromBigEndian<quint16>(
s);
21 res = qFromLittleEndian<quint16>(
s);
30 res = qFromBigEndian<quint32>(
s);
32 res = qFromLittleEndian<quint32>(
s);
42 res = qFromBigEndian<quint32>(
s);
44 res = qFromLittleEndian<quint32>(
s);
48 res = qFromBigEndian<quint64>(
s);
50 res = qFromLittleEndian<quint64>(
s);
144 if (strncmp(
mapper.start,
"\177ELF", 4) != 0) {
188 if (e_shsize > fdlen) {
194 if (e_phentsize != (is64Bit ? 56 : 32)) {
202 if (e_shentsize % 4) {
209 if (
data !=
mapper.ustart + (is64Bit ? 64 : 52)) {
214 if (
quint64(e_shnum) * e_shentsize > fdlen) {
215 const QString reason =
QStringLiteral(
"announced %1 sections, each %2 bytes, exceed file size").arg(e_shnum).arg(e_shentsize);
220 quint64 soff = e_shoff + e_shentsize * e_shtrndx;
234 if (
quint32(stringTableFileOffset + e_shentsize) >= fdlen
235 || stringTableFileOffset == 0) {
246 if (stringTableFileOffset + sh.
index > fdlen) {
248 .arg(
i).arg(e_shnum);
254 if (sh.
name ==
".gdb_index") {
256 }
else if (sh.
name ==
".debug_info") {
258 }
else if (sh.
name ==
".gnu_debuglink") {
261 }
else if (sh.
name ==
".note.gnu.build-id") {
300 const int pos =
res.indexOf(
'\0');
382 dynStrOffset = eh.offset;
384 dynamicOffset = eh.offset;
385 dynamicSize = eh.
size;
387 if (dynStrOffset && dynamicOffset)
391 if (!dynStrOffset || !dynamicOffset) {
392 m_errorString =
QStringLiteral(
"Not a dynamically linked executable.");
396 const unsigned char *dynamicData =
mapper.ustart + dynamicOffset;
397 const unsigned char *dynamicDataEnd = dynamicData + dynamicSize;
398 while (dynamicData < dynamicDataEnd) {
403 dynamicData +=
sizeof(
quint32);
407 dynamicData +=
sizeof(
quint32);
DebugSymbolsType symbolsType
QList< ElfProgramHeader > programHeaders
QList< ElfSectionHeader > sectionHeaders
int indexOf(const QByteArray &name) const
ElfMapper(const ElfReader *reader)
QList< QByteArray > dependencies()
ElfReader(const QString &binary)
QByteArray readSection(const QByteArray §ionName)
QByteArray readCoreName(bool *isCore)
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
QByteArray toHex(char separator='\0') const
Returns a hex encoded copy of the byte array.
static QString toNativeSeparators(const QString &pathName)
uchar * map(qint64 offset, qint64 size, MemoryMapFlags flags=NoOptions)
Maps size bytes of the file into memory starting at offset.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
qint64 size() const override
\reimp
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString msgInvalidElfObject(const QString &binary, const QString &why)
quint64 getOffset(const unsigned char *&s, const ElfData &context)
quint64 getAddress(const unsigned char *&s, const ElfData &context)
quint32 getWord(const unsigned char *&s, const ElfData &context)
static QByteArray cutout(const char *s)
static void parseProgramHeader(const uchar *s, ElfProgramHeader *sh, const ElfData &context)
quint16 getHalfWord(const unsigned char *&s, const ElfData &context)
static void parseSectionHeader(const uchar *s, ElfSectionHeader *sh, const ElfData &context)
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
AudioChannelLayoutTag tag
static QString header(const QString &name)
GLsizei GLsizei GLenum void * binary
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
#define QStringLiteral(str)
unsigned long long quint64