From 37065ba237f0d5d673d69f4a4752da1870d578e5 Mon Sep 17 00:00:00 2001 From: Simon Sobisch Date: Sun, 5 Nov 2023 18:07:25 +0000 Subject: [PATCH] reduce floodding debug output suppress debug output for invalid address passed to `memoryRead` if it is identical to the last recognized invalid one --- app/perfunwind.cpp | 5 ++++- app/perfunwind.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp index c1ad49f..a87bef0 100644 --- a/app/perfunwind.cpp +++ b/app/perfunwind.cpp @@ -115,7 +115,10 @@ static bool memoryRead(Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Word *result, void *ar /* Check overflow. */ if (addr + sizeof(Dwarf_Word) < addr) { - qDebug() << "Invalid memory read requested by dwfl" << Qt::hex << addr; + if (ui->lastInvalidAddr != addr) { + qDebug() << "Invalid memory read requested by dwfl" << Qt::hex << addr; + ui->lastInvalidAddr = addr; + } ui->firstGuessedFrame = ui->frames.length(); return false; } diff --git a/app/perfunwind.h b/app/perfunwind.h index 35e33fd..eea7378 100644 --- a/app/perfunwind.h +++ b/app/perfunwind.h @@ -103,6 +103,7 @@ class PerfUnwind : public QObject QHash> stackValues; QVector frames; PerfUnwind *unwind; + Dwarf_Addr lastInvalidAddr; const PerfRecordSample *sample; int maxFrames; int firstGuessedFrame;