summaryrefslogtreecommitdiffstats
path: root/app/perfsymboltable.cpp
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2018-10-20 12:20:29 +0200
committerMilian Wolff <milian.wolff@kdab.com>2018-10-23 18:35:35 +0000
commitc1c830abb5e87cf0441f6732f5cbd953d59f1c5b (patch)
tree59828bca7c65bd1af675b756c4ef836c9a85f95c /app/perfsymboltable.cpp
parent573f54d94c7f476d9604e037a7763cab627662a6 (diff)
Report base mapping to dwfl when we need the module for an pgoff mmap
Previously, we would just error out when we encounter an address in an mmaped elf with pgoff != 0. E.g. for the following mmap events: 0x7f5d69432000 to 0x7f5d6957d000, len = 0x14b000, offset = 0, virt start = 0x7f5d69432000 r--p /usr/lib/libQt5Widgets.so.5.11.2 0x7f5d6957d000 to 0x7f5d6990e000, len = 0x391000, offset = 0x14b000, virt start = 0x7f5d69432000 r-xp /usr/lib/libQt5Widgets.so.5.11.2 0x7f5d6990e000 to 0x7f5d69a61000, len = 0x153000, offset = 0x4dc000, virt start = 0x7f5d69432000 r--p /usr/lib/libQt5Widgets.so.5.11.2 0x7f5d69a61000 to 0x7f5d69a93000, len = 0x32000, offset = 0x62e000, virt start = 0x7f5d69433000 r--p /usr/lib/libQt5Widgets.so.5.11.2 0x7f5d69a93000 to 0x7f5d69a94000, len = 0x1000, offset = 0x660000, virt start = 0x7f5d69433000 rw-p /usr/lib/libQt5Widgets.so.5.11.2 We sometimes requested the module for the second to last mmap from memoryRead/accessDsoMem, leading to the dreaded "failed to report" error message due to pgoff != 0. This patch now introduces a trivial time-based association to the base map with pgoff = 0 when the originalPath matches. This allows us to use the address of the first mmap event above when we encounter an address in the second to last mmap, fixing the notorious error and unbreaking some broken backtraces. Task-number: QTCREATORBUG-21260 Change-Id: I4bc5b4e5b23973e4ba8cf68389fa813208d20867 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'app/perfsymboltable.cpp')
-rw-r--r--app/perfsymboltable.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/perfsymboltable.cpp b/app/perfsymboltable.cpp
index 136c8c6..50e6fbc 100644
--- a/app/perfsymboltable.cpp
+++ b/app/perfsymboltable.cpp
@@ -496,6 +496,9 @@ Dwfl_Module *PerfSymbolTable::module(quint64 addr, const PerfElfMap::ElfInfo &el
if (!m_dwfl)
return nullptr;
+ if (elf.pgoff && elf.hasBaseAddr())
+ return module(addr, m_elfs.findElf(elf.baseAddr));
+
Dwfl_Module *mod = dwfl_addrmodule(m_dwfl, addr);
if (mod) {