* tuiSourceWin.h (tui_update_all_breakpoint_info): Declare.

(tui_update_breakpoint_info): Declare.
	(tuiSetHasBreakAt, tuiAllSetHasBreakAt): Remove.

	* tuiSourceWin.c (tuiUpdateSourceWindowAsIs): Update breakpoint
	information using tui_update_breakpoint_info.
	(tui_update_all_breakpoint_info): New function to refresh all
	execution windows.
	(tui_update_breakpoint_info): New function to recompute the status
	of exec info window from breakpoints.
	(tuiSetHasBreakAt, tuiAllSetHasBreakAt): Remove.
	(tuiSetExecInfoContent): Use the exec info flags computed by
	tui_update_breakpoint_info to display a short status about breakpoints.

	* tuiData.h (TuiExecInfoContent): New for exec info string.
	(TuiWhichElement): Use it.
	(TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT): New defines.
	(TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): New defines.
	(TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS): Likewise.
	(TUI_EXECINFO_SIZE): Likewise.
	* tuiData.c (initContentElement): Clear exec info string.

	* tui-hooks.c (get_breakpoint): Remove.
	(tui_event_create_breakpoint): Call tui_update_all_breakpoint_info.
	(tui_event_delete_breakpoint): Likewise.
	(tui_event_modify_breakpoint): Likewise.
This commit is contained in:
Stephane Carrez 2002-08-30 20:07:05 +00:00
parent e5b45b8395
commit 00b2bad465
6 changed files with 149 additions and 151 deletions

View File

@ -1,3 +1,32 @@
2002-08-30 Stephane Carrez <stcarrez@nerim.fr>
* tuiSourceWin.h (tui_update_all_breakpoint_info): Declare.
(tui_update_breakpoint_info): Declare.
(tuiSetHasBreakAt, tuiAllSetHasBreakAt): Remove.
* tuiSourceWin.c (tuiUpdateSourceWindowAsIs): Update breakpoint
information using tui_update_breakpoint_info.
(tui_update_all_breakpoint_info): New function to refresh all
execution windows.
(tui_update_breakpoint_info): New function to recompute the status
of exec info window from breakpoints.
(tuiSetHasBreakAt, tuiAllSetHasBreakAt): Remove.
(tuiSetExecInfoContent): Use the exec info flags computed by
tui_update_breakpoint_info to display a short status about breakpoints.
* tuiData.h (TuiExecInfoContent): New for exec info string.
(TuiWhichElement): Use it.
(TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT): New defines.
(TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): New defines.
(TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS): Likewise.
(TUI_EXECINFO_SIZE): Likewise.
* tuiData.c (initContentElement): Clear exec info string.
* tui-hooks.c (get_breakpoint): Remove.
(tui_event_create_breakpoint): Call tui_update_all_breakpoint_info.
(tui_event_delete_breakpoint): Likewise.
(tui_event_modify_breakpoint): Likewise.
2002-08-29 Stephane Carrez <stcarrez@nerim.fr>
* tui.c (tuiGetLowDisassemblyAddress): Moved from here.

View File

@ -167,44 +167,12 @@ tui_register_changed_hook (int regno)
}
}
extern struct breakpoint *breakpoint_chain;
/* Find a breakpoint given its number. Returns null if not found. */
static struct breakpoint *
get_breakpoint (int number)
{
struct breakpoint *bp;
for (bp = breakpoint_chain; bp; bp = bp->next)
{
if (bp->number == number)
return bp;
}
return 0;
}
/* Breakpoint creation hook.
Update the screen to show the new breakpoint. */
static void
tui_event_create_breakpoint (int number)
{
struct breakpoint *bp;
bp = get_breakpoint (number);
if (bp)
{
switch (bp->type)
{
case bp_breakpoint:
case bp_hardware_breakpoint:
tuiAllSetHasBreakAt (bp, 1);
tuiUpdateAllExecInfos ();
break;
default:
break;
}
}
tui_update_all_breakpoint_info ();
}
/* Breakpoint deletion hook.
@ -212,35 +180,13 @@ tui_event_create_breakpoint (int number)
static void
tui_event_delete_breakpoint (int number)
{
struct breakpoint *bp;
struct breakpoint *b;
int clearIt;
bp = get_breakpoint (number);
if (bp == 0)
return;
/* Before turning off the visuals for the bp, check to see that
there are no other bps at the same address. */
clearIt = 0;
for (b = breakpoint_chain; b; b = b->next)
{
clearIt = (b == bp || b->address != bp->address);
if (!clearIt)
break;
}
if (clearIt)
{
tuiAllSetHasBreakAt (bp, 0);
tuiUpdateAllExecInfos ();
}
tui_update_all_breakpoint_info ();
}
static void
tui_event_modify_breakpoint (int number)
{
;
tui_update_all_breakpoint_info ();
}
static void

View File

@ -888,7 +888,8 @@ initContentElement (TuiWinElementPtr element, TuiWinType type)
element->whichElement.locator.addr = 0;
break;
case EXEC_INFO_WIN:
element->whichElement.simpleString = blankStr ();
memset(element->whichElement.simpleString, ' ',
sizeof(element->whichElement.simpleString));
break;
default:
break;

