OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [gui_plugin/] [CpuWidgets/] [StackTraceWidget.h] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2017 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Stack trace viewer form.
6
 */
7
 
8
#pragma once
9
 
10
#include "api_core.h"   // MUST BE BEFORE QtWidgets.h or any other Qt header.
11
#include "attribute.h"
12
#include "igui.h"
13
 
14
#include <QtWidgets/QMdiArea>
15
#include <QtWidgets/QMdiSubWindow>
16
#include <QtWidgets/QGridLayout>
17
#include <QtWidgets/QAction>
18
#include <QtGui/qevent.h>
19
 
20
namespace debugger {
21
 
22
class StackTraceWidget : public QWidget {
23
    Q_OBJECT
24
public:
25
    StackTraceWidget(IGui *igui, QWidget *parent);
26
 
27
signals:
28
    void signalUpdateByTimer();
29
    void signalShowFunction(uint64_t addr, uint64_t sz);
30
 
31
private slots:
32
    void slotUpdateByTimer() {
33
        emit signalUpdateByTimer();
34
    }
35
    void slotShowFunction(uint64_t addr, uint64_t sz) {
36
        emit signalShowFunction(addr, sz);
37
    }
38
 
39
private:
40
    QGridLayout *gridLayout;
41
    IGui *igui_;
42
};
43
 
44
 
45
class StackTraceQMdiSubWindow : public QMdiSubWindow {
46
    Q_OBJECT
47
public:
48
    StackTraceQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent,
49
                      QAction *act = 0)
50
        : QMdiSubWindow(parent) {
51
        area_ = area;
52
        action_ = act;
53
        setWindowTitle(tr("Stack Trace"));
54
        setWindowIcon(QIcon(tr(":/images/stack_96x96.png")));
55
 
56
        StackTraceWidget *pnew = new StackTraceWidget(igui, this);
57
        setWidget(pnew);
58
        if (act) {
59
            act->setChecked(true);
60
        }
61
        connect(parent, SIGNAL(signalUpdateByTimer()),
62
                pnew, SLOT(slotUpdateByTimer()));
63
 
64
        connect(pnew, SIGNAL(signalShowFunction(uint64_t, uint64_t)),
65
                parent, SLOT(slotOpenDisasm(uint64_t, uint64_t)));
66
 
67
        area_->addSubWindow(this);
68
        setAttribute(Qt::WA_DeleteOnClose);
69
        show();
70
    }
71
 
72
protected:
73
    void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE {
74
        if (action_) {
75
            action_->setChecked(false);
76
        }
77
        area_->removeSubWindow(this);
78
        event_->accept();
79
    }
80
private:
81
    QAction *action_;
82
    QMdiArea *area_;
83
};
84
 
85
}  // namespace debugger

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.