2004-02-06 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / tui / tui-winsource.c
CommitLineData
f377b406 1/* TUI display source/assembly window.
f33c6cbf 2
65f05602
AC
3 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
4 Foundation, Inc.
f33c6cbf 5
f377b406
SC
6 Contributed by Hewlett-Packard Company.
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
c906108c
SS
24
25#include "defs.h"
26#include <ctype.h>
27#include "symtab.h"
28#include "frame.h"
29#include "breakpoint.h"
fd0407d6 30#include "value.h"
52575520 31#include "source.h"
c906108c 32
d7b2e967
AC
33#include "tui/tui.h"
34#include "tui/tui-data.h"
35#include "tui/tui-stack.h"
36#include "tui/tui-win.h"
37#include "tui/tui-wingeneral.h"
38#include "tui/tui-winsource.h"
39#include "tui/tui-source.h"
40#include "tui/tui-disasm.h"
c906108c 41
96ec9981
DJ
42#ifdef HAVE_NCURSES_H
43#include <ncurses.h>
44#else
45#ifdef HAVE_CURSES_H
46#include <curses.h>
47#endif
48#endif
c906108c 49
1f393769 50/* Function to display the "main" routine. */
c906108c 51void
1f393769 52tui_display_main (void)
c906108c
SS
53{
54 if ((sourceWindows ())->count > 0)
55 {
56 CORE_ADDR addr;
57
65f05602 58 addr = tui_get_begin_asm_address ();
c774cec6 59 if (addr != (CORE_ADDR) 0)
c906108c
SS
60 {
61 struct symtab_and_line sal;
62
f80bda8e 63 tui_update_source_windows_with_addr (addr);
c906108c 64 sal = find_pc_line (addr, 0);
2e17b763 65 if (sal.symtab)
47d3492a 66 tui_update_locator_filename (sal.symtab->filename);
2e17b763 67 else
47d3492a 68 tui_update_locator_filename ("??");
c906108c
SS
69 }
70 }
2e17b763 71}
c906108c
SS
72
73
74
f80bda8e
AC
75/* Function to display source in the source window. This function
76 initializes the horizontal scroll to 0. */
c906108c 77void
f80bda8e
AC
78tui_update_source_window (TuiWinInfoPtr winInfo, struct symtab *s,
79 TuiLineOrAddress lineOrAddr, int noerror)
c906108c
SS
80{
81 winInfo->detail.sourceInfo.horizontalOffset = 0;
f80bda8e 82 tui_update_source_window_as_is (winInfo, s, lineOrAddr, noerror);
c906108c
SS
83
84 return;
f80bda8e 85}
c906108c
SS
86
87
f80bda8e
AC
88/* Function to display source in the source/asm window. This function
89 shows the source as specified by the horizontal offset. */
c906108c 90void
f80bda8e
AC
91tui_update_source_window_as_is (TuiWinInfoPtr winInfo, struct symtab *s,
92 TuiLineOrAddress lineOrAddr, int noerror)
c906108c
SS
93{
94 TuiStatus ret;
95
96 if (winInfo->generic.type == SRC_WIN)
a4b99e53 97 ret = tuiSetSourceContent (s, lineOrAddr.lineNo, noerror);
c906108c 98 else
65f05602 99 ret = tui_set_disassem_content (lineOrAddr.addr);
c906108c
SS
100
101 if (ret == TUI_FAILURE)
102 {
f80bda8e
AC
103 tui_clear_source_content (winInfo, EMPTY_SOURCE_PROMPT);
104 tui_clear_exec_info_content (winInfo);
c906108c
SS
105 }
106 else
107 {
00b2bad4 108 tui_update_breakpoint_info (winInfo, 0);
f80bda8e
AC
109 tui_show_source_content (winInfo);
110 tui_update_exec_info (winInfo);
c906108c
SS
111 if (winInfo->generic.type == SRC_WIN)
112 {
52575520
EZ
113 struct symtab_and_line sal;
114
115 sal.line = lineOrAddr.lineNo +
c906108c 116 (winInfo->generic.contentSize - 2);
52575520
EZ
117 sal.symtab = s;
118 set_current_source_symtab_and_line (&sal);
c906108c 119 /*
c5aa993b
JM
120 ** If the focus was in the asm win, put it in the src
121 ** win if we don't have a split layout
122 */
c906108c
SS
123 if (tuiWinWithFocus () == disassemWin &&
124 currentLayout () != SRC_DISASSEM_COMMAND)
125 tuiSetWinFocusTo (srcWin);
126 }
127 }
128
129
130 return;
f80bda8e 131}
c906108c
SS
132
133
f80bda8e
AC
134/* Function to ensure that the source and/or disassemly windows
135 reflect the input address. */
c906108c 136void
f80bda8e 137tui_update_source_windows_with_addr (CORE_ADDR addr)
c906108c 138{
c774cec6 139 if (addr != 0)
c906108c
SS
140 {
141 struct symtab_and_line sal;
a4b99e53
SC
142 TuiLineOrAddress l;
143
c906108c
SS
144 switch (currentLayout ())
145 {
146 case DISASSEM_COMMAND:
147 case DISASSEM_DATA_COMMAND:
65f05602 148 tui_show_disassem (addr);
c906108c
SS
149 break;
150 case SRC_DISASSEM_COMMAND:
65f05602 151 tui_show_disassem_and_update_source (addr);
c906108c
SS
152 break;
153 default:
c774cec6 154 sal = find_pc_line (addr, 0);
a4b99e53
SC
155 l.lineNo = sal.line;
156 tuiShowSource (sal.symtab, l, FALSE);
c906108c
SS
157 break;
158 }
159 }
160 else
161 {
162 int i;
163
164 for (i = 0; i < (sourceWindows ())->count; i++)
165 {
166 TuiWinInfoPtr winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
167
f80bda8e
AC
168 tui_clear_source_content (winInfo, EMPTY_SOURCE_PROMPT);
169 tui_clear_exec_info_content (winInfo);
c906108c
SS
170 }
171 }
172
173 return;
174} /* tuiUpdateSourceWindowsWithAddr */
175
f80bda8e
AC
176/* Function to ensure that the source and/or disassemly windows
177 reflect the input address. */
c906108c 178void
f80bda8e 179tui_update_source_windows_with_line (struct symtab *s, int line)
c906108c 180{
84b1e7c7 181 CORE_ADDR pc;
a4b99e53
SC
182 TuiLineOrAddress l;
183
c906108c
SS
184 switch (currentLayout ())
185 {
186 case DISASSEM_COMMAND:
187 case DISASSEM_DATA_COMMAND:
84b1e7c7 188 find_line_pc (s, line, &pc);
f80bda8e 189 tui_update_source_windows_with_addr (pc);
c906108c
SS
190 break;
191 default:
a4b99e53
SC
192 l.lineNo = line;
193 tuiShowSource (s, l, FALSE);
c906108c 194 if (currentLayout () == SRC_DISASSEM_COMMAND)
84b1e7c7
SC
195 {
196 find_line_pc (s, line, &pc);
65f05602 197 tui_show_disassem (pc);
84b1e7c7 198 }
c906108c
SS
199 break;
200 }
201
202 return;
f80bda8e 203}
c906108c 204
c906108c 205void
f80bda8e 206tui_clear_source_content (TuiWinInfoPtr winInfo, int displayPrompt)
c906108c
SS
207{
208 if (m_winPtrNotNull (winInfo))
209 {
210 register int i;
211
212 winInfo->generic.contentInUse = FALSE;
f80bda8e 213 tui_erase_source_content (winInfo, displayPrompt);
c906108c
SS
214 for (i = 0; i < winInfo->generic.contentSize; i++)
215 {
216 TuiWinElementPtr element =
217 (TuiWinElementPtr) winInfo->generic.content[i];
218 element->whichElement.source.hasBreak = FALSE;
219 element->whichElement.source.isExecPoint = FALSE;
220 }
221 }
222
223 return;
224} /* tuiClearSourceContent */
225
226
c906108c 227void
f80bda8e 228tui_erase_source_content (TuiWinInfoPtr winInfo, int displayPrompt)
c906108c
SS
229{
230 int xPos;
231 int halfWidth = (winInfo->generic.width - 2) / 2;
232
233 if (winInfo->generic.handle != (WINDOW *) NULL)
234 {
235 werase (winInfo->generic.handle);
ec7d9e56 236 tui_check_and_display_highlight_if_needed (winInfo);
c906108c
SS
237 if (displayPrompt == EMPTY_SOURCE_PROMPT)
238 {
239 char *noSrcStr;
240
241 if (winInfo->generic.type == SRC_WIN)
242 noSrcStr = NO_SRC_STRING;
243 else
244 noSrcStr = NO_DISASSEM_STRING;
245 if (strlen (noSrcStr) >= halfWidth)
246 xPos = 1;
247 else
248 xPos = halfWidth - strlen (noSrcStr);
249 mvwaddstr (winInfo->generic.handle,
250 (winInfo->generic.height / 2),
251 xPos,
252 noSrcStr);
253
254 /* elz: added this function call to set the real contents of
c5aa993b
JM
255 the window to what is on the screen, so that later calls
256 to refresh, do display
257 the correct stuff, and not the old image */
c906108c 258
f80bda8e 259 tui_set_source_content_nil (winInfo, noSrcStr);
c906108c 260 }
ec7d9e56 261 tui_refresh_win (&winInfo->generic);
c906108c
SS
262 }
263 return;
264} /* tuiEraseSourceContent */
265
266
bc712bbf
SC
267/* Redraw the complete line of a source or disassembly window. */
268static void
269tui_show_source_line (TuiWinInfoPtr winInfo, int lineno)
270{
271 TuiWinElementPtr line;
272 int x, y;
273
274 line = (TuiWinElementPtr) winInfo->generic.content[lineno - 1];
275 if (line->whichElement.source.isExecPoint)
276 wattron (winInfo->generic.handle, A_STANDOUT);
277
278 mvwaddstr (winInfo->generic.handle, lineno, 1,
279 line->whichElement.source.line);
280 if (line->whichElement.source.isExecPoint)
281 wattroff (winInfo->generic.handle, A_STANDOUT);
282
283 /* Clear to end of line but stop before the border. */
284 getyx (winInfo->generic.handle, y, x);
285 while (x + 1 < winInfo->generic.width)
286 {
287 waddch (winInfo->generic.handle, ' ');
288 getyx (winInfo->generic.handle, y, x);
289 }
290}
291
c906108c 292void
f80bda8e 293tui_show_source_content (TuiWinInfoPtr winInfo)
c906108c 294{
c906108c
SS
295 if (winInfo->generic.contentSize > 0)
296 {
bc712bbf
SC
297 int lineno;
298
299 for (lineno = 1; lineno <= winInfo->generic.contentSize; lineno++)
300 tui_show_source_line (winInfo, lineno);
c906108c 301 }
bc712bbf 302 else
f80bda8e 303 tui_erase_source_content (winInfo, TRUE);
bc712bbf 304
ec7d9e56
AC
305 tui_check_and_display_highlight_if_needed (winInfo);
306 tui_refresh_win (&winInfo->generic);
c906108c 307 winInfo->generic.contentInUse = TRUE;
bc712bbf 308}
c906108c
SS
309
310
f80bda8e 311/* Scroll the source forward or backward horizontally. */
c906108c 312void
f80bda8e
AC
313tui_horizontal_source_scroll (TuiWinInfoPtr winInfo,
314 TuiScrollDirection direction,
315 int numToScroll)
c906108c
SS
316{
317 if (winInfo->generic.content != (OpaquePtr) NULL)
318 {
319 int offset;
320 struct symtab *s;
52575520 321 struct symtab_and_line cursal = get_current_source_symtab_and_line ();
c906108c 322
52575520 323 if (cursal.symtab == (struct symtab *) NULL)
f70a7d61 324 s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
c906108c 325 else
52575520 326 s = cursal.symtab;
c906108c
SS
327
328 if (direction == LEFT_SCROLL)
329 offset = winInfo->detail.sourceInfo.horizontalOffset + numToScroll;
330 else
331 {
332 if ((offset =
333 winInfo->detail.sourceInfo.horizontalOffset - numToScroll) < 0)
334 offset = 0;
335 }
336 winInfo->detail.sourceInfo.horizontalOffset = offset;
f80bda8e
AC
337 tui_update_source_window_as_is (winInfo, s,
338 ((TuiWinElementPtr)
339 winInfo->generic.content[0])->whichElement.source.lineOrAddr,
340 FALSE);
c906108c
SS
341 }
342
343 return;
344} /* tuiHorizontalSourceScroll */
345
346
00b90ae2 347/* Set or clear the hasBreak flag in the line whose line is lineNo. */
c906108c 348void
f80bda8e 349tui_set_is_exec_point_at (TuiLineOrAddress l, TuiWinInfoPtr winInfo)
c906108c 350{
00b90ae2 351 int changed = 0;
c906108c
SS
352 int i;
353 TuiWinContent content = (TuiWinContent) winInfo->generic.content;
354
355 i = 0;
356 while (i < winInfo->generic.contentSize)
357 {
00b90ae2
SC
358 int newState;
359
a4b99e53 360 if (content[i]->whichElement.source.lineOrAddr.addr == l.addr)
00b90ae2 361 newState = TRUE;
c906108c 362 else
00b90ae2
SC
363 newState = FALSE;
364 if (newState != content[i]->whichElement.source.isExecPoint)
365 {
366 changed++;
367 content[i]->whichElement.source.isExecPoint = newState;
368 tui_show_source_line (winInfo, i + 1);
369 }
c906108c
SS
370 i++;
371 }
00b90ae2 372 if (changed)
ec7d9e56 373 tui_refresh_win (&winInfo->generic);
00b90ae2 374}
c906108c 375
00b2bad4
SC
376/* Update the execution windows to show the active breakpoints.
377 This is called whenever a breakpoint is inserted, removed or
378 has its state changed. */
c906108c 379void
00b2bad4 380tui_update_all_breakpoint_info ()
c906108c 381{
00b2bad4 382 TuiList* list = sourceWindows ();
c906108c 383 int i;
c906108c 384
00b2bad4 385 for (i = 0; i < list->count; i++)
c906108c 386 {
00b2bad4 387 TuiWinInfoPtr win = (TuiWinInfoPtr) list->list[i];
c906108c 388
00b2bad4
SC
389 if (tui_update_breakpoint_info (win, FALSE))
390 {
f80bda8e 391 tui_update_exec_info (win);
00b2bad4 392 }
c906108c 393 }
00b2bad4 394}
c906108c
SS
395
396
00b2bad4
SC
397/* Scan the source window and the breakpoints to update the
398 hasBreak information for each line.
399 Returns 1 if something changed and the execution window
400 must be refreshed. */
401int
402tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only)
c906108c
SS
403{
404 int i;
00b2bad4
SC
405 int need_refresh = 0;
406 TuiSourceInfoPtr src = &win->detail.sourceInfo;
c906108c 407
00b2bad4
SC
408 for (i = 0; i < win->generic.contentSize; i++)
409 {
410 struct breakpoint *bp;
411 extern struct breakpoint *breakpoint_chain;
412 int mode;
413 TuiSourceElement* line;
414
415 line = &((TuiWinElementPtr) win->generic.content[i])->whichElement.source;
416 if (current_only && !line->isExecPoint)
417 continue;
418
419 /* Scan each breakpoint to see if the current line has something to
420 do with it. Identify enable/disabled breakpoints as well as
421 those that we already hit. */
422 mode = 0;
423 for (bp = breakpoint_chain;
424 bp != (struct breakpoint *) NULL;
425 bp = bp->next)
426 {
427 if ((win == srcWin
428 && bp->source_file
429 && (strcmp (src->filename, bp->source_file) == 0)
430 && bp->line_number == line->lineOrAddr.lineNo)
431 || (win == disassemWin
cebe9500 432 && bp->loc->address == line->lineOrAddr.addr))
00b2bad4
SC
433 {
434 if (bp->enable_state == bp_disabled)
435 mode |= TUI_BP_DISABLED;
436 else
437 mode |= TUI_BP_ENABLED;
438 if (bp->hit_count)
439 mode |= TUI_BP_HIT;
440 if (bp->cond)
441 mode |= TUI_BP_CONDITIONAL;
442 if (bp->type == bp_hardware_breakpoint)
443 mode |= TUI_BP_HARDWARE;
444 }
445 }
446 if (line->hasBreak != mode)
447 {
448 line->hasBreak = mode;
449 need_refresh = 1;
450 }
451 }
452 return need_refresh;
453}
c906108c 454
c906108c
SS
455
456/*
c5aa993b
JM
457 ** tuiSetExecInfoContent().
458 ** Function to initialize the content of the execution info window,
459 ** based upon the input window which is either the source or
460 ** disassembly window.
461 */
c906108c 462TuiStatus
eca6576c 463tuiSetExecInfoContent (TuiWinInfoPtr winInfo)
c906108c
SS
464{
465 TuiStatus ret = TUI_SUCCESS;
466
467 if (winInfo->detail.sourceInfo.executionInfo != (TuiGenWinInfoPtr) NULL)
468 {
469 TuiGenWinInfoPtr execInfoPtr = winInfo->detail.sourceInfo.executionInfo;
470
471 if (execInfoPtr->content == (OpaquePtr) NULL)
472 execInfoPtr->content =
473 (OpaquePtr) allocContent (winInfo->generic.height,
474 execInfoPtr->type);
475 if (execInfoPtr->content != (OpaquePtr) NULL)
476 {
477 int i;
478
00b2bad4 479 tui_update_breakpoint_info (winInfo, 1);
c906108c
SS
480 for (i = 0; i < winInfo->generic.contentSize; i++)
481 {
482 TuiWinElementPtr element;
483 TuiWinElementPtr srcElement;
00b2bad4 484 int mode;
c906108c
SS
485
486 element = (TuiWinElementPtr) execInfoPtr->content[i];
487 srcElement = (TuiWinElementPtr) winInfo->generic.content[i];
00b2bad4
SC
488
489 memset(element->whichElement.simpleString, ' ',
490 sizeof(element->whichElement.simpleString));
491 element->whichElement.simpleString[TUI_EXECINFO_SIZE - 1] = 0;
492
493 /* Now update the exec info content based upon the state
494 of each line as indicated by the source content. */
495 mode = srcElement->whichElement.source.hasBreak;
496 if (mode & TUI_BP_HIT)
497 element->whichElement.simpleString[TUI_BP_HIT_POS] =
498 (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
499 else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
500 element->whichElement.simpleString[TUI_BP_HIT_POS] =
501 (mode & TUI_BP_HARDWARE) ? 'h' : 'b';
502
503 if (mode & TUI_BP_ENABLED)
504 element->whichElement.simpleString[TUI_BP_BREAK_POS] = '+';
505 else if (mode & TUI_BP_DISABLED)
506 element->whichElement.simpleString[TUI_BP_BREAK_POS] = '-';
507
508 if (srcElement->whichElement.source.isExecPoint)
509 element->whichElement.simpleString[TUI_EXEC_POS] = '>';
c906108c
SS
510 }
511 execInfoPtr->contentSize = winInfo->generic.contentSize;
512 }
513 else
514 ret = TUI_FAILURE;
515 }
516
517 return ret;
00b2bad4 518}
c906108c
SS
519
520
521/*
c5aa993b
JM
522 ** tuiShowExecInfoContent().
523 */
c906108c 524void
eca6576c 525tuiShowExecInfoContent (TuiWinInfoPtr winInfo)
c906108c
SS
526{
527 TuiGenWinInfoPtr execInfo = winInfo->detail.sourceInfo.executionInfo;
528 int curLine;
529
530 werase (execInfo->handle);
ec7d9e56 531 tui_refresh_win (execInfo);
c906108c
SS
532 for (curLine = 1; (curLine <= execInfo->contentSize); curLine++)
533 mvwaddstr (execInfo->handle,
534 curLine,
535 0,
536 ((TuiWinElementPtr)
537 execInfo->content[curLine - 1])->whichElement.simpleString);
ec7d9e56 538 tui_refresh_win (execInfo);
c906108c
SS
539 execInfo->contentInUse = TRUE;
540
541 return;
f80bda8e 542}
c906108c
SS
543
544
c906108c 545void
f80bda8e 546tui_erase_exec_info_content (TuiWinInfoPtr winInfo)
c906108c
SS
547{
548 TuiGenWinInfoPtr execInfo = winInfo->detail.sourceInfo.executionInfo;
549
550 werase (execInfo->handle);
ec7d9e56 551 tui_refresh_win (execInfo);
c906108c
SS
552
553 return;
f80bda8e 554}
c906108c 555
c906108c 556void
f80bda8e 557tui_clear_exec_info_content (TuiWinInfoPtr winInfo)
c906108c
SS
558{
559 winInfo->detail.sourceInfo.executionInfo->contentInUse = FALSE;
f80bda8e 560 tui_erase_exec_info_content (winInfo);
c906108c
SS
561
562 return;
f80bda8e 563}
c906108c 564
f80bda8e 565/* Function to update the execution info window. */
c906108c 566void
f80bda8e 567tui_update_exec_info (TuiWinInfoPtr winInfo)
c906108c
SS
568{
569 tuiSetExecInfoContent (winInfo);
570 tuiShowExecInfoContent (winInfo);
19eb139b 571} /* tuiUpdateExecInfo */
c906108c 572
f80bda8e
AC
573enum tui_status
574tui_alloc_source_buffer (struct tui_win_info *winInfo)
c906108c 575{
335fc5a3
SC
576 register char *srcLineBuf;
577 register int i, lineWidth, maxLines;
c906108c
SS
578 TuiStatus ret = TUI_FAILURE;
579
580 maxLines = winInfo->generic.height; /* less the highlight box */
581 lineWidth = winInfo->generic.width - 1;
582 /*
c5aa993b
JM
583 ** Allocate the buffer for the source lines. Do this only once since they
584 ** will be re-used for all source displays. The only other time this will
585 ** be done is when a window's size changes.
586 */
c906108c
SS
587 if (winInfo->generic.content == (OpaquePtr) NULL)
588 {
589 srcLineBuf = (char *) xmalloc ((maxLines * lineWidth) * sizeof (char));
590 if (srcLineBuf == (char *) NULL)
591 fputs_unfiltered (
592 "Unable to Allocate Memory for Source or Disassembly Display.\n",
593 gdb_stderr);
594 else
595 {
596 /* allocate the content list */
597 if ((winInfo->generic.content =
598 (OpaquePtr) allocContent (maxLines, SRC_WIN)) == (OpaquePtr) NULL)
599 {
600 tuiFree (srcLineBuf);
601 srcLineBuf = (char *) NULL;
602 fputs_unfiltered (
603 "Unable to Allocate Memory for Source or Disassembly Display.\n",
604 gdb_stderr);
605 }
606 }
607 for (i = 0; i < maxLines; i++)
608 ((TuiWinElementPtr)
609 winInfo->generic.content[i])->whichElement.source.line =
610 srcLineBuf + (lineWidth * i);
611 ret = TUI_SUCCESS;
612 }
613 else
614 ret = TUI_SUCCESS;
615
616 return ret;
617} /* tuiAllocSourceBuffer */
618
619
f80bda8e
AC
620/* Answer whether the a particular line number or address is displayed
621 in the current source window. */
c906108c 622int
f80bda8e
AC
623tui_line_is_displayed (int line, TuiWinInfoPtr winInfo,
624 int checkThreshold)
c906108c
SS
625{
626 int isDisplayed = FALSE;
627 int i, threshold;
628
629 if (checkThreshold)
630 threshold = SCROLL_THRESHOLD;
631 else
632 threshold = 0;
633 i = 0;
634 while (i < winInfo->generic.contentSize - threshold && !isDisplayed)
635 {
a4b99e53
SC
636 isDisplayed = (((TuiWinElementPtr)
637 winInfo->generic.content[i])->whichElement.source.lineOrAddr.lineNo
638 == (int) line);
c906108c
SS
639 i++;
640 }
641
642 return isDisplayed;
f80bda8e 643}
c906108c
SS
644
645
f80bda8e
AC
646/* Answer whether the a particular line number or address is displayed
647 in the current source window. */
a4b99e53 648int
f80bda8e 649tui_addr_is_displayed (CORE_ADDR addr, TuiWinInfoPtr winInfo,
a4b99e53
SC
650 int checkThreshold)
651{
652 int isDisplayed = FALSE;
653 int i, threshold;
654
655 if (checkThreshold)
656 threshold = SCROLL_THRESHOLD;
657 else
658 threshold = 0;
659 i = 0;
660 while (i < winInfo->generic.contentSize - threshold && !isDisplayed)
661 {
662 isDisplayed = (((TuiWinElementPtr)
663 winInfo->generic.content[i])->whichElement.source.lineOrAddr.addr
664 == addr);
665 i++;
666 }
667
668 return isDisplayed;
669}
670
671
c906108c
SS
672/*****************************************
673** STATIC LOCAL FUNCTIONS **
674******************************************/
This page took 0.420824 seconds and 4 git commands to generate.