* 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:
parent
e5b45b8395
commit
00b2bad465
|
@ -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>
|
2002-08-29 Stephane Carrez <stcarrez@nerim.fr>
|
||||||
|
|
||||||
* tui.c (tuiGetLowDisassemblyAddress): Moved from here.
|
* tui.c (tuiGetLowDisassemblyAddress): Moved from here.
|
||||||
|
|
|
@ -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.
|
/* Breakpoint creation hook.
|
||||||
Update the screen to show the new breakpoint. */
|
Update the screen to show the new breakpoint. */
|
||||||
static void
|
static void
|
||||||
tui_event_create_breakpoint (int number)
|
tui_event_create_breakpoint (int number)
|
||||||
{
|
{
|
||||||
struct breakpoint *bp;
|
tui_update_all_breakpoint_info ();
|
||||||
|
|
||||||
bp = get_breakpoint (number);
|
|
||||||
if (bp)
|
|
||||||
{
|
|
||||||
switch (bp->type)
|
|
||||||
{
|
|
||||||
case bp_breakpoint:
|
|
||||||
case bp_hardware_breakpoint:
|
|
||||||
tuiAllSetHasBreakAt (bp, 1);
|
|
||||||
tuiUpdateAllExecInfos ();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Breakpoint deletion hook.
|
/* Breakpoint deletion hook.
|
||||||
|
@ -212,35 +180,13 @@ tui_event_create_breakpoint (int number)
|
||||||
static void
|
static void
|
||||||
tui_event_delete_breakpoint (int number)
|
tui_event_delete_breakpoint (int number)
|
||||||
{
|
{
|
||||||
struct breakpoint *bp;
|
tui_update_all_breakpoint_info ();
|
||||||
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 ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tui_event_modify_breakpoint (int number)
|
tui_event_modify_breakpoint (int number)
|
||||||
{
|
{
|
||||||
;
|
tui_update_all_breakpoint_info ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -888,7 +888,8 @@ initContentElement (TuiWinElementPtr element, TuiWinType type)
|
||||||
element->whichElement.locator.addr = 0;
|
element->whichElement.locator.addr = 0;
|
||||||
break;
|
break;
|
||||||
case EXEC_INFO_WIN:
|
case EXEC_INFO_WIN:
|
||||||
element->whichElement.simpleString = blankStr ();
|
memset(element->whichElement.simpleString, ' ',
|
||||||
|
sizeof(element->whichElement.simpleString));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -200,6 +200,20 @@ typedef struct _TuiLocatorElement
|
||||||
}
|
}
|
||||||
TuiLocatorElement, *TuiLocatorElementPtr;
|
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 */
|
/* An content element in a window */
|
||||||
typedef union
|
typedef union
|
||||||
|
@ -209,7 +223,7 @@ typedef union
|
||||||
TuiDataElement data; /* elements of dataWindow */
|
TuiDataElement data; /* elements of dataWindow */
|
||||||
TuiCommandElement command; /* command elements */
|
TuiCommandElement command; /* command elements */
|
||||||
TuiLocatorElement locator; /* locator elements */
|
TuiLocatorElement locator; /* locator elements */
|
||||||
char *simpleString; /* simple char based elements */
|
TuiExecInfoContent simpleString; /* simple char based elements */
|
||||||
}
|
}
|
||||||
TuiWhichElement, *TuiWhichElementPtr;
|
TuiWhichElement, *TuiWhichElementPtr;
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tuiEraseSourceContent (winInfo, NO_EMPTY_SOURCE_PROMPT);
|
tui_update_breakpoint_info (winInfo, 0);
|
||||||
tuiShowSourceContent (winInfo);
|
tuiShowSourceContent (winInfo);
|
||||||
tuiUpdateExecInfo (winInfo);
|
tuiUpdateExecInfo (winInfo);
|
||||||
if (winInfo->generic.type == SRC_WIN)
|
if (winInfo->generic.type == SRC_WIN)
|
||||||
|
@ -398,67 +398,85 @@ tuiSetIsExecPointAt (TuiLineOrAddress l, TuiWinInfoPtr winInfo)
|
||||||
return;
|
return;
|
||||||
} /* tuiSetIsExecPointAt */
|
} /* tuiSetIsExecPointAt */
|
||||||
|
|
||||||
/*
|
/* Update the execution windows to show the active breakpoints.
|
||||||
** tuiSetHasBreakAt().
|
This is called whenever a breakpoint is inserted, removed or
|
||||||
** Set or clear the hasBreak flag in the line whose line is lineNo.
|
has its state changed. */
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
tuiSetHasBreakAt (struct breakpoint *bp, TuiWinInfoPtr winInfo, int hasBreak)
|
tui_update_all_breakpoint_info ()
|
||||||
|
{
|
||||||
|
TuiList* list = sourceWindows ();
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < list->count; i++)
|
||||||
|
{
|
||||||
|
TuiWinInfoPtr win = (TuiWinInfoPtr) list->list[i];
|
||||||
|
|
||||||
|
if (tui_update_breakpoint_info (win, FALSE))
|
||||||
|
{
|
||||||
|
tuiUpdateExecInfo (win);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 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 i;
|
||||||
TuiWinContent content = (TuiWinContent) winInfo->generic.content;
|
int need_refresh = 0;
|
||||||
|
TuiSourceInfoPtr src = &win->detail.sourceInfo;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < win->generic.contentSize; i++)
|
||||||
while (i < winInfo->generic.contentSize)
|
|
||||||
{
|
{
|
||||||
int gotIt;
|
struct breakpoint *bp;
|
||||||
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
|
extern struct breakpoint *breakpoint_chain;
|
||||||
|
int mode;
|
||||||
|
TuiSourceElement* line;
|
||||||
|
|
||||||
if (winInfo == srcWin)
|
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)
|
||||||
{
|
{
|
||||||
TuiSourceInfoPtr src = &winInfo->detail.sourceInfo;
|
if ((win == srcWin
|
||||||
|
&& bp->source_file
|
||||||
gotIt = (src->filename != (char *) NULL &&
|
&& (strcmp (src->filename, bp->source_file) == 0)
|
||||||
bp->source_file != NULL &&
|
&& bp->line_number == line->lineOrAddr.lineNo)
|
||||||
(strcmp (bp->source_file, src->filename) == 0) &&
|
|| (win == disassemWin
|
||||||
content[i]->whichElement.source.lineOrAddr.lineNo ==
|
&& bp->address == line->lineOrAddr.addr))
|
||||||
bp->line_number);
|
{
|
||||||
}
|
if (bp->enable_state == bp_disabled)
|
||||||
|
mode |= TUI_BP_DISABLED;
|
||||||
else
|
else
|
||||||
gotIt = (content[i]->whichElement.source.lineOrAddr.addr
|
mode |= TUI_BP_ENABLED;
|
||||||
== bp->address);
|
if (bp->hit_count)
|
||||||
if (gotIt)
|
mode |= TUI_BP_HIT;
|
||||||
{
|
if (bp->cond)
|
||||||
content[i]->whichElement.source.hasBreak = hasBreak;
|
mode |= TUI_BP_CONDITIONAL;
|
||||||
break;
|
if (bp->type == bp_hardware_breakpoint)
|
||||||
|
mode |= TUI_BP_HARDWARE;
|
||||||
}
|
}
|
||||||
i++;
|
}
|
||||||
|
if (line->hasBreak != mode)
|
||||||
|
{
|
||||||
|
line->hasBreak = mode;
|
||||||
|
need_refresh = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return need_refresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
} /* tuiSetHasBreakAt */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** tuiAllSetHasBreakAt().
|
|
||||||
** Set or clear the hasBreak flag in all displayed source windows.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
tuiAllSetHasBreakAt (struct breakpoint *bp, int hasBreak)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < (sourceWindows ())->count; i++)
|
|
||||||
tuiSetHasBreakAt (bp,
|
|
||||||
(TuiWinInfoPtr) (sourceWindows ())->list[i], hasBreak);
|
|
||||||
|
|
||||||
return;
|
|
||||||
} /* tuiAllSetHasBreakAt */
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************
|
|
||||||
** EXECUTION INFO FUNCTIONS **
|
|
||||||
*********************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** tuiSetExecInfoContent().
|
** tuiSetExecInfoContent().
|
||||||
|
@ -483,56 +501,37 @@ tuiSetExecInfoContent (TuiWinInfoPtr winInfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
tui_update_breakpoint_info (winInfo, 1);
|
||||||
for (i = 0; i < winInfo->generic.contentSize; i++)
|
for (i = 0; i < winInfo->generic.contentSize; i++)
|
||||||
{
|
{
|
||||||
TuiWinElementPtr element;
|
TuiWinElementPtr element;
|
||||||
TuiWinElementPtr srcElement;
|
TuiWinElementPtr srcElement;
|
||||||
|
int mode;
|
||||||
|
|
||||||
element = (TuiWinElementPtr) execInfoPtr->content[i];
|
element = (TuiWinElementPtr) execInfoPtr->content[i];
|
||||||
srcElement = (TuiWinElementPtr) winInfo->generic.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;
|
memset(element->whichElement.simpleString, ' ',
|
||||||
(bp != (struct breakpoint *) NULL && !found);
|
sizeof(element->whichElement.simpleString));
|
||||||
bp = bp->next)
|
element->whichElement.simpleString[TUI_EXECINFO_SIZE - 1] = 0;
|
||||||
{
|
|
||||||
found =
|
/* Now update the exec info content based upon the state
|
||||||
(winInfo == srcWin &&
|
of each line as indicated by the source content. */
|
||||||
bp->line_number ==
|
mode = srcElement->whichElement.source.hasBreak;
|
||||||
srcElement->whichElement.source.lineOrAddr.lineNo) ||
|
if (mode & TUI_BP_HIT)
|
||||||
(winInfo == disassemWin &&
|
element->whichElement.simpleString[TUI_BP_HIT_POS] =
|
||||||
bp->address == (CORE_ADDR)
|
(mode & TUI_BP_HARDWARE) ? 'H' : 'B';
|
||||||
srcElement->whichElement.source.lineOrAddr.addr);
|
else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
|
||||||
if (found)
|
element->whichElement.simpleString[TUI_BP_HIT_POS] =
|
||||||
srcElement->whichElement.source.hasBreak =
|
(mode & TUI_BP_HARDWARE) ? 'h' : 'b';
|
||||||
(bp->disposition != disp_del || bp->hit_count <= 0);
|
|
||||||
}
|
if (mode & TUI_BP_ENABLED)
|
||||||
if (!found)
|
element->whichElement.simpleString[TUI_BP_BREAK_POS] = '+';
|
||||||
srcElement->whichElement.source.hasBreak = FALSE;
|
else if (mode & TUI_BP_DISABLED)
|
||||||
}
|
element->whichElement.simpleString[TUI_BP_BREAK_POS] = '-';
|
||||||
/*
|
|
||||||
** Now update the exec info content based upon the state
|
if (srcElement->whichElement.source.isExecPoint)
|
||||||
** of each line as indicated by the source content.
|
element->whichElement.simpleString[TUI_EXEC_POS] = '>';
|
||||||
*/
|
|
||||||
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 ();
|
|
||||||
}
|
}
|
||||||
execInfoPtr->contentSize = winInfo->generic.contentSize;
|
execInfoPtr->contentSize = winInfo->generic.contentSize;
|
||||||
}
|
}
|
||||||
|
@ -541,7 +540,7 @@ tuiSetExecInfoContent (TuiWinInfoPtr winInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} /* tuiSetExecInfoContent */
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -22,6 +22,17 @@
|
||||||
#ifndef _TUI_SOURCEWIN_H
|
#ifndef _TUI_SOURCEWIN_H
|
||||||
#define _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. */
|
/* Function to display the "main" routine. */
|
||||||
extern void tui_display_main (void);
|
extern void tui_display_main (void);
|
||||||
extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress,
|
extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress,
|
||||||
|
@ -47,8 +58,6 @@ extern void tuiUpdateExecInfo (TuiWinInfoPtr);
|
||||||
extern void tuiUpdateAllExecInfos (void);
|
extern void tuiUpdateAllExecInfos (void);
|
||||||
|
|
||||||
extern void tuiSetIsExecPointAt (TuiLineOrAddress, TuiWinInfoPtr);
|
extern void tuiSetIsExecPointAt (TuiLineOrAddress, TuiWinInfoPtr);
|
||||||
extern void tuiSetHasBreakAt (struct breakpoint *, TuiWinInfoPtr, int);
|
|
||||||
extern void tuiAllSetHasBreakAt (struct breakpoint *, int);
|
|
||||||
extern TuiStatus tuiAllocSourceBuffer (TuiWinInfoPtr);
|
extern TuiStatus tuiAllocSourceBuffer (TuiWinInfoPtr);
|
||||||
extern int tuiLineIsDisplayed (int, TuiWinInfoPtr, int);
|
extern int tuiLineIsDisplayed (int, TuiWinInfoPtr, int);
|
||||||
extern int tuiAddrIsDisplayed (CORE_ADDR, TuiWinInfoPtr, int);
|
extern int tuiAddrIsDisplayed (CORE_ADDR, TuiWinInfoPtr, int);
|
||||||
|
|
Loading…
Reference in New Issue