View File

@ -200,6 +200,20 @@ typedef struct _TuiLocatorElement
}
TuiLocatorElement, *TuiLocatorElementPtr;
/* Flags to tell what kind of breakpoint is at current line. */
#define TUI_BP_ENABLED 0x01
#define TUI_BP_DISABLED 0x02
#define TUI_BP_HIT 0x04
#define TUI_BP_CONDITIONAL 0x08
#define TUI_BP_HARDWARE 0x10
/* Position of breakpoint markers in the exec info string. */
#define TUI_BP_HIT_POS 0
#define TUI_BP_BREAK_POS 1
#define TUI_EXEC_POS 2
#define TUI_EXECINFO_SIZE 4
typedef char TuiExecInfoContent[TUI_EXECINFO_SIZE];
/* An content element in a window */
typedef union
@ -209,7 +223,7 @@ typedef union
TuiDataElement data; /* elements of dataWindow */
TuiCommandElement command; /* command elements */
TuiLocatorElement locator; /* locator elements */
char *simpleString; /* simple char based elements */
TuiExecInfoContent simpleString; /* simple char based elements */
}
TuiWhichElement, *TuiWhichElementPtr;

View File

@ -120,7 +120,7 @@ tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s,
}
else
{
tuiEraseSourceContent (winInfo, NO_EMPTY_SOURCE_PROMPT);
tui_update_breakpoint_info (winInfo, 0);
tuiShowSourceContent (winInfo);
tuiUpdateExecInfo (winInfo);
if (winInfo->generic.type == SRC_WIN)
@ -398,67 +398,85 @@ tuiSetIsExecPointAt (TuiLineOrAddress l, TuiWinInfoPtr winInfo)
return;
} /* tuiSetIsExecPointAt */
/*
** tuiSetHasBreakAt().
** Set or clear the hasBreak flag in the line whose line is lineNo.
*/
/* Update the execution windows to show the active breakpoints.
This is called whenever a breakpoint is inserted, removed or
has its state changed. */
void
tuiSetHasBreakAt (struct breakpoint *bp, TuiWinInfoPtr winInfo, int hasBreak)
tui_update_all_breakpoint_info ()
{
TuiList* list = sourceWindows ();
int i;
TuiWinContent content = (TuiWinContent) winInfo->generic.content;
i = 0;
while (i < winInfo->generic.contentSize)
for (i = 0; i < list->count; i++)
{
int gotIt;
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
TuiWinInfoPtr win = (TuiWinInfoPtr) list->list[i];
if (winInfo == srcWin)
{
TuiSourceInfoPtr src = &winInfo->detail.sourceInfo;
gotIt = (src->filename != (char *) NULL &&
bp->source_file != NULL &&
(strcmp (bp->source_file, src->filename) == 0) &&
content[i]->whichElement.source.lineOrAddr.lineNo ==
bp->line_number);
}
else
gotIt = (content[i]->whichElement.source.lineOrAddr.addr
== bp->address);
if (gotIt)
{
content[i]->whichElement.source.hasBreak = hasBreak;
break;
}
i++;
if (tui_update_breakpoint_info (win, FALSE))
{
tuiUpdateExecInfo (win);
}
}
return;
} /* tuiSetHasBreakAt */
}
/*
** tuiAllSetHasBreakAt().
** Set or clear the hasBreak flag in all displayed source windows.
*/
void
tuiAllSetHasBreakAt (struct breakpoint *bp, int hasBreak)
/* Scan the source window and the breakpoints to update the
hasBreak information for each line.
Returns 1 if something changed and the execution window
must be refreshed. */
int
tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only)
{
int i;
int need_refresh = 0;
TuiSourceInfoPtr src = &win->detail.sourceInfo;
for (i = 0; i < (sourceWindows ())->count; i++)
tuiSetHasBreakAt (bp,
(TuiWinInfoPtr) (sourceWindows ())->list[i], hasBreak);
for (i = 0; i < win->generic.contentSize; i++)
{
struct breakpoint *bp;
extern struct breakpoint *breakpoint_chain;
int mode;
TuiSourceElement* line;
return;
} /* tuiAllSetHasBreakAt */
line = &((TuiWinElementPtr) win->generic.content[i])->whichElement.source;
if (current_only && !line->isExecPoint)
continue;
/* Scan each breakpoint to see if the current line has something to
do with it. Identify enable/disabled breakpoints as well as
those that we already hit. */
mode = 0;
for (bp = breakpoint_chain;
bp != (struct breakpoint *) NULL;
bp = bp->next)
{
if ((win == srcWin
&& bp->source_file
&& (strcmp (src->filename, bp->source_file) == 0)
&& bp->line_number == line->lineOrAddr.lineNo)
|| (win == disassemWin
&& bp->address == line->lineOrAddr.addr))
{
if (bp->enable_state == bp_disabled)
mode |= TUI_BP_DISABLED;
else
mode |= TUI_BP_ENABLED;
if (bp->hit_count)
mode |= TUI_BP_HIT;
if (bp->cond)
mode |= TUI_BP_CONDITIONAL;
if (bp->type == bp_hardware_breakpoint)
mode |= TUI_BP_HARDWARE;
}
}
if (line->hasBreak != mode)
{
line->hasBreak = mode;
need_refresh = 1;
}
}
return need_refresh;
}
/*********************************
** EXECUTION INFO FUNCTIONS **
*********************************/
/*
** tuiSetExecInfoContent().
@ -483,56 +501,37 @@ tuiSetExecInfoContent (TuiWinInfoPtr winInfo)
{
int i;
tui_update_breakpoint_info (winInfo, 1);
for (i = 0; i < winInfo->generic.contentSize; i++)
{
TuiWinElementPtr element;
TuiWinElementPtr srcElement;
int mode;
element = (TuiWinElementPtr) execInfoPtr->content[i];
srcElement = (TuiWinElementPtr) winInfo->generic.content[i];
/*
** First check to see if we have a breakpoint that is
** temporary. If so, and this is our current execution point,
** then clear the break indicator.
*/
if (srcElement->whichElement.source.hasBreak &&
srcElement->whichElement.source.isExecPoint)
{
struct breakpoint *bp;
int found = FALSE;
extern struct breakpoint *breakpoint_chain;
for (bp = breakpoint_chain;
(bp != (struct breakpoint *) NULL && !found);
bp = bp->next)
{
found =
(winInfo == srcWin &&
bp->line_number ==
srcElement->whichElement.source.lineOrAddr.lineNo) ||
(winInfo == disassemWin &&
bp->address == (CORE_ADDR)
srcElement->whichElement.source.lineOrAddr.addr);
if (found)
srcElement->whichElement.source.hasBreak =
(bp->disposition != disp_del || bp->hit_count <= 0);
}
if (!found)
srcElement->whichElement.source.hasBreak = FALSE;
}
/*
** Now update the exec info content based upon the state
** of each line as indicated by the source content.
*/
if (srcElement->whichElement.source.hasBreak &&
srcElement->whichElement.source.isExecPoint)
element->whichElement.simpleString = breakLocationStr ();
else if (srcElement->whichElement.source.hasBreak)
element->whichElement.simpleString = breakStr ();
else if (srcElement->whichElement.source.isExecPoint)
element->whichElement.simpleString = locationStr ();
else
element->whichElement.simpleString = blankStr ();
memset(element->whichElement.simpleString, ' ',
sizeof(element->whichElement.simpleString));
element->whichElement.simpleString[TUI_EXECINFO_SIZE - 1] = 0;
/* Now update the exec info content based upon the state
of each line as indicated by the source content. */
mode = srcElement->whichElement.source.hasBreak;
if (mode & TUI_BP_HIT)
element->whichElement.simpleString[TUI_BP_HIT_POS] =
(mode & TUI_BP_HARDWARE) ? 'H' : 'B';
else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
element->whichElement.simpleString[TUI_BP_HIT_POS] =
(mode & TUI_BP_HARDWARE) ? 'h' : 'b';
if (mode & TUI_BP_ENABLED)
element->whichElement.simpleString[TUI_BP_BREAK_POS] = '+';
else if (mode & TUI_BP_DISABLED)
element->whichElement.simpleString[TUI_BP_BREAK_POS] = '-';
if (srcElement->whichElement.source.isExecPoint)
element->whichElement.simpleString[TUI_EXEC_POS] = '>';
}
execInfoPtr->contentSize = winInfo->generic.contentSize;
}
@ -541,7 +540,7 @@ tuiSetExecInfoContent (TuiWinInfoPtr winInfo)
}
return ret;
} /* tuiSetExecInfoContent */
}
/*

View File

@ -22,6 +22,17 @@
#ifndef _TUI_SOURCEWIN_H
#define _TUI_SOURCEWIN_H
/* Update the execution windows to show the active breakpoints.
This is called whenever a breakpoint is inserted, removed or
has its state changed. */
extern void tui_update_all_breakpoint_info (void);
/* Scan the source window and the breakpoints to update the
hasBreak information for each line.
Returns 1 if something changed and the execution window
must be refreshed. */
extern int tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only);
/* Function to display the "main" routine. */
extern void tui_display_main (void);
extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress,
@ -47,8 +58,6 @@ extern void tuiUpdateExecInfo (TuiWinInfoPtr);
extern void tuiUpdateAllExecInfos (void);
extern void tuiSetIsExecPointAt (TuiLineOrAddress, TuiWinInfoPtr);
extern void tuiSetHasBreakAt (struct breakpoint *, TuiWinInfoPtr, int);
extern void tuiAllSetHasBreakAt (struct breakpoint *, int);
extern TuiStatus tuiAllocSourceBuffer (TuiWinInfoPtr);
extern int tuiLineIsDisplayed (int, TuiWinInfoPtr, int);
extern int tuiAddrIsDisplayed (CORE_ADDR, TuiWinInfoPtr, int);