diff options
author | Stephane Carrez <stcarrez@nerim.fr> | 2002-08-25 11:00:46 +0000 |
---|---|---|
committer | Stephane Carrez <stcarrez@nerim.fr> | 2002-08-25 11:00:46 +0000 |
commit | bc6b7f04caef65ba22b9afb4110b2515deb9ba32 (patch) | |
tree | 74e35667301c6d5891bc4c96011c54d4c0d01fc2 /gdb/tui/tuiSource.c | |
parent | d059f789de8c289a9cded3e825abb3c53c7d239e (diff) | |
download | gdb-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/tuiSource.c')
-rw-r--r-- | gdb/tui/tuiSource.c | 43 |
1 files changed, 15 insertions, 28 deletions
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)); |