diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2017-04-10 16:43:36 +0200 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2017-04-12 13:32:03 +0000 |
commit | 90a663b1c30ae2f185c782966a49e90a1ce59820 (patch) | |
tree | 416988702a685ee1a6e6bb21e31b19c488321579 | |
parent | eeb50e07bb3d6705c1053eab1c02be0a1f7ec866 (diff) |
Report an error when an ELF file could not be found
When we fail to find a matching ELF file for an mmap event, the
usefulness of the perfparser can be severly impacted:
- unwinding will not work
- symbol resolution will not work
- potentially other things will not work
As such, report an error to the user when this occurs.
Change-Id: I8a47f8725a29684ac11b24dadb20e669a45d3016
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | app/perfsymboltable.cpp | 12 | ||||
-rw-r--r-- | app/perfunwind.h | 10 |
2 files changed, 16 insertions, 6 deletions
diff --git a/app/perfsymboltable.cpp b/app/perfsymboltable.cpp index 2193c15..a29cb30 100644 --- a/app/perfsymboltable.cpp +++ b/app/perfsymboltable.cpp @@ -211,10 +211,18 @@ void PerfSymbolTable::registerElf(const PerfRecordMmap &mmap, const QByteArray & } } } - if (!found) // last fall-back, try the system root + if (!found) { + // last fall-back, try the system root fullPath.setFile(systemRoot + filePath); + found = fullPath.exists(); + } - if (!m_firstElfFile.isOpen() && fullPath.exists()) { + if (!found) { + m_unwind->sendError(PerfUnwind::MissingElfFile, + PerfUnwind::tr("Could not find ELF file for %1. " + "This can break stack unwinding " + "and lead to missing symbols.").arg(filePath)); + } else if (!m_firstElfFile.isOpen()) { m_firstElfFile.setFileName(fullPath.absoluteFilePath()); if (!m_firstElfFile.open(QIODevice::ReadOnly)) { qWarning() << "Failed to open file:" << m_firstElfFile.errorString(); diff --git a/app/perfunwind.h b/app/perfunwind.h index c7103c6..1894161 100644 --- a/app/perfunwind.h +++ b/app/perfunwind.h @@ -147,6 +147,12 @@ public: PerfKallsymEntry findKallsymEntry(quint64 address) const; + enum ErrorCode { + TimeOrderViolation = 1, + MissingElfFile = 2, + }; + void sendError(ErrorCode error, const QString &message); + private: enum CallchainContext { @@ -248,10 +254,6 @@ private: void sendLocation(qint32 id, const Location &location); void sendSymbol(qint32 id, const Symbol &symbol); void sendAttributes(qint32 id, const PerfEventAttributes &attributes, const QByteArray &name); - enum ErrorCode { - TimeOrderViolation = 1 - }; - void sendError(ErrorCode error, const QString &message); template<typename Event> void bufferEvent(const Event &event, QList<Event> *buffer, int *eventCounter); |