* gdb.texinfo (TUI Overview): Document breakpoint markers.
[deliverable/binutils-gdb.git] / gdb / tui / tuiData.h
CommitLineData
f377b406 1/* TUI data manipulation routines.
bc6b7f04 2 Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
f377b406
SC
3 Contributed by Hewlett-Packard Company.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
c906108c
SS
22#ifndef TUI_DATA_H
23#define TUI_DATA_H
24
2a5127c4
SC
25#if defined (HAVE_NCURSES_H)
26#include <ncurses.h>
27#elif defined (HAVE_CURSES_H)
28#include <curses.h>
29#endif
30
31/* Generic window information */
32 typedef struct _TuiGenWinInfo
33 {
34 WINDOW *handle; /* window handle */
35 TuiWinType type; /* type of window */
36 int width; /* window width */
37 int height; /* window height */
38 TuiPoint origin; /* origin of window */
39 OpaquePtr content; /* content of window */
40 int contentSize; /* Size of content (# of elements) */
41 int contentInUse; /* Can it be used, or is it already used? */
42 int viewportHeight; /* viewport height */
43 int lastVisibleLine; /* index of last visible line */
44 int isVisible; /* whether the window is visible or not */
bc6b7f04 45 char* title; /* Window title to display. */
2a5127c4
SC
46 }
47TuiGenWinInfo, *TuiGenWinInfoPtr;
48
c906108c
SS
49/* Constant definitions */
50#define DEFAULT_TAB_LEN 8
51#define NO_SRC_STRING "[ No Source Available ]"
52#define NO_DISASSEM_STRING "[ No Assembly Available ]"
53#define NO_REGS_STRING "[ Register Values Unavailable ]"
54#define NO_DATA_STRING "[ No Data Values Displayed ]"
55#define MAX_CONTENT_COUNT 100
56#define SRC_NAME "SRC"
57#define CMD_NAME "CMD"
58#define DATA_NAME "REGS"
59#define DISASSEM_NAME "ASM"
60#define TUI_NULL_STR ""
61#define DEFAULT_HISTORY_COUNT 25
62#define BOX_WINDOW TRUE
63#define DONT_BOX_WINDOW FALSE
64#define HILITE TRUE
65#define NO_HILITE FALSE
66#define WITH_LOCATOR TRUE
67#define NO_LOCATOR FALSE
68#define EMPTY_SOURCE_PROMPT TRUE
69#define NO_EMPTY_SOURCE_PROMPT FALSE
70#define UNDEFINED_ITEM -1
71#define MIN_WIN_HEIGHT 3
72#define MIN_CMD_WIN_HEIGHT 3
73
74#define FILE_PREFIX "File: "
75#define PROC_PREFIX "Procedure: "
76#define LINE_PREFIX "Line: "
77#define PC_PREFIX "pc: "
78
79#define TUI_FLOAT_REGS_NAME "$FREGS"
80#define TUI_FLOAT_REGS_NAME_LOWER "$fregs"
81#define TUI_GENERAL_REGS_NAME "$GREGS"
82#define TUI_GENERAL_REGS_NAME_LOWER "$gregs"
83#define TUI_SPECIAL_REGS_NAME "$SREGS"
84#define TUI_SPECIAL_REGS_NAME_LOWER "$sregs"
85#define TUI_GENERAL_SPECIAL_REGS_NAME "$REGS"
86#define TUI_GENERAL_SPECIAL_REGS_NAME_LOWER "$regs"
87
88/* Scroll direction enum */
c5aa993b
JM
89typedef enum
90 {
c906108c
SS
91 FORWARD_SCROLL,
92 BACKWARD_SCROLL,
93 LEFT_SCROLL,
94 RIGHT_SCROLL
c5aa993b
JM
95 }
96TuiScrollDirection, *TuiScrollDirectionPtr;
c906108c
SS
97
98
99/* General list struct */
c5aa993b
JM
100typedef struct _TuiList
101 {
102 OpaqueList list;
103 int count;
104 }
105TuiList, *TuiListPtr;
c906108c
SS
106
107
108/* The kinds of layouts available */
c5aa993b
JM
109typedef enum
110 {
c906108c
SS
111 SRC_COMMAND,
112 DISASSEM_COMMAND,
113 SRC_DISASSEM_COMMAND,
114 SRC_DATA_COMMAND,
115 DISASSEM_DATA_COMMAND,
116 UNDEFINED_LAYOUT
c5aa993b
JM
117 }
118TuiLayoutType, *TuiLayoutTypePtr;
c906108c
SS
119
120/* Basic data types that can be displayed in the data window. */
c5aa993b
JM
121typedef enum _TuiDataType
122 {
c906108c
SS
123 TUI_REGISTER,
124 TUI_SCALAR,
125 TUI_COMPLEX,
126 TUI_STRUCT
c5aa993b
JM
127 }
128TuiDataType, TuiDataTypePtr;
c906108c
SS
129
130/* Types of register displays */
c5aa993b
JM
131typedef enum _TuiRegisterDisplayType
132 {
c906108c
SS
133 TUI_UNDEFINED_REGS,
134 TUI_GENERAL_REGS,
135 TUI_SFLOAT_REGS,
136 TUI_DFLOAT_REGS,
137 TUI_SPECIAL_REGS,
138 TUI_GENERAL_AND_SPECIAL_REGS
c5aa993b
JM
139 }
140TuiRegisterDisplayType, *TuiRegisterDisplayTypePtr;
c906108c
SS
141
142/* Structure describing source line or line address */
c5aa993b
JM
143typedef union _TuiLineOrAddress
144 {
145 int lineNo;
c774cec6 146 CORE_ADDR addr;
c5aa993b
JM
147 }
148TuiLineOrAddress, *TuiLineOrAddressPtr;
c906108c
SS
149
150/* Current Layout definition */
c5aa993b
JM
151typedef struct _TuiLayoutDef
152 {
153 TuiWinType displayMode;
154 int split;
155 TuiRegisterDisplayType regsDisplayType;
156 TuiRegisterDisplayType floatRegsDisplayType;
157 }
158TuiLayoutDef, *TuiLayoutDefPtr;
c906108c
SS
159
160/* Elements in the Source/Disassembly Window */
161typedef struct _TuiSourceElement
c5aa993b
JM
162 {
163 char *line;
164 TuiLineOrAddress lineOrAddr;
165 int isExecPoint;
166 int hasBreak;
167 }
168TuiSourceElement, *TuiSourceElementPtr;
c906108c
SS
169
170
171/* Elements in the data display window content */
172typedef struct _TuiDataElement
c5aa993b 173 {
bc77de56 174 const char *name;
c5aa993b 175 int itemNo; /* the register number, or data display number */
c906108c 176 TuiDataType type;
c5aa993b
JM
177 Opaque value;
178 int highlight;
179 }
180TuiDataElement, *TuiDataElementPtr;
c906108c
SS
181
182
183/* Elements in the command window content */
184typedef struct _TuiCommandElement
c5aa993b
JM
185 {
186 char *line;
187 }
188TuiCommandElement, *TuiCommandElementPtr;
c906108c
SS
189
190
191#define MAX_LOCATOR_ELEMENT_LEN 100
192
193/* Elements in the locator window content */
194typedef struct _TuiLocatorElement
c5aa993b
JM
195 {
196 char fileName[MAX_LOCATOR_ELEMENT_LEN];
197 char procName[MAX_LOCATOR_ELEMENT_LEN];
198 int lineNo;
c774cec6 199 CORE_ADDR addr;
c5aa993b
JM
200 }
201TuiLocatorElement, *TuiLocatorElementPtr;
c906108c 202
00b2bad4
SC
203/* Flags to tell what kind of breakpoint is at current line. */
204#define TUI_BP_ENABLED 0x01
205#define TUI_BP_DISABLED 0x02
206#define TUI_BP_HIT 0x04
207#define TUI_BP_CONDITIONAL 0x08
208#define TUI_BP_HARDWARE 0x10
209
210/* Position of breakpoint markers in the exec info string. */
211#define TUI_BP_HIT_POS 0
212#define TUI_BP_BREAK_POS 1
213#define TUI_EXEC_POS 2
214#define TUI_EXECINFO_SIZE 4
215
216typedef char TuiExecInfoContent[TUI_EXECINFO_SIZE];
c906108c
SS
217
218/* An content element in a window */
219typedef union
c5aa993b
JM
220 {
221 TuiSourceElement source; /* the source elements */
222 TuiGenWinInfo dataWindow; /* data display elements */
223 TuiDataElement data; /* elements of dataWindow */
224 TuiCommandElement command; /* command elements */
225 TuiLocatorElement locator; /* locator elements */
00b2bad4 226 TuiExecInfoContent simpleString; /* simple char based elements */
c5aa993b
JM
227 }
228TuiWhichElement, *TuiWhichElementPtr;
c906108c
SS
229
230typedef struct _TuiWinElement
c5aa993b
JM
231 {
232 int highlight;
c906108c 233 TuiWhichElement whichElement;
c5aa993b
JM
234 }
235TuiWinElement, *TuiWinElementPtr;
c906108c
SS
236
237
238/* This describes the content of the window. */
c5aa993b 239typedef TuiWinElementPtr *TuiWinContent;
c906108c
SS
240
241
242/* This struct defines the specific information about a data display window */
c5aa993b
JM
243typedef struct _TuiDataInfo
244 {
245 TuiWinContent dataContent; /* start of data display content */
246 int dataContentCount;
247 TuiWinContent regsContent; /* start of regs display content */
248 int regsContentCount;
249 TuiRegisterDisplayType regsDisplayType;
250 int regsColumnCount;
251 int displayRegs; /* Should regs be displayed at all? */
252 }
253TuiDataInfo, *TuiDataInfoPtr;
254
255
256typedef struct _TuiSourceInfo
257 {
258 int hasLocator; /* Does locator belongs to this window? */
259 TuiGenWinInfoPtr executionInfo; /* execution information window */
260 int horizontalOffset; /* used for horizontal scroll */
261 TuiLineOrAddress startLineOrAddr;
bc6b7f04 262 char* filename;
c5aa993b
JM
263 }
264TuiSourceInfo, *TuiSourceInfoPtr;
265
266
267typedef struct _TuiCommandInfo
268 {
269 int curLine; /* The current line position */
270 int curch; /* The current cursor position */
d75e970c 271 int start_line;
c5aa993b
JM
272 }
273TuiCommandInfo, *TuiCommandInfoPtr;
c906108c
SS
274
275
276/* This defines information about each logical window */
c5aa993b
JM
277typedef struct _TuiWinInfo
278 {
279 TuiGenWinInfo generic; /* general window information */
280 union
281 {
282 TuiSourceInfo sourceInfo;
283 TuiDataInfo dataDisplayInfo;
284 TuiCommandInfo commandInfo;
285 Opaque opaque;
286 }
287 detail;
288 int canHighlight; /* Can this window ever be highlighted? */
289 int isHighlighted; /* Is this window highlighted? */
290 }
291TuiWinInfo, *TuiWinInfoPtr;
c906108c
SS
292
293/* MACROS (prefixed with m_) */
294
295/* Testing macros */
296#define m_genWinPtrIsNull(winInfo) \
297 ((winInfo) == (TuiGenWinInfoPtr)NULL)
298#define m_genWinPtrNotNull(winInfo) \
299 ((winInfo) != (TuiGenWinInfoPtr)NULL)
300#define m_winPtrIsNull(winInfo) \
301 ((winInfo) == (TuiWinInfoPtr)NULL)
302#define m_winPtrNotNull(winInfo) \
303 ((winInfo) != (TuiWinInfoPtr)NULL)
304
305#define m_winIsSourceType(type) \
306 (type == SRC_WIN || type == DISASSEM_WIN)
307#define m_winIsAuxillary(winType) \
308 (winType > MAX_MAJOR_WINDOWS)
309#define m_hasLocator(winInfo) \
310 ( ((winInfo) != (TuiWinInfoPtr)NULL) ? \
311 (winInfo->detail.sourceInfo.hasLocator) : \
312 FALSE )
313
314#define m_setWinHighlightOn(winInfo) \
315 if ((winInfo) != (TuiWinInfoPtr)NULL) \
316 (winInfo)->isHighlighted = TRUE
317#define m_setWinHighlightOff(winInfo) \
318 if ((winInfo) != (TuiWinInfoPtr)NULL) \
319 (winInfo)->isHighlighted = FALSE
320
321
322/* Global Data */
c5aa993b
JM
323extern TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
324extern int tui_version;
c906108c
SS
325
326/* Macros */
327#define srcWin winList[SRC_WIN]
328#define disassemWin winList[DISASSEM_WIN]
329#define dataWin winList[DATA_WIN]
330#define cmdWin winList[CMD_WIN]
331
332/* Data Manipulation Functions */
a14ed312
KB
333extern void initializeStaticData (void);
334extern TuiGenWinInfoPtr allocGenericWinInfo (void);
335extern TuiWinInfoPtr allocWinInfo (TuiWinType);
336extern void initGenericPart (TuiGenWinInfoPtr);
337extern void initWinInfo (TuiWinInfoPtr);
338extern TuiWinContent allocContent (int, TuiWinType);
339extern int addContentElements (TuiGenWinInfoPtr, int);
340extern void initContentElement (TuiWinElementPtr, TuiWinType);
341extern void freeWindow (TuiWinInfoPtr);
342extern void freeAllWindows (void);
343extern void freeWinContent (TuiGenWinInfoPtr);
344extern void freeDataContent (TuiWinContent, int);
345extern void freeAllSourceWinsContent (void);
346extern void tuiDelWindow (TuiWinInfoPtr);
347extern void tuiDelDataWindows (TuiWinContent, int);
348extern TuiWinInfoPtr winByName (char *);
349extern TuiWinInfoPtr partialWinByName (char *);
350extern char *winName (TuiGenWinInfoPtr);
351extern char *displayableWinContentOf (TuiGenWinInfoPtr, TuiWinElementPtr);
352extern char *displayableWinContentAt (TuiGenWinInfoPtr, int);
353extern int winElementHeight (TuiGenWinInfoPtr, TuiWinElementPtr);
354extern TuiLayoutType currentLayout (void);
355extern void setCurrentLayoutTo (TuiLayoutType);
356extern int termHeight (void);
2a5127c4 357extern void setTermHeightTo (int);
a14ed312 358extern int termWidth (void);
2a5127c4 359extern void setTermWidthTo (int);
a14ed312
KB
360extern int historyLimit (void);
361extern void setHistoryLimit (int);
362extern void setGenWinOrigin (TuiGenWinInfoPtr, int, int);
363extern TuiGenWinInfoPtr locatorWinInfoPtr (void);
364extern TuiGenWinInfoPtr sourceExecInfoWinPtr (void);
365extern TuiGenWinInfoPtr disassemExecInfoWinPtr (void);
366extern char *nullStr (void);
367extern char *blankStr (void);
368extern char *locationStr (void);
369extern char *breakStr (void);
370extern char *breakLocationStr (void);
371extern TuiListPtr sourceWindows (void);
372extern void clearSourceWindows (void);
373extern void clearSourceWindowsDetail (void);
374extern void clearWinDetail (TuiWinInfoPtr winInfo);
375extern void tuiAddToSourceWindows (TuiWinInfoPtr);
376extern int tuiDefaultTabLen (void);
377extern void tuiSetDefaultTabLen (int);
378extern TuiWinInfoPtr tuiWinWithFocus (void);
379extern void tuiSetWinWithFocus (TuiWinInfoPtr);
380extern TuiLayoutDefPtr tuiLayoutDef (void);
381extern int tuiWinResized (void);
382extern void tuiSetWinResizedTo (int);
383
384extern TuiWinInfoPtr tuiNextWin (TuiWinInfoPtr);
385extern TuiWinInfoPtr tuiPrevWin (TuiWinInfoPtr);
c906108c 386
c7c228ed
SC
387extern void addToSourceWindows (TuiWinInfoPtr winInfo);
388
c906108c 389#endif /* TUI_DATA_H */
This page took 0.350774 seconds and 4 git commands to generate.