File indexing completed on 2024-03-24 17:01:18

0001 /*******************************************************************
0002  * parsebugbacktraces.h
0003  * SPDX-FileCopyrightText: 2011 Matthias Fuchs <mat69@gmx.net>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  *
0007  ******************************************************************/
0008 
0009 #ifndef PARSE_BUG_BACKTRACES_H
0010 #define PARSE_BUG_BACKTRACES_H
0011 
0012 #include "bugzillalib.h"
0013 #include "parser/backtraceline.h"
0014 
0015 class BacktraceParser;
0016 
0017 /**
0018  * Parses a Bugreport to find all the backtraces listed there
0019  * NOTE it assumes that the backtraces provided were created
0020  * by gdb
0021  */
0022 class ParseBugBacktraces : QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit ParseBugBacktraces(const QList<Bugzilla::Comment::Ptr> &comments, QObject *parent = nullptr);
0027 
0028     void parse();
0029 
0030     enum DuplicateRating {
0031         PerfectDuplicate, // functionnames and stackframe numer match
0032         MostLikelyDuplicate, // functionnames and stackframe numer match >=90%
0033         MaybeDuplicate, // functionnames and stackframe numer match >=60%
0034         NoDuplicate, // functionnames and stackframe numer match <60%
0035     };
0036 
0037     DuplicateRating findDuplicate(const QList<BacktraceLine> &backtrace);
0038 
0039 Q_SIGNALS:
0040     void starting();
0041     void newLine(const QString &line);
0042 
0043 private:
0044     void parse(const QString &comment);
0045 
0046 private:
0047     BacktraceParser *m_parser = nullptr;
0048     const QList<Bugzilla::Comment::Ptr> m_comments;
0049     QList<QList<BacktraceLine>> m_backtraces;
0050 };
0051 
0052 #endif