summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-01-25 11:18:34 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-01-25 11:26:13 +0000
commit70cd96d631e2a63381cde248f6b68e0b7c9289f0 (patch)
treef1c68c5e721b322e5cb58d0432edd7bdaa75c5cb
parentc29884b2695aacf9b94f8b8327ea40399446ab50 (diff)
When analyzing samples in kernel space, use kernel symbols
Without this we cannot properly report any kernel stack traces and get interesting error messages because the symbols aren't found in userspace. Change-Id: I981dbdac27beefa57c74bc9e8f41d5438e75668c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--app/perfunwind.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp
index 849b220..fab3e15 100644
--- a/app/perfunwind.cpp
+++ b/app/perfunwind.cpp
@@ -509,8 +509,7 @@ void PerfUnwind::analyze(const PerfRecordSample &sample)
return;
const bool isKernel = ipIsInKernelSpace(sample.ip());
-
- PerfSymbolTable *userSymbols = symbolTable(sample.pid());
+ PerfSymbolTable *symbols = symbolTable(isKernel ? s_kernelPid : sample.pid());
for (int unwindingAttempt = 0; unwindingAttempt < 2; ++unwindingAttempt) {
m_currentUnwind.isInterworking = false;
@@ -518,31 +517,30 @@ void PerfUnwind::analyze(const PerfRecordSample &sample)
m_currentUnwind.sample = &sample;
m_currentUnwind.frames.clear();
- userSymbols->updatePerfMap();
+ symbols->updatePerfMap();
- Dwfl *userDwfl = userSymbols->attachDwfl(&m_currentUnwind);
+ Dwfl *dwfl = symbols->attachDwfl(&m_currentUnwind);
if (sample.callchain().length() > 0)
resolveCallchain();
// only try to unwind when resolveCallchain did not dirty the cache
- if (!userSymbols->cacheIsDirty()) {
- if (userDwfl && sample.registerAbi() != 0 && sample.userStack().length() > 0)
- unwindStack(userDwfl);
+ if (!symbols->cacheIsDirty()) {
+ if (dwfl && sample.registerAbi() != 0 && sample.userStack().length() > 0)
+ unwindStack(dwfl);
else
break;
}
// when the cache is dirty, we clean it up and try again, otherwise we can
// stop as unwinding should have succeeded
- if (userSymbols->cacheIsDirty())
- userSymbols->clearCache(); // fail, try again
+ if (symbols->cacheIsDirty())
+ symbols->clearCache(); // fail, try again
else
break; // success
}
// If nothing was found, at least look up the IP
if (m_currentUnwind.frames.isEmpty()) {
- PerfSymbolTable *symbols = isKernel ? symbolTable(s_kernelPid) : userSymbols;
m_currentUnwind.frames.append(symbols->lookupFrame(sample.ip(), isKernel,
&m_currentUnwind.isInterworking));
}