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
);
55 virtual void paintCell(QPainter
* p
, int row
, int col
);
56 virtual void mousePressEvent(QMouseEvent
* ev
);
57 virtual void paletteChange(const QPalette
&);
58 void updateLineItem(int i
);
59 void expandRow(int row
);
60 void collapseRow(int row
);
61 void scrollToRow(int row
);
62 /** translates (0-based) line number plus a code address into a row number */
63 int lineToRow(int row
, const DbgAddr
& address
);
66 void clickedLeft(const QString
&, int, const DbgAddr
& address
, bool);
67 void clickedMid(const QString
&, int, const DbgAddr
& address
);
68 void clickedRight(const QPoint
&);
69 void disassemble(const QString
&, int);
70 void expanded(int lineNo
); /* source lineNo has been expanded */
71 void collapsed(int lineNo
); /* source lineNo has been collapsed */
75 enum LineItem
{ liPC
= 1, liPCup
= 2,
76 liBP
= 4, liBPdisabled
= 8, liBPtemporary
= 16,
78 liBPany
= liBP
|liBPdisabled
|liBPtemporary
|liBPconditional
82 QString code
; /* a line of text */
83 ValArray
<QString
> disass
; /* its disassembled code */
84 ValArray
<DbgAddr
> disassAddr
; /* the addresses thereof */
85 bool canDisass
; /* if line can be disassembled */
86 SourceLine() : canDisass(true) { }
87 int findAddressRowOffset(const DbgAddr
& address
) const;
89 ValArray
<SourceLine
> m_sourceCode
;
91 ValArray
<int> m_rowToLine
; /* source line number for each row */
92 ValArray
<uchar
> m_lineItems
;
93 QPixmap m_pcinner
; /* PC at innermost frame */
94 QPixmap m_pcup
; /* PC at frame up the stack */
95 QPixmap m_brkena
; /* enabled breakpoint */
96 QPixmap m_brkdis
; /* disabled breakpoint */
97 QPixmap m_brktmp
; /* temporary breakpoint marker */
98 QPixmap m_brkcond
; /* conditional breakpoint marker */
101 #endif // SOURCEWND_H