aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2002-08-25 11:00:46 +0000
committerStephane Carrez <stcarrez@nerim.fr>2002-08-25 11:00:46 +0000
commitbc6b7f04caef65ba22b9afb4110b2515deb9ba32 (patch)
tree74e35667301c6d5891bc4c96011c54d4c0d01fc2 /gdb/tui
parentd059f789de8c289a9cded3e825abb3c53c7d239e (diff)
downloadgdb-bc6b7f04caef65ba22b9afb4110b2515deb9ba32.zip
gdb-bc6b7f04caef65ba22b9afb4110b2515deb9ba32.tar.gz
gdb-bc6b7f04caef65ba22b9afb4110b2515deb9ba32.tar.bz2
* tuiSourceWin.c (tuiSetHasBreakAt): Use filename for breakpoint
comparison; cleanup. * tuiSource.c (tuiSetSourceContent): Set window title and filename. * tuiGeneralWin.c (boxWin): Print optional title on top of window. * tuiData.h (TuiSourceInfo): Add filename member. (TuiGenWinInfo): Add title member. * tuiData.c (initGenericPart): Clear title. (freeWindow): Free title and filename; remove unused locals. (initWinInfo): Clear filename. (tuiDelWindow): Free it; remove unused locals.
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/ChangeLog13
-rw-r--r--gdb/tui/tuiData.c51
-rw-r--r--gdb/tui/tuiData.h4
-rw-r--r--gdb/tui/tuiGeneralWin.c2
-rw-r--r--gdb/tui/tuiSource.c43
-rw-r--r--gdb/tui/tuiSourceWin.c14
6 files changed, 59 insertions, 68 deletions
diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog
index 37fb3f8..ef71170 100644
--- a/gdb/tui/ChangeLog
+++ b/gdb/tui/ChangeLog
@@ -1,5 +1,18 @@
2002-08-25 Stephane Carrez <stcarrez@nerim.fr>
+ * tuiSourceWin.c (tuiSetHasBreakAt): Use filename for breakpoint
+ comparison; cleanup.
+ * tuiSource.c (tuiSetSourceContent): Set window title and filename.
+ * tuiGeneralWin.c (boxWin): Print optional title on top of window.
+ * tuiData.h (TuiSourceInfo): Add filename member.
+ (TuiGenWinInfo): Add title member.
+ * tuiData.c (initGenericPart): Clear title.
+ (freeWindow): Free title and filename; remove unused locals.
+ (initWinInfo): Clear filename.
+ (tuiDelWindow): Free it; remove unused locals.
+
+2002-08-25 Stephane Carrez <stcarrez@nerim.fr>
+
* tuiStack.h (tuiGetLocatorFilename): Don't declare.
(tuiUpdateLocatorDisplay): Likewise.
* tuiStack.c (tuiGetLocatorFilename): Remove.
diff --git a/gdb/tui/tuiData.c b/gdb/tui/tuiData.c
index 30efba8..45508e0 100644
--- a/gdb/tui/tuiData.c
+++ b/gdb/tui/tuiData.c
@@ -843,9 +843,8 @@ initGenericPart (TuiGenWinInfoPtr win)
win->content = (OpaquePtr) NULL;
win->contentInUse =
win->isVisible = FALSE;
-
- return;
-} /* initGenericPart */
+ win->title = 0;
+}
/*
@@ -914,6 +913,7 @@ initWinInfo (TuiWinInfoPtr winInfo)
winInfo->detail.sourceInfo.hasLocator = FALSE;
winInfo->detail.sourceInfo.horizontalOffset = 0;
winInfo->detail.sourceInfo.startLineOrAddr.addr = 0;
+ winInfo->detail.sourceInfo.filename = 0;
break;
case DATA_WIN:
winInfo->detail.dataDisplayInfo.dataContent = (TuiWinContent) NULL;
@@ -1040,19 +1040,13 @@ addContentElements (TuiGenWinInfoPtr winInfo, int numElements)
} /* addContentElements */
-/*
- ** tuiDelWindow().
- ** Delete all curses windows associated with winInfo, leaving everything
- ** else in tact.
- */
+/* Delete all curses windows associated with winInfo, leaving everything
+ else intact. */
void
tuiDelWindow (TuiWinInfoPtr winInfo)
{
- Opaque detail;
- int i;
TuiGenWinInfoPtr genericWin;
-
switch (winInfo->generic.type)
{
case SRC_WIN:
@@ -1064,6 +1058,11 @@ tuiDelWindow (TuiWinInfoPtr winInfo)
genericWin->handle = (WINDOW *) NULL;
genericWin->isVisible = FALSE;
}
+ if (winInfo->detail.sourceInfo.filename)
+ {
+ xfree (winInfo->detail.sourceInfo.filename);
+ winInfo->detail.sourceInfo.filename = 0;
+ }
genericWin = winInfo->detail.sourceInfo.executionInfo;
if (genericWin != (TuiGenWinInfoPtr) NULL)
{
@@ -1075,14 +1074,10 @@ tuiDelWindow (TuiWinInfoPtr winInfo)
case DATA_WIN:
if (winInfo->generic.content != (OpaquePtr) NULL)
{
- int i;
-
- tuiDelDataWindows (
- winInfo->detail.dataDisplayInfo.regsContent,
- winInfo->detail.dataDisplayInfo.regsContentCount);
- tuiDelDataWindows (
- winInfo->detail.dataDisplayInfo.dataContent,
- winInfo->detail.dataDisplayInfo.dataContentCount);
+ tuiDelDataWindows (winInfo->detail.dataDisplayInfo.regsContent,
+ winInfo->detail.dataDisplayInfo.regsContentCount);
+ tuiDelDataWindows (winInfo->detail.dataDisplayInfo.dataContent,
+ winInfo->detail.dataDisplayInfo.dataContentCount);
}
break;
default:
@@ -1094,9 +1089,7 @@ tuiDelWindow (TuiWinInfoPtr winInfo)
winInfo->generic.handle = (WINDOW *) NULL;
winInfo->generic.isVisible = FALSE;
}
-
- return;
-} /* tuiDelWindow */
+}
/*
@@ -1105,11 +1098,8 @@ tuiDelWindow (TuiWinInfoPtr winInfo)
void
freeWindow (TuiWinInfoPtr winInfo)
{
- Opaque detail;
- int i;
TuiGenWinInfoPtr genericWin;
-
switch (winInfo->generic.type)
{
case SRC_WIN:
@@ -1121,6 +1111,11 @@ freeWindow (TuiWinInfoPtr winInfo)
genericWin->handle = (WINDOW *) NULL;
}
freeWinContent (genericWin);
+ if (winInfo->detail.sourceInfo.filename)
+ {
+ xfree (winInfo->detail.sourceInfo.filename);
+ winInfo->detail.sourceInfo.filename = 0;
+ }
genericWin = winInfo->detail.sourceInfo.executionInfo;
if (genericWin != (TuiGenWinInfoPtr) NULL)
{
@@ -1161,10 +1156,10 @@ freeWindow (TuiWinInfoPtr winInfo)
winInfo->generic.handle = (WINDOW *) NULL;
freeWinContent (&winInfo->generic);
}
+ if (winInfo->generic.title)
+ xfree (winInfo->generic.title);
xfree (winInfo);
-
- return;
-} /* freeWindow */
+}
/*
diff --git a/gdb/tui/tuiData.h b/gdb/tui/tuiData.h
index 89779b4..36d7853 100644
--- a/gdb/tui/tuiData.h
+++ b/gdb/tui/tuiData.h
@@ -1,5 +1,5 @@
/* TUI data manipulation routines.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
This file is part of GDB.
@@ -42,6 +42,7 @@
int viewportHeight; /* viewport height */
int lastVisibleLine; /* index of last visible line */
int isVisible; /* whether the window is visible or not */
+ char* title; /* Window title to display. */
}
TuiGenWinInfo, *TuiGenWinInfoPtr;
@@ -244,6 +245,7 @@ typedef struct _TuiSourceInfo
TuiGenWinInfoPtr executionInfo; /* execution information window */
int horizontalOffset; /* used for horizontal scroll */
TuiLineOrAddress startLineOrAddr;
+ char* filename;
}
TuiSourceInfo, *TuiSourceInfoPtr;
diff --git a/gdb/tui/tuiGeneralWin.c b/gdb/tui/tuiGeneralWin.c
index b8f3b0c..e250ca2 100644
--- a/gdb/tui/tuiGeneralWin.c
+++ b/gdb/tui/tuiGeneralWin.c
@@ -118,6 +118,8 @@ boxWin (TuiGenWinInfoPtr winInfo, int highlightFlag)
tui_border_hline, tui_border_hline,
tui_border_ulcorner, tui_border_urcorner,
tui_border_llcorner, tui_border_lrcorner);
+ if (winInfo->title)
+ mvwaddstr (win, 0, 3, winInfo->title);
wattroff (win, attrs);
}
}
diff --git a/gdb/tui/tuiSource.c b/gdb/tui/tuiSource.c
index 1552ac7..f844b36 100644
--- a/gdb/tui/tuiSource.c
+++ b/gdb/tui/tuiSource.c
@@ -55,32 +55,12 @@
/*****************************************
-** EXTERNAL DATA DECLS **
-******************************************/
-extern int current_source_line;
-extern struct symtab *current_source_symtab;
-
-
-/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
******************************************/
static struct breakpoint *_hasBreak (char *, int);
-/*****************************************
-** STATIC LOCAL DATA **
-******************************************/
-
-
-/*****************************************
-** PUBLIC FUNCTIONS **
-******************************************/
-
-/*********************************
-** SOURCE/DISASSEM FUNCTIONS **
-*********************************/
-
/*
** tuiSetSourceContent().
** Function to display source in the source window.
@@ -94,7 +74,7 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
{
register FILE *stream;
register int i, desc, c, lineWidth, nlines;
- register char *srcLine;
+ register char *srcLine = 0;
if ((ret = tuiAllocSourceBuffer (srcWin)) == TUI_SUCCESS)
{
@@ -136,17 +116,24 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
{
register int offset, curLineNo, curLine, curLen, threshold;
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
- /*
- ** Determine the threshold for the length of the line
- ** and the offset to start the display
- */
- offset = srcWin->detail.sourceInfo.horizontalOffset;
+ TuiSourceInfoPtr src = &srcWin->detail.sourceInfo;
+
+ if (srcWin->generic.title)
+ xfree (srcWin->generic.title);
+ srcWin->generic.title = xstrdup (s->filename);
+
+ if (src->filename)
+ xfree (src->filename);
+ src->filename = xstrdup (s->filename);
+
+ /* Determine the threshold for the length of the line
+ and the offset to start the display. */
+ offset = src->horizontalOffset;
threshold = (lineWidth - 1) + offset;
stream = fdopen (desc, FOPEN_RT);
clearerr (stream);
curLine = 0;
- curLineNo =
- srcWin->detail.sourceInfo.startLineOrAddr.lineNo = lineNo;
+ curLineNo = src->startLineOrAddr.lineNo = lineNo;
if (offset > 0)
srcLine = (char *) xmalloc (
(threshold + 1) * sizeof (char));
diff --git a/gdb/tui/tuiSourceWin.c b/gdb/tui/tuiSourceWin.c
index 1f17d30..59e5f3b 100644
--- a/gdb/tui/tuiSourceWin.c
+++ b/gdb/tui/tuiSourceWin.c
@@ -430,19 +430,11 @@ tuiSetHasBreakAt (struct breakpoint *bp, TuiWinInfoPtr winInfo, int hasBreak)
if (winInfo == srcWin)
{
- char *fileNameDisplayed = (char *) NULL;
+ TuiSourceInfoPtr src = &winInfo->detail.sourceInfo;
- if (((TuiWinElementPtr)
- locator->content[0])->whichElement.locator.fileName !=
- (char *) NULL)
- fileNameDisplayed = ((TuiWinElementPtr)
- locator->content[0])->whichElement.locator.fileName;
- else if (current_source_symtab != (struct symtab *) NULL)
- fileNameDisplayed = current_source_symtab->filename;
-
- gotIt = (fileNameDisplayed != (char *) NULL &&
+ gotIt = (src->filename != (char *) NULL &&
bp->source_file != NULL &&
- (strcmp (bp->source_file, fileNameDisplayed) == 0) &&
+ (strcmp (bp->source_file, src->filename) == 0) &&
content[i]->whichElement.source.lineOrAddr.lineNo ==
bp->line_number);
}