From 1fbdb78d932e66263f82a1a306b5900cc44b7107 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 8 May 2013 16:54:41 -0500 Subject: Update drkonqi to collect data on threaded programs and CPU type/speed/core number --- drkonqi/backtrace.cpp | 74 ++++++++++++++++++++++++++++++++++++++----------- drkonqi/debuggers/gdbrc | 5 ++-- drkonqi/krashconf.cpp | 1 + drkonqi/krashconf.h | 2 ++ 4 files changed, 64 insertions(+), 18 deletions(-) diff --git a/drkonqi/backtrace.cpp b/drkonqi/backtrace.cpp index d7a09c54e..2b349d288 100644 --- a/drkonqi/backtrace.cpp +++ b/drkonqi/backtrace.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "krashconf.h" #include "backtrace.h" @@ -201,20 +202,61 @@ bool BackTrace::usefulBacktrace() // remove stack frames added because of TDECrash void BackTrace::processBacktrace() { - if( !m_krashconf->kcrashRegExp().isEmpty()) - { - TQRegExp kcrashregexp( m_krashconf->kcrashRegExp()); - int pos = kcrashregexp.search( m_strBt ); - if( pos >= 0 ) - { - int len = kcrashregexp.matchedLength(); - if( m_strBt[ pos ] == '\n' ) - { - ++pos; - --len; - } - m_strBt.remove( pos, len ); - m_strBt.insert( pos, TQString::fromLatin1( "[TDECrash handler]\n" )); - } - } + if( !m_krashconf->kcrashRegExp().isEmpty()) { + TQRegExp kcrashregexp( m_krashconf->kcrashRegExp()); + int pos = -1; + while ((pos = kcrashregexp.search( m_strBt )) >= 0) { + pos = kcrashregexp.search( m_strBt ); + if( pos >= 0 ) { + int len = kcrashregexp.matchedLength(); + int nextinfochunkpos = m_strBt.find("====", pos); + if (nextinfochunkpos >= 0) { + // Trying to delete too much! + int chunkpos = pos; + TQString limitedstrBt = m_strBt.mid(pos, nextinfochunkpos - pos); + pos = kcrashregexp.search( limitedstrBt ) + chunkpos; + len = kcrashregexp.matchedLength(); + } + if (pos >= 0) { + if( m_strBt[ pos ] == '\n' ) { + ++pos; + --len; + } + m_strBt.remove( pos, len ); + m_strBt.insert( pos, TQString::fromLatin1( "[TDECrash handler]\n" )); + } + } + } + } + if( !m_krashconf->kcrashRegExpSingle().isEmpty()) { + TQRegExp kcrashregexp( m_krashconf->kcrashRegExpSingle()); + int pos = kcrashregexp.search( m_strBt ); + if( pos >= 0 ) { + int len = kcrashregexp.matchedLength(); + if( m_strBt[ pos ] == '\n' ) { + ++pos; + --len; + } + m_strBt.remove( pos, len ); + } + } + + // Append potentially important hardware information + m_strBt.append("\n\n==== (tdehwlib) hardware information ====\n"); + TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); + TDEGenericHardwareList hwlist = hwdevices->listAllPhysicalDevices(); + TDEGenericDevice *hwdevice; + for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) { + if (hwdevice->type() == TDEGenericDeviceType::CPU) { + TDECPUDevice* cpudevice = static_cast(hwdevice); + m_strBt.append(TQString("CPU core number:\t\t%1\n").arg(cpudevice->coreNumber())); + m_strBt.append(TQString("\tVendor:\t\t\t%1\n").arg(cpudevice->vendorName())); + m_strBt.append(TQString("\tModel:\t\t\t%1\n").arg(cpudevice->vendorModel())); + m_strBt.append(TQString("\tName:\t\t\t%1\n").arg(cpudevice->name())); + m_strBt.append(TQString("\tCurrent Frequency:\t%1 MHz\n").arg(cpudevice->frequency())); + m_strBt.append(TQString("\tMinimum Frequency:\t%1 MHz\n").arg(cpudevice->minFrequency())); + m_strBt.append(TQString("\tMaximum Frequency:\t%1 MHz\n").arg(cpudevice->maxFrequency())); + m_strBt.append("\n"); + } + } } diff --git a/drkonqi/debuggers/gdbrc b/drkonqi/debuggers/gdbrc index c0215c4e0..e414d86a0 100644 --- a/drkonqi/debuggers/gdbrc +++ b/drkonqi/debuggers/gdbrc @@ -158,9 +158,10 @@ Comment[zu]=Umcoshi wamaphutha osekelwe umbhalo osuka kwi-GNU kwikhonsoli Exec=konsole -e gdb -nw %execname %pid ExecBatch=gdb -nw -n -batch -x %tempfile %execname %pid TryExec=gdb -BacktraceCommand=bt +BacktraceCommand=echo \\n\necho ==== (gdb) bt ====\\n\nbt\necho \\n\\n\necho ==== (gdb) bt full ====\\n\nbt full\necho\\n\\n\necho ==== (gdb) thread apply all bt ====\\n\nthread apply all bt RemoveFromBacktraceRegExp=\(no debugging symbols found\)\.\.\.\\n? InvalidStackFrameRegExp=\\n#[0-9]+\\s+0x[0-9A-Fa-f]+ \w* \?\? FrameRegExp=\\n#[0-9]+\\s+0x[0-9A-Fa-f]+ NeededInValidBacktraceRegExp=\\n#5 -TDECrashRegExp=\\n0x[0123456789abcdefABCDEF]+.*[ ]*\\n +TDECrashRegExp=\\n#0[ ]*0x[0123456789abcdefABCDEF]+.*[ ]*\\n +TDECrashRegExpSingle=\\n0x[0123456789abcdefABCDEF][^\\n]*\\n diff --git a/drkonqi/krashconf.cpp b/drkonqi/krashconf.cpp index 884d66bc4..6a96c4aab 100644 --- a/drkonqi/krashconf.cpp +++ b/drkonqi/krashconf.cpp @@ -111,6 +111,7 @@ void KrashConfig :: readConfig() m_frameRegExp = debuggers.readEntry("FrameRegExp"); m_neededInValidBacktraceRegExp = debuggers.readEntry("NeededInValidBacktraceRegExp"); m_kcrashRegExp = debuggers.readEntry("TDECrashRegExp"); + m_kcrashRegExpSingle = debuggers.readEntry("TDECrashRegExpSingle"); TDEConfig preset(TQString::fromLatin1("presets/%1rc").arg(configname), true, false, "appdata"); diff --git a/drkonqi/krashconf.h b/drkonqi/krashconf.h index cdde4b58c..2e4c414ee 100644 --- a/drkonqi/krashconf.h +++ b/drkonqi/krashconf.h @@ -66,6 +66,7 @@ public: TQString frameRegExp() const { return m_frameRegExp; } TQString neededInValidBacktraceRegExp() const { return m_neededInValidBacktraceRegExp; } TQString kcrashRegExp() const { return m_kcrashRegExp; } + TQString kcrashRegExpSingle() const { return m_kcrashRegExpSingle; } bool showBacktrace() const { return m_showbacktrace; }; bool showDebugger() const { return m_showdebugger && !m_debugger.isNull(); }; bool showBugReport() const { return m_showbugreport; }; @@ -108,6 +109,7 @@ private: TQString m_frameRegExp; TQString m_neededInValidBacktraceRegExp; TQString m_kcrashRegExp; + TQString m_kcrashRegExpSingle; }; #endif -- cgit v1.2.1