File: iframestackmodel.h

package info (click to toggle)
kdevelop 4%3A22.12.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 70,096 kB
  • sloc: cpp: 284,635; javascript: 3,558; python: 3,422; sh: 1,319; ansic: 685; xml: 331; php: 95; lisp: 66; makefile: 39; sed: 12
file content (86 lines) | stat: -rw-r--r-- 2,623 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
    SPDX-FileCopyrightText: 2009 Vladimir Prus <ghost@cs.msu.su>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#ifndef KDEVPLATFORM_IFRAMESTACKMODEL_H
#define KDEVPLATFORM_IFRAMESTACKMODEL_H

#include "idebugsession.h"

#include <QUrl>

#include <QAbstractItemModel>
#include <QString>

namespace KDevelop {
class IFrameStackModelPrivate;

class KDEVPLATFORMDEBUGGER_EXPORT IFrameStackModel : public QAbstractItemModel
{
    Q_OBJECT

public:
    /** Stack frame */
    struct FrameItem {
        int nr;
        QString name;
        QUrl file;
        /* If -1, it means that file is not necessary a source file,
           but possibly a solib name.  */
        int line;
    };

    explicit IFrameStackModel(IDebugSession *session);
    ~IFrameStackModel() override;

    IDebugSession* session() const;

    /** Sets the current thread to the specified number,
       and sets the current frame to 0.
       Note that nothing prevents us from introducing
       setCurrentThreadAndFrame, but for all the cases when we
       switch to a different thread we want frame 0.  */
    virtual void setCurrentThread(int threadNumber) = 0;
    virtual void setCurrentThread(const QModelIndex &index) = 0;
    virtual int currentThread() const = 0;
    virtual QModelIndex currentThreadIndex() const = 0;

    /** Return the frame we wish to operate on.  This is always
       in context of the current thread.  This may be -1 if
       no frame is selected. This should only the be the case
       if the thread has no stack as such -- e.g. because it's
       running, or because it's exited.  */
    virtual int currentFrame() const = 0;
    virtual QModelIndex currentFrameIndex() const = 0;
    virtual void setCurrentFrame(int frame) = 0;

    virtual FrameItem frame(const QModelIndex &index) = 0;

    virtual void fetchThreads() = 0;
    virtual void fetchFrames(int threadNumber, int from, int to) = 0;
    virtual void fetchMoreFrames() = 0;

Q_SIGNALS:
    /* FIXME: It might make for a more concise interface if those
       two were removed, and the clients react to thread_or_frame_changed
       event and compare the current thread/frame in the framestack model
       with the one they are displaying.  */
    void currentThreadChanged(int thread);
    void currentFrameChanged(int frame);

private:
    virtual void handleEvent(IDebugSession::event_t event) = 0;

private:
    friend class IDebugSession;
    const QScopedPointer<class IFrameStackModelPrivate> d_ptr;
    Q_DECLARE_PRIVATE(IFrameStackModel)
};

}

Q_DECLARE_TYPEINFO(KDevelop::IFrameStackModel::FrameItem, Q_MOVABLE_TYPE);

#endif