From a4b99e53449d48e54a827a7bd4af282caaed0150 Mon Sep 17 00:00:00 2001 From: Stephane Carrez Date: Fri, 20 Jul 2001 23:06:48 +0000 Subject: [PATCH] * tuiWin.c (_parseScrollingArgs): Fix uninitialized variable. (_makeVisibleWithNewHeight): Use TuiLineOrAddress type. * tuiStack.c (tuiShowFrameInfo): Use TuiLineOrAddress type. (tui_vUpdateLocatorFilename): Remove. * tuiStack.h: Update prototypes. * tuiSourceWin.c (tuiAddrIsDisplayed): New function. (tuiLineIsDisplayed): Split for address and line. (tuiUpdateSourceWindow): Use TuiLineOrAddress type. (tuiUpdateSourceWindowAsIs): Likewise. (tuiUpdateSourceWindowsWithAddr): Likewise. (tuiUpdateSourceWindowsWithLine): Likewise. (tuiHorizontalSourceScroll): Likewise. (tuiSetIsExecPointAt): Likewise. (tuiUpdateOnEnd): Likewise. * tuiSourceWin.h: Update prototypes. * tuiSource.c (tuiVerticalSourceScroll): Use TuiLineOrAddress type. (tuiShowSource): Likewise. (tuiVerticalSourceScroll): Likewise. * tuiSource.h (tuiShowSource): Update prototype. * tuiDisassem.c (tuiSetDisassemContent): Use CORE_ADDR for address. (tuiShowDisassem): Use TuiLineOrAddress type. (tuiShowDisassemAndUpdateSource): Likewise. (tuiVerticalDisassemScroll): Likewise. (tuiShowDisassemAsIs): Remove. * tuiDisassem.h (tuiSetDisassemContent): Update prototype. * tuiData.c (initWinInfo): Use CORE_ADDR for address. (clearWinDetail): Likewise. (displayableWinContentOf): Fix address conversion. (tuiNextWin): Fix crash when the window is not yet created. (partialWinByName): Likewise. --- gdb/tui/ChangeLog | 38 +++++++++++++++++++ gdb/tui/tuiData.c | 24 +++++++----- gdb/tui/tuiDisassem.c | 38 ++++++------------- gdb/tui/tuiDisassem.h | 2 +- gdb/tui/tuiSource.c | 26 +++++++------ gdb/tui/tuiSource.h | 6 +-- gdb/tui/tuiSourceWin.c | 86 ++++++++++++++++++++++++++++-------------- gdb/tui/tuiSourceWin.h | 9 +++-- gdb/tui/tuiStack.c | 73 +++++++++++------------------------ gdb/tui/tuiStack.h | 2 - gdb/tui/tuiWin.c | 19 ++++------ 11 files changed, 171 insertions(+), 152 deletions(-) diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 179cb268328..29ddeb14268 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,41 @@ +2001-07-21 Stephane Carrez + + * tuiWin.c (_parseScrollingArgs): Fix uninitialized variable. + (_makeVisibleWithNewHeight): Use TuiLineOrAddress type. + + * tuiStack.c (tuiShowFrameInfo): Use TuiLineOrAddress type. + (tui_vUpdateLocatorFilename): Remove. + * tuiStack.h: Update prototypes. + + * tuiSourceWin.c (tuiAddrIsDisplayed): New function. + (tuiLineIsDisplayed): Split for address and line. + (tuiUpdateSourceWindow): Use TuiLineOrAddress type. + (tuiUpdateSourceWindowAsIs): Likewise. + (tuiUpdateSourceWindowsWithAddr): Likewise. + (tuiUpdateSourceWindowsWithLine): Likewise. + (tuiHorizontalSourceScroll): Likewise. + (tuiSetIsExecPointAt): Likewise. + (tuiUpdateOnEnd): Likewise. + * tuiSourceWin.h: Update prototypes. + + * tuiSource.c (tuiVerticalSourceScroll): Use TuiLineOrAddress type. + (tuiShowSource): Likewise. + (tuiVerticalSourceScroll): Likewise. + * tuiSource.h (tuiShowSource): Update prototype. + + * tuiDisassem.c (tuiSetDisassemContent): Use CORE_ADDR for address. + (tuiShowDisassem): Use TuiLineOrAddress type. + (tuiShowDisassemAndUpdateSource): Likewise. + (tuiVerticalDisassemScroll): Likewise. + (tuiShowDisassemAsIs): Remove. + * tuiDisassem.h (tuiSetDisassemContent): Update prototype. + + * tuiData.c (initWinInfo): Use CORE_ADDR for address. + (clearWinDetail): Likewise. + (displayableWinContentOf): Fix address conversion. + (tuiNextWin): Fix crash when the window is not yet created. + (partialWinByName): Likewise. + 2001-07-21 Stephane Carrez * tuiSourceWin.h: Remove unused declarations. diff --git a/gdb/tui/tuiData.c b/gdb/tui/tuiData.c index a4a6511b53a..5194eff227c 100644 --- a/gdb/tui/tuiData.c +++ b/gdb/tui/tuiData.c @@ -22,6 +22,7 @@ #include "defs.h" #include "tui.h" #include "tuiData.h" +#include "tuiGeneralWin.h" /**************************** ** GLOBAL DECLARATIONS @@ -236,7 +237,7 @@ clearWinDetail (TuiWinInfoPtr winInfo) { case SRC_WIN: case DISASSEM_WIN: - winInfo->detail.sourceInfo.startLineOrAddr.addr = (Opaque) NULL; + winInfo->detail.sourceInfo.startLineOrAddr.addr = 0; winInfo->detail.sourceInfo.horizontalOffset = 0; break; case CMD_WIN: @@ -484,7 +485,7 @@ tuiNextWin (TuiWinInfoPtr curWin) type = curWin->generic.type + 1; while (type != curWin->generic.type && m_winPtrIsNull (nextWin)) { - if (winList[type]->generic.isVisible) + if (winList[type] && winList[type]->generic.isVisible) nextWin = winList[type]; else { @@ -604,9 +605,9 @@ displayableWinContentOf (TuiGenWinInfoPtr winInfo, TuiWinElementPtr elementPtr) else strcpy (lineNo, "??"); if (elementPtr != (TuiWinElementPtr) NULL && - elementPtr->whichElement.locator.addr > (Opaque) 0) - sprintf (pc, "0x%x", - elementPtr->whichElement.locator.addr); + elementPtr->whichElement.locator.addr != 0) + sprintf (pc, "0x%lx", + (long) elementPtr->whichElement.locator.addr); else strcpy (pc, "??"); /* @@ -728,10 +729,13 @@ partialWinByName (char *name) while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo)) { - char *curName = winName (&winList[i]->generic); - if (strlen (name) <= strlen (curName) && - strncmp (name, curName, strlen (name)) == 0) - winInfo = winList[i]; + if (winList[i] != 0) + { + char *curName = winName (&winList[i]->generic); + if (strlen (name) <= strlen (curName) && + strncmp (name, curName, strlen (name)) == 0) + winInfo = winList[i]; + } i++; } } @@ -889,7 +893,7 @@ initWinInfo (TuiWinInfoPtr winInfo) winInfo->detail.sourceInfo.executionInfo = (TuiGenWinInfoPtr) NULL; winInfo->detail.sourceInfo.hasLocator = FALSE; winInfo->detail.sourceInfo.horizontalOffset = 0; - winInfo->detail.sourceInfo.startLineOrAddr.addr = (Opaque) NULL; + winInfo->detail.sourceInfo.startLineOrAddr.addr = 0; break; case DATA_WIN: winInfo->detail.dataDisplayInfo.dataContent = (TuiWinContent) NULL; diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c index 4d3b61ab8d3..7bdcbf704d7 100644 --- a/gdb/tui/tuiDisassem.c +++ b/gdb/tui/tuiDisassem.c @@ -113,7 +113,7 @@ extern void strcat_address_numeric (CORE_ADDR, int, char *, int); &(tui_file_get_strbuf (gdb_dis_out)[offset])); else element->whichElement.source.line[0] = '\0'; - element->whichElement.source.lineOrAddr.addr = (Opaque) pc; + element->whichElement.source.lineOrAddr.addr = pc; element->whichElement.source.isExecPoint = (pc == (CORE_ADDR) ((TuiWinElementPtr) locator->content[0])->whichElement.locator.addr); bp = _hasBreak (pc); @@ -146,9 +146,11 @@ tuiShowDisassem (CORE_ADDR startAddr) { struct symtab *s = find_pc_symtab (startAddr); TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); + TuiLineOrAddress val; + val.addr = startAddr; tuiAddWinToLayout (DISASSEM_WIN); - tuiUpdateSourceWindow (disassemWin, s, startAddr, FALSE); + tuiUpdateSourceWindow (disassemWin, s, val, FALSE); /* ** if the focus was in the src win, put it in the asm win, if the ** source view isn't split @@ -172,13 +174,15 @@ tuiShowDisassemAndUpdateSource (CORE_ADDR startAddr) tuiShowDisassem (startAddr); if (currentLayout () == SRC_DISASSEM_COMMAND) { + TuiLineOrAddress val; TuiGenWinInfoPtr locator = locatorWinInfoPtr (); /* ** Update what is in the source window if it is displayed too, ** note that it follows what is in the disassembly window and visa-versa */ sal = find_pc_line (startAddr, 0); - tuiUpdateSourceWindow (srcWin, sal.symtab, sal.line, TRUE); + val.lineNo = sal.line; + tuiUpdateSourceWindow (srcWin, sal.symtab, val, TRUE); if (sal.symtab) { current_source_symtab = sal.symtab; @@ -191,28 +195,6 @@ tuiShowDisassemAndUpdateSource (CORE_ADDR startAddr) return; } /* tuiShowDisassemAndUpdateSource */ - -/* - ** tuiShowDisassemAsIs(). - ** Function to display the disassembly window. This function shows - ** the disassembly as specified by the horizontal offset. - */ -void -tuiShowDisassemAsIs (Opaque addr) -{ - tuiAddWinToLayout (DISASSEM_WIN); - tuiUpdateSourceWindowAsIs (disassemWin, (struct symtab *) NULL, addr, FALSE); - /* - ** Update what is in the source window if it is displayed too, not that it - ** follows what is in the disassembly window and visa-versa - */ - if (currentLayout () == SRC_DISASSEM_COMMAND) - tuiShowSourceContent (srcWin); /*???? Need to do more? */ - - return; -} /* tuiShowDisassem */ - - /* ** tuiGetBeginAsmAddress(). */ @@ -272,6 +254,7 @@ tuiVerticalDisassemScroll (TuiScrollDirection scrollDirection, register int line = 0; register CORE_ADDR newLow; bfd_byte buffer[4]; + TuiLineOrAddress val; newLow = pc; if (scrollDirection == FORWARD_SCROLL) @@ -281,10 +264,11 @@ tuiVerticalDisassemScroll (TuiScrollDirection scrollDirection, } else { - for (; newLow >= (Opaque) 0 && line < numToScroll; line++) + for (; newLow != 0 && line < numToScroll; line++) newLow -= sizeof (bfd_getb32 (buffer)); } - tuiUpdateSourceWindowAsIs (disassemWin, s, newLow, FALSE); + val.addr = newLow; + tuiUpdateSourceWindowAsIs (disassemWin, s, val, FALSE); } } diff --git a/gdb/tui/tuiDisassem.h b/gdb/tui/tuiDisassem.h index d977fab8f50..f0aabdfb4c2 100644 --- a/gdb/tui/tuiDisassem.h +++ b/gdb/tui/tuiDisassem.h @@ -33,7 +33,7 @@ ******************************************/ extern TuiStatus tuiSetDisassemContent (struct symtab *, CORE_ADDR); extern void tuiShowDisassem (CORE_ADDR); -extern void tuiShowDisassemAndUpdateSource (Opaque); +extern void tuiShowDisassemAndUpdateSource (CORE_ADDR); extern void tuiVerticalDisassemScroll (TuiScrollDirection, int); extern CORE_ADDR tuiGetBeginAsmAddress (void); diff --git a/gdb/tui/tuiSource.c b/gdb/tui/tuiSource.c index 2f52fc5608f..6c1a8fb5e11 100644 --- a/gdb/tui/tuiSource.c +++ b/gdb/tui/tuiSource.c @@ -25,6 +25,7 @@ #include "frame.h" #include "breakpoint.h" #include "source.h" +#include "symtab.h" #include "tui.h" #include "tuiData.h" @@ -332,10 +333,10 @@ tuiSetSourceContentNil (TuiWinInfoPtr winInfo, char *warning_string) ** initializes the horizontal scroll to 0. */ void -tuiShowSource (struct symtab *s, Opaque line, int noerror) +tuiShowSource (struct symtab *s, TuiLineOrAddress line, int noerror) { srcWin->detail.sourceInfo.horizontalOffset = 0; - m_tuiShowSourceAsIs (s, line, noerror); + tuiUpdateSourceWindowAsIs(srcWin, s, line, noerror); return; } /* tuiShowSource */ @@ -359,12 +360,12 @@ tuiSourceIsDisplayed (char *fname) ** Scroll the source forward or backward vertically */ void -tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, int numToScroll) +tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, + int numToScroll) { if (srcWin->generic.content != (OpaquePtr) NULL) { - int line; - Opaque addr; + TuiLineOrAddress l; struct symtab *s; TuiWinContent content = (TuiWinContent) srcWin->generic.content; @@ -375,21 +376,22 @@ tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, int numToScroll) if (scrollDirection == FORWARD_SCROLL) { - line = content[0]->whichElement.source.lineOrAddr.lineNo + + l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo + numToScroll; - if (line > s->nlines) + if (l.lineNo > s->nlines) /*line = s->nlines - winInfo->generic.contentSize + 1; */ /*elz: fix for dts 23398 */ - line = content[0]->whichElement.source.lineOrAddr.lineNo; + l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo; } else { - line = content[0]->whichElement.source.lineOrAddr.lineNo - + l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo - numToScroll; - if (line <= 0) - line = 1; + if (l.lineNo <= 0) + l.lineNo = 1; } - tuiUpdateSourceWindowAsIs (srcWin, s, (Opaque) line, FALSE); + if (identify_source_line (s, l.lineNo, 0, -1) == 1) + tuiUpdateSourceWindowAsIs (srcWin, s, l, FALSE); } return; diff --git a/gdb/tui/tuiSource.h b/gdb/tui/tuiSource.h index c19e017e61b..2c04988ec2b 100644 --- a/gdb/tui/tuiSource.h +++ b/gdb/tui/tuiSource.h @@ -23,13 +23,9 @@ #define _TUI_SOURCE_H #include "defs.h" -#if 0 -#include "symtab.h" -#include "breakpoint.h" -#endif extern TuiStatus tuiSetSourceContent (struct symtab *, int, int); -extern void tuiShowSource (struct symtab *, Opaque, int); +extern void tuiShowSource (struct symtab *, TuiLineOrAddress, int); extern void tuiShowSourceAsIs (struct symtab *, Opaque, int); extern int tuiSourceIsDisplayed (char *); extern void tuiVerticalSourceScroll (TuiScrollDirection, int); diff --git a/gdb/tui/tuiSourceWin.c b/gdb/tui/tuiSourceWin.c index 9098aaf5bc4..b79404dc3ce 100644 --- a/gdb/tui/tuiSourceWin.c +++ b/gdb/tui/tuiSourceWin.c @@ -119,7 +119,7 @@ tuiDisplayMainFunction (void) */ void tuiUpdateSourceWindow (TuiWinInfoPtr winInfo, struct symtab *s, - Opaque lineOrAddr, int noerror) + TuiLineOrAddress lineOrAddr, int noerror) { winInfo->detail.sourceInfo.horizontalOffset = 0; tuiUpdateSourceWindowAsIs (winInfo, s, lineOrAddr, noerror); @@ -135,14 +135,14 @@ tuiUpdateSourceWindow (TuiWinInfoPtr winInfo, struct symtab *s, */ void tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s, - Opaque lineOrAddr, int noerror) + TuiLineOrAddress lineOrAddr, int noerror) { TuiStatus ret; if (winInfo->generic.type == SRC_WIN) - ret = tuiSetSourceContent (s, (int) lineOrAddr, noerror); + ret = tuiSetSourceContent (s, lineOrAddr.lineNo, noerror); else - ret = tuiSetDisassemContent (s, (Opaque) lineOrAddr); + ret = tuiSetDisassemContent (s, lineOrAddr.addr); if (ret == TUI_FAILURE) { @@ -156,7 +156,7 @@ tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s, tuiUpdateExecInfo (winInfo); if (winInfo->generic.type == SRC_WIN) { - current_source_line = (int) lineOrAddr + + current_source_line = lineOrAddr.lineNo + (winInfo->generic.contentSize - 2); current_source_symtab = s; /* @@ -185,7 +185,8 @@ tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr) if (addr != 0) { struct symtab_and_line sal; - + TuiLineOrAddress l; + switch (currentLayout ()) { case DISASSEM_COMMAND: @@ -197,7 +198,8 @@ tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr) break; default: sal = find_pc_line (addr, 0); - tuiShowSource (sal.symtab, sal.line, FALSE); + l.lineNo = sal.line; + tuiShowSource (sal.symtab, l, FALSE); break; } } @@ -226,7 +228,8 @@ void tuiUpdateSourceWindowsWithLine (struct symtab *s, int line) { CORE_ADDR pc; - + TuiLineOrAddress l; + switch (currentLayout ()) { case DISASSEM_COMMAND: @@ -235,7 +238,8 @@ tuiUpdateSourceWindowsWithLine (struct symtab *s, int line) tuiUpdateSourceWindowsWithAddr (pc); break; default: - tuiShowSource (s, line, FALSE); + l.lineNo = line; + tuiShowSource (s, l, FALSE); if (currentLayout () == SRC_DISASSEM_COMMAND) { find_line_pc (s, line, &pc); @@ -422,12 +426,9 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo, tuiUpdateSourceWindowAsIs ( winInfo, s, - ((winInfo == srcWin) ? - (Opaque) ((TuiWinElementPtr) - winInfo->generic.content[0])->whichElement.source.lineOrAddr.lineNo : - (Opaque) ((TuiWinElementPtr) - winInfo->generic.content[0])->whichElement.source.lineOrAddr.addr), - (int) FALSE); + ((TuiWinElementPtr) + winInfo->generic.content[0])->whichElement.source.lineOrAddr, + FALSE); } return; @@ -439,7 +440,7 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo, ** Set or clear the hasBreak flag in the line whose line is lineNo. */ void -tuiSetIsExecPointAt (Opaque lineOrAddr, TuiWinInfoPtr winInfo) +tuiSetIsExecPointAt (TuiLineOrAddress l, TuiWinInfoPtr winInfo) { int i; TuiWinContent content = (TuiWinContent) winInfo->generic.content; @@ -447,7 +448,7 @@ tuiSetIsExecPointAt (Opaque lineOrAddr, TuiWinInfoPtr winInfo) i = 0; while (i < winInfo->generic.contentSize) { - if (content[i]->whichElement.source.lineOrAddr.addr == lineOrAddr) + if (content[i]->whichElement.source.lineOrAddr.addr == l.addr) content[i]->whichElement.source.isExecPoint = TRUE; else content[i]->whichElement.source.isExecPoint = FALSE; @@ -457,7 +458,6 @@ tuiSetIsExecPointAt (Opaque lineOrAddr, TuiWinInfoPtr winInfo) return; } /* tuiSetIsExecPointAt */ - /* ** tuiSetHasBreakAt(). ** Set or clear the hasBreak flag in the line whose line is lineNo. @@ -756,9 +756,13 @@ tuiUpdateOnEnd (void) /* for all the windows (src, asm) */ for (i = 0; i < (sourceWindows ())->count; i++) { + TuiLineOrAddress l; + winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i]; - tuiSetIsExecPointAt ((Opaque) - 1, winInfo); /* the target is'n running */ + l.addr = -1; + l.lineNo = -1; + tuiSetIsExecPointAt (l, winInfo); /* the target is'n running */ /* -1 should not match any line number or pc */ tuiSetExecInfoContent (winInfo); /*set winInfo so that > is'n displayed */ tuiShowExecInfoContent (winInfo); /* display the new contents */ @@ -771,7 +775,7 @@ tuiUpdateOnEnd (void) filename, (char *) NULL, 0, - (Opaque) NULL, + (CORE_ADDR) 0, &((TuiWinElementPtr) locator->content[0])->whichElement.locator); tuiShowLocatorContent (); @@ -833,7 +837,7 @@ tuiAllocSourceBuffer (TuiWinInfoPtr winInfo) ** in the current source window. */ int -tuiLineIsDisplayed (Opaque lineNoOrAddr, TuiWinInfoPtr winInfo, +tuiLineIsDisplayed (int line, TuiWinInfoPtr winInfo, int checkThreshold) { int isDisplayed = FALSE; @@ -846,14 +850,9 @@ tuiLineIsDisplayed (Opaque lineNoOrAddr, TuiWinInfoPtr winInfo, i = 0; while (i < winInfo->generic.contentSize - threshold && !isDisplayed) { - if (winInfo == srcWin) - isDisplayed = (((TuiWinElementPtr) - winInfo->generic.content[i])->whichElement.source.lineOrAddr.lineNo - == (int) lineNoOrAddr); - else - isDisplayed = (((TuiWinElementPtr) - winInfo->generic.content[i])->whichElement.source.lineOrAddr.addr - == lineNoOrAddr); + isDisplayed = (((TuiWinElementPtr) + winInfo->generic.content[i])->whichElement.source.lineOrAddr.lineNo + == (int) line); i++; } @@ -861,6 +860,35 @@ tuiLineIsDisplayed (Opaque lineNoOrAddr, TuiWinInfoPtr winInfo, } /* tuiLineIsDisplayed */ +/* + ** tuiLineIsDisplayed(). + ** Answer whether the a particular line number or address is displayed + ** in the current source window. + */ +int +tuiAddrIsDisplayed (CORE_ADDR addr, TuiWinInfoPtr winInfo, + int checkThreshold) +{ + int isDisplayed = FALSE; + int i, threshold; + + if (checkThreshold) + threshold = SCROLL_THRESHOLD; + else + threshold = 0; + i = 0; + while (i < winInfo->generic.contentSize - threshold && !isDisplayed) + { + isDisplayed = (((TuiWinElementPtr) + winInfo->generic.content[i])->whichElement.source.lineOrAddr.addr + == addr); + i++; + } + + return isDisplayed; +} + + /***************************************** ** STATIC LOCAL FUNCTIONS ** ******************************************/ diff --git a/gdb/tui/tuiSourceWin.h b/gdb/tui/tuiSourceWin.h index ffde656943b..ced01f74682 100644 --- a/gdb/tui/tuiSourceWin.h +++ b/gdb/tui/tuiSourceWin.h @@ -23,9 +23,9 @@ #define _TUI_SOURCEWIN_H extern void tuiDisplayMainFunction (void); -extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, Opaque, +extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress, int); -extern void tuiUpdateSourceWindowAsIs (TuiWinInfoPtr, struct symtab *, Opaque, +extern void tuiUpdateSourceWindowAsIs (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress, int); extern void tuiUpdateSourceWindowsWithAddr (CORE_ADDR); extern void tuiUpdateSourceWindowsWithLine (struct symtab *, int); @@ -51,11 +51,12 @@ extern void tuiClearAllExecInfosContent (void); extern void tuiUpdateExecInfo (TuiWinInfoPtr); extern void tuiUpdateAllExecInfos (void); -extern void tuiSetIsExecPointAt (Opaque, TuiWinInfoPtr); +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 (Opaque, TuiWinInfoPtr, int); +extern int tuiLineIsDisplayed (int, TuiWinInfoPtr, int); +extern int tuiAddrIsDisplayed (CORE_ADDR, TuiWinInfoPtr, int); /* diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c index ce979ddaace..b3e4931588b 100644 --- a/gdb/tui/tuiStack.c +++ b/gdb/tui/tuiStack.c @@ -164,23 +164,6 @@ tuiUpdateLocatorFilename (char *fileName) return; } /* tuiUpdateLocatorFilename */ - -/* - ** tui_vUpdateLocatorFilename(). - ** Update only the filename portion of the locator with args in a va_list. - */ -void -tui_vUpdateLocatorFilename (va_list args) -{ - char *fileName; - - fileName = va_arg (args, char *); - tuiUpdateLocatorFilename (fileName); - - return; -} /* tui_vUpdateLocatorFilename */ - - /* ** tuiSwitchFilename(). ** Update the filename portion of the locator. Clear the other info in locator. @@ -336,16 +319,19 @@ tuiShowFrameInfo (struct frame_info *fi) if (s == 0) return; + startLine = 0; sourceAlreadyDisplayed = tuiSourceIsDisplayed (s->filename); tuiUpdateLocatorDisplay (fi); for (i = 0; i < (sourceWindows ())->count; i++) { + TuiWhichElement *item; winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i]; + + item = &((TuiWinElementPtr) locator->content[0])->whichElement; if (winInfo == srcWin) { - startLine = - (((TuiWinElementPtr) locator->content[0])->whichElement.locator.lineNo - - (winInfo->generic.viewportHeight / 2)) + 1; + startLine = (item->locator.lineNo - + (winInfo->generic.viewportHeight / 2)) + 1; if (startLine <= 0) startLine = 1; } @@ -359,26 +345,30 @@ tuiShowFrameInfo (struct frame_info *fi) if (winInfo == srcWin) { - if (!(sourceAlreadyDisplayed && m_tuiLineDisplayedWithinThreshold ( - winInfo, - ((TuiWinElementPtr) locator->content[0])->whichElement.locator.lineNo))) - tuiUpdateSourceWindow (winInfo, s, (Opaque) startLine, TRUE); + TuiLineOrAddress l; + l.lineNo = startLine; + if (!(sourceAlreadyDisplayed + && tuiLineIsDisplayed (item->locator.lineNo, winInfo, TRUE))) + tuiUpdateSourceWindow (winInfo, s, l, TRUE); else - tuiSetIsExecPointAt ((Opaque) - ((TuiWinElementPtr) locator->content[0])->whichElement.locator.lineNo, - winInfo); + { + l.lineNo = item->locator.lineNo; + tuiSetIsExecPointAt (l, winInfo); + } } else { if (winInfo == disassemWin) { - if (!m_tuiLineDisplayedWithinThreshold (winInfo, - ((TuiWinElementPtr) locator->content[0])->whichElement.locator.addr)) - tuiUpdateSourceWindow (winInfo, s, (Opaque) low, TRUE); + TuiLineOrAddress a; + a.addr = low; + if (!tuiAddrIsDisplayed (item->locator.addr, winInfo, TRUE)) + tuiUpdateSourceWindow (winInfo, s, a, TRUE); else - tuiSetIsExecPointAt ((Opaque) - ((TuiWinElementPtr) locator->content[0])->whichElement.locator.addr, - winInfo); + { + a.addr = item->locator.addr; + tuiSetIsExecPointAt (a, winInfo); + } } } tuiUpdateExecInfo (winInfo); @@ -398,23 +388,6 @@ tuiShowFrameInfo (struct frame_info *fi) return; } /* tuiShowFrameInfo */ - -/* - ** tui_vShowFrameInfo(). - ** Function to print the frame inforrmation for the TUI with args in a va_list. - */ -void -tui_vShowFrameInfo (va_list args) -{ - struct frame_info *fi; - - fi = va_arg (args, struct frame_info *); - tuiShowFrameInfo (fi); - - return; -} /* tui_vShowFrameInfo */ - - /* ** _initialize_tuiStack(). ** Function to initialize gdb commands, for tui window stack manipulation. diff --git a/gdb/tui/tuiStack.h b/gdb/tui/tuiStack.h index 6a987eb8d66..77d5b8528f6 100644 --- a/gdb/tui/tuiStack.h +++ b/gdb/tui/tuiStack.h @@ -28,7 +28,6 @@ extern void tuiSetLocatorInfo (char *, char *, int, CORE_ADDR, TuiLocatorElementPtr); extern void tuiUpdateLocatorFilename (char *); -extern void tui_vUpdateLocatorFilename (va_list); extern void tuiUpdateLocatorInfoFromFrame (struct frame_info *, TuiLocatorElementPtr); extern void tuiUpdateLocatorDisplay (struct frame_info *); @@ -37,7 +36,6 @@ extern void tuiShowLocatorContent (void); extern void tuiClearLocatorContent (void); extern void tuiSwitchFilename (char *); extern void tuiShowFrameInfo (struct frame_info *); -extern void tui_vShowFrameInfo (va_list); extern void tuiGetLocatorFilename (TuiGenWinInfoPtr, char **); diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c index a0b9bb5f4f5..07555e53964 100644 --- a/gdb/tui/tuiWin.c +++ b/gdb/tui/tuiWin.c @@ -1139,26 +1139,19 @@ _makeVisibleWithNewHeight (TuiWinInfoPtr winInfo) winInfo->detail.sourceInfo.startLineOrAddr.addr; freeWinContent (&winInfo->generic); tuiUpdateSourceWindow (winInfo, - current_source_symtab, - ((winInfo->generic.type == SRC_WIN) ? - (Opaque) lineOrAddr.lineNo : - lineOrAddr.addr), - TRUE); + current_source_symtab, lineOrAddr, TRUE); } else if (selected_frame != (struct frame_info *) NULL) { - Opaque line = 0; + TuiLineOrAddress line; extern int current_source_line; s = find_pc_symtab (selected_frame->pc); if (winInfo->generic.type == SRC_WIN) - line = (Opaque) current_source_line; + line.lineNo = current_source_line; else { - CORE_ADDR pc; - - find_line_pc (s, current_source_line, &pc); - line = (Opaque) pc; + find_line_pc (s, current_source_line, &line.addr); } tuiUpdateSourceWindow (winInfo, s, line, TRUE); } @@ -1349,7 +1342,9 @@ _parseScrollingArgs (char *arg, TuiWinInfoPtr * winToScroll, int *numToScroll) if (*bufPtr != (char) 0) wname = bufPtr; - + else + wname = "?"; + /* Validate the window name */ for (i = 0; i < strlen (wname); i++) wname[i] = toupper (wname[i]); -- 2.30.2