diff options
Diffstat (limited to 'drkonqi/backtrace.cpp')
-rw-r--r-- | drkonqi/backtrace.cpp | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/drkonqi/backtrace.cpp b/drkonqi/backtrace.cpp index 7fa052e76..213e666b5 100644 --- a/drkonqi/backtrace.cpp +++ b/drkonqi/backtrace.cpp @@ -201,20 +201,42 @@ bool BackTrace::usefulBacktrace() // remove stack frames added because of KCrash 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( "[KCrash 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( "[KCrash 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 ); + } + } } |