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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/***************************************************************************
begin : Sun Aug 8 1999
copyright : (C) 1999 by John Birch
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _FRAMESTACKWIDGET_H_
#define _FRAMESTACKWIDGET_H_
#include <tqlistview.h>
#include <tqstringlist.h>
#include "gdbcontroller.h"
#include "mi/miparser.h"
#include <vector>
namespace GDBDebugger
{
class FramestackWidget;
class ThreadStackItem : public TQListViewItem
{
public:
ThreadStackItem(FramestackWidget *parent,
unsigned threadNo);
virtual ~ThreadStackItem();
void setOpen(bool open);
TQListViewItem *lastChild() const;
void paintCell(TQPainter * p, const TQColorGroup & cg,
int column, int width, int align );
int threadNo()
{ return threadNo_; }
private:
int threadNo_;
TQString savedFunc_;
TQString savedSource_;
};
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
class FrameStackItem : public TQListViewItem
{
public:
FrameStackItem(FramestackWidget *parent,
unsigned frameNo,
const TQString &name);
FrameStackItem(ThreadStackItem *parent,
unsigned frameNo,
const TQString &name);
virtual ~FrameStackItem();
void setOpen(bool open);
TQListViewItem *lastChild() const;
void paintCell(TQPainter * p, const TQColorGroup & cg,
int column, int width, int align );
int frameNo()
{ return frameNo_; }
int threadNo()
{ return threadNo_; }
private:
int frameNo_;
int threadNo_;
};
/***************************************************************************/
/***************************************************************************/
/**
* @author John Birch
*/
class FramestackWidget : public TQListView
{
Q_OBJECT
public:
FramestackWidget( GDBController* controller,
TQWidget *parent=0,
const char *name=0, WFlags f=0 );
virtual ~FramestackWidget();
TQListViewItem *lastChild() const;
ThreadStackItem *findThread(int threadNo);
FrameStackItem *findFrame(int frameNo, int threadNo);
int viewedThread()
{ return viewedThread_ ? viewedThread_->threadNo() : -1; }
protected:
void drawContentsOffset( TQPainter * p, int ox, int oy,
int cx, int cy, int cw, int ch );
private:
/** Given gdb's 'frame' information, compute decent
textual representation for display.
The function is used both for frames and threads.
*/
void formatFrame(const GDBMI::Value& frame,
TQString& func_column,
TQString& source_column);
/** Cause gdb to produce backtrace for the current thread.
GDB reply will be route to parseArg and parseGDBBacktraceList,
and will show up under viewedThread_ (if there are threads), or
on top-level.
*/
void getBacktrace(int min_frame = 0, int max_frame = frameChunk_);
/** Obtains backtrace for the specified thread without chaning the current
thread in gdb.
Switches viewedThread_ to the specified thread, switches gdb thread,
call getBacktrace(), and switches the current thread back.
*/
void getBacktraceForThread(int threadNo);
friend class ThreadStackItem;
void handleThreadList(const GDBMI::ResultRecord&);
void handleThread(const GDBMI::ResultRecord&);
void parseGDBBacktraceList(const GDBMI::ResultRecord&);
void handleStackDepth(const GDBMI::ResultRecord& r);
public slots:
void slotEvent(GDBController::event_t e);
void slotSelectionChanged(TQListViewItem *thisItem);
virtual void showEvent(TQShowEvent*);
private:
void clear();
private:
ThreadStackItem *viewedThread_;
int currentFrame_;
GDBController* controller_;
// Data to pass from 'getBacktrace' to 'handleStackDepth'
int minFrame_;
int maxFrame_;
bool has_more_frames;
bool mayUpdate_;
friend class FrameStackItem;
static const int frameChunk_ = 5;
};
}
#endif
|