/* ** refreshAll(). ** Function to refresh all the windows currently displayed */ void refreshAll (TuiWinInfoPtr * list) { TuiWinType type; TuiGenWinInfoPtr locator = locatorWinInfoPtr (); for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++) { if (list[type] && list[type]->generic.isVisible) { if (type == SRC_WIN || type == DISASSEM_WIN) { touchwin (list[type]->detail.sourceInfo.executionInfo->handle); tuiRefreshWin (list[type]->detail.sourceInfo.executionInfo); } touchwin (list[type]->generic.handle); tuiRefreshWin (&list[type]->generic); } } if (locator->isVisible) { touchwin (locator->handle); tuiRefreshWin (locator); } return; } /* refreshAll */
/* ** tuiSetLocatorContent(). ** Function to set the content of the locator */ void tuiSetLocatorContent (struct frame_info *frameInfo) { TuiGenWinInfoPtr locator = locatorWinInfoPtr (); TuiWinElementPtr element; struct symtab_and_line symtabAndLine; /* Allocate the element if necessary */ if (locator->contentSize <= 0) { TuiWinContent contentPtr; if ((locator->content = (OpaquePtr) allocContent (1, locator->type)) == (OpaquePtr) NULL) error ("Unable to Allocate Memory to Display Location."); locator->contentSize = 1; } if (frameInfo != (struct frame_info *) NULL) tuiUpdateLocatorInfoFromFrame (frameInfo, &((TuiWinElementPtr) locator->content[0])->whichElement.locator); else tuiSetLocatorInfo ((char *) NULL, (char *) NULL, 0, (CORE_ADDR) 0, &((TuiWinElementPtr) locator->content[0])->whichElement.locator); return; } /* tuiSetLocatorContent */
/* ** tuiShowLocatorContent() */ void tuiShowLocatorContent (void) { char *string; TuiGenWinInfoPtr locator; locator = locatorWinInfoPtr (); if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL) { string = displayableWinContentAt (locator, 0); if (string != (char *) NULL) { wmove (locator->handle, 0, 0); wstandout (locator->handle); waddstr (locator->handle, string); wstandend (locator->handle); tuiRefreshWin (locator); wmove (locator->handle, 0, 0); if (string != nullStr ()) tuiFree (string); locator->contentInUse = TRUE; } } return; } /* tuiShowLocatorContent */
/* ** initializeStaticData */ void initializeStaticData (void) { initGenericPart (sourceExecInfoWinPtr ()); initGenericPart (disassemExecInfoWinPtr ()); initGenericPart (locatorWinInfoPtr ()); return; } /* initializeStaticData */
/* Delete all curses windows associated with winInfo, leaving everything else intact. */ void tuiDelWindow (TuiWinInfoPtr winInfo) { TuiGenWinInfoPtr genericWin; switch (winInfo->generic.type) { case SRC_WIN: case DISASSEM_WIN: genericWin = locatorWinInfoPtr (); if (genericWin != (TuiGenWinInfoPtr) NULL) { tuiDelwin (genericWin->handle); 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) { tuiDelwin (genericWin->handle); genericWin->handle = (WINDOW *) NULL; genericWin->isVisible = FALSE; } break; case DATA_WIN: if (winInfo->generic.content != (OpaquePtr) NULL) { tuiDelDataWindows (winInfo->detail.dataDisplayInfo.regsContent, winInfo->detail.dataDisplayInfo.regsContentCount); tuiDelDataWindows (winInfo->detail.dataDisplayInfo.dataContent, winInfo->detail.dataDisplayInfo.dataContentCount); } break; default: break; } if (winInfo->generic.handle != (WINDOW *) NULL) { tuiDelwin (winInfo->generic.handle); winInfo->generic.handle = (WINDOW *) NULL; winInfo->generic.isVisible = FALSE; } }
/* ** tuiUpdateLocatorFilename(). ** Update only the filename portion of the locator. */ void tuiUpdateLocatorFilename (const char *fileName) { TuiGenWinInfoPtr locator = locatorWinInfoPtr (); if (locator->content[0] == (Opaque) NULL) tuiSetLocatorContent ((struct frame_info *) NULL); ((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName[0] = (char) 0; strcat_to_buf (((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName, MAX_LOCATOR_ELEMENT_LEN, fileName); tuiShowLocatorContent (); return; } /* tuiUpdateLocatorFilename */
/* ** tuiSwitchFilename(). ** Update the filename portion of the locator. Clear the other info in locator. ** (elz) */ void tuiSwitchFilename (char *fileName) { TuiGenWinInfoPtr locator = locatorWinInfoPtr (); if (locator->content[0] == (Opaque) NULL) tuiSetLocatorContent ((struct frame_info *) NULL); ((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName[0] = (char) 0; tuiSetLocatorInfo (fileName, (char *) NULL, 0, (CORE_ADDR) 0, &((TuiWinElementPtr) locator->content[0])->whichElement.locator); tuiShowLocatorContent (); return; } /* tuiSwitchFilename */
/* ** tuiClearLocatorDisplay() */ void tuiClearLocatorDisplay (void) { TuiGenWinInfoPtr locator = locatorWinInfoPtr (); int i; if (locator->handle != (WINDOW *) NULL) { /* No need to werase, since writing a line of * blanks which we do below, is equivalent. */ /* werase(locator->handle); */ wmove (locator->handle, 0, 0); wstandout (locator->handle); for (i = 0; i < locator->width; i++) waddch (locator->handle, ' '); wstandend (locator->handle); tuiRefreshWin (locator); wmove (locator->handle, 0, 0); locator->contentInUse = FALSE; } return; } /* tuiClearLocatorDisplay */
/* ** tuiShowFrameInfo(). ** Function to print the frame inforrmation for the TUI. */ void tuiShowFrameInfo (struct frame_info *fi) { TuiWinInfoPtr winInfo; register int i; if (fi) { register int startLine, i; register struct symtab *s; CORE_ADDR low; TuiGenWinInfoPtr locator = locatorWinInfoPtr (); int sourceAlreadyDisplayed; s = find_pc_symtab (fi->pc); 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 = (item->locator.lineNo - (winInfo->generic.viewportHeight / 2)) + 1; if (startLine <= 0) startLine = 1; } else { if (find_pc_partial_function (fi->pc, (char **) NULL, &low, (CORE_ADDR) NULL) == 0) error ("No function contains program counter for selected frame.\n"); else low = tuiGetLowDisassemblyAddress (low, fi->pc); } if (winInfo == srcWin) { TuiLineOrAddress l; l.lineNo = startLine; if (!(sourceAlreadyDisplayed && tuiLineIsDisplayed (item->locator.lineNo, winInfo, TRUE))) tuiUpdateSourceWindow (winInfo, s, l, TRUE); else { l.lineNo = item->locator.lineNo; tuiSetIsExecPointAt (l, winInfo); } } else { if (winInfo == disassemWin) { TuiLineOrAddress a; a.addr = low; if (!tuiAddrIsDisplayed (item->locator.addr, winInfo, TRUE)) tuiUpdateSourceWindow (winInfo, s, a, TRUE); else { a.addr = item->locator.addr; tuiSetIsExecPointAt (a, winInfo); } } } tuiUpdateExecInfo (winInfo); } } else { tuiUpdateLocatorDisplay (fi); for (i = 0; i < (sourceWindows ())->count; i++) { winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i]; tuiClearSourceContent (winInfo, EMPTY_SOURCE_PROMPT); tuiUpdateExecInfo (winInfo); } } return; } /* tuiShowFrameInfo */
/* ** freeWindow(). */ void freeWindow (TuiWinInfoPtr winInfo) { TuiGenWinInfoPtr genericWin; switch (winInfo->generic.type) { case SRC_WIN: case DISASSEM_WIN: genericWin = locatorWinInfoPtr (); if (genericWin != (TuiGenWinInfoPtr) NULL) { tuiDelwin (genericWin->handle); 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) { tuiDelwin (genericWin->handle); genericWin->handle = (WINDOW *) NULL; freeWinContent (genericWin); } break; case DATA_WIN: if (winInfo->generic.content != (OpaquePtr) NULL) { freeDataContent ( winInfo->detail.dataDisplayInfo.regsContent, winInfo->detail.dataDisplayInfo.regsContentCount); winInfo->detail.dataDisplayInfo.regsContent = (TuiWinContent) NULL; winInfo->detail.dataDisplayInfo.regsContentCount = 0; freeDataContent ( winInfo->detail.dataDisplayInfo.dataContent, winInfo->detail.dataDisplayInfo.dataContentCount); winInfo->detail.dataDisplayInfo.dataContent = (TuiWinContent) NULL; winInfo->detail.dataDisplayInfo.dataContentCount = 0; winInfo->detail.dataDisplayInfo.regsDisplayType = TUI_UNDEFINED_REGS; winInfo->detail.dataDisplayInfo.regsColumnCount = 1; winInfo->detail.dataDisplayInfo.displayRegs = FALSE; winInfo->generic.content = (OpaquePtr) NULL; winInfo->generic.contentSize = 0; } break; default: break; } if (winInfo->generic.handle != (WINDOW *) NULL) { tuiDelwin (winInfo->generic.handle); winInfo->generic.handle = (WINDOW *) NULL; freeWinContent (&winInfo->generic); } if (winInfo->generic.title) xfree (winInfo->generic.title); xfree (winInfo); }