3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
11 #include "dbgdriver.h"
13 // forward declarations
17 class SourceWindow
: public KTextView
21 SourceWindow(const char* fileName
, QWidget
* parent
, const char* name
);
26 bool fileNameMatches(const QString
& other
);
27 void scrollTo(int lineNo
, const DbgAddr
& address
);
28 const QString
& fileName() const { return m_fileName
; }
29 void updateLineItems(const KDebugger
* dbg
);
30 void setPC(bool set
, int lineNo
, const DbgAddr
& address
, int frameNo
);
31 enum FindDirection
{ findForward
= 1, findBackward
= -1 };
32 void find(const QString
& text
, bool caseSensitive
, FindDirection dir
);
33 bool wordAtPoint(const QPoint
& p
, QString
& word
, QRect
& r
);
35 * Translates row number (zero-based) to zero-based source line number.
36 * If sourceRow is non-zero, it is filled with the source code row
37 * belonging to the line number.
39 int rowToLine(int row
, int* sourceRow
= 0);
40 /** Translates zero-based source line number to row number (zero-based) */
41 int lineToRow(int line
);
42 /** Is the row disassembled? */
43 bool isRowExpanded(int row
);
44 /** Does the row show disassembled code? */
45 bool isRowDisassCode(int row
);
47 /** lineNo is zero-based */
48 void disassembled(int lineNo
, const QList
<DisassembledCode
>& disass
);
50 void activeLine(int& lineNo
, DbgAddr
& address
);
53 virtual int textCol() const;
54 virtual int cellWidth(int col
) const;
55 virtual void paintCell(QPainter
* p
, int row
, int col
);
56 virtual void mousePressEvent(QMouseEvent
* ev
);
57 virtual void keyPressEvent(QKeyEvent
* ev
);
58 virtual void paletteChange(const QPalette
&);
59 void updateLineItem(int i
);
60 void expandRow(int row
);
61 void collapseRow(int row
);
62 void scrollToRow(int row
);
63 /** translates (0-based) line number plus a code address into a row number */
64 int lineToRow(int row
, const DbgAddr
& address
);
66 void actionExpandRow(int row
);
67 void actionCollapseRow(int row
);
70 void clickedLeft(const QString
&, int, const DbgAddr
& address
, bool);
71 void clickedMid(const QString
&, int, const DbgAddr
& address
);
72 void clickedRight(const QPoint
&);
73 void disassemble(const QString
&, int);
74 void expanded(int lineNo
); /* source lineNo has been expanded */
75 void collapsed(int lineNo
); /* source lineNo has been collapsed */
79 enum LineItem
{ liPC
= 1, liPCup
= 2,
80 liBP
= 4, liBPdisabled
= 8, liBPtemporary
= 16,
81 liBPconditional
= 32, liBPorphan
= 64,
82 liBPany
= liBP
|liBPdisabled
|liBPtemporary
|liBPconditional
|liBPorphan
86 QString code
; /* a line of text */
87 ValArray
<QString
> disass
; /* its disassembled code */
88 ValArray
<DbgAddr
> disassAddr
; /* the addresses thereof */
89 bool canDisass
; /* if line can be disassembled */
90 SourceLine() : canDisass(true) { }
91 int findAddressRowOffset(const DbgAddr
& address
) const;
93 ValArray
<SourceLine
> m_sourceCode
;
95 ValArray
<int> m_rowToLine
; /* source line number for each row */
96 ValArray
<uchar
> m_lineItems
;
97 QPixmap m_pcinner
; /* PC at innermost frame */
98 QPixmap m_pcup
; /* PC at frame up the stack */
99 QPixmap m_brkena
; /* enabled breakpoint */
100 QPixmap m_brkdis
; /* disabled breakpoint */
101 QPixmap m_brktmp
; /* temporary breakpoint marker */
102 QPixmap m_brkcond
; /* conditional breakpoint marker */
103 QPixmap m_brkorph
; /* orphaned breakpoint marker */
106 #endif // SOURCEWND_H