From c774cec6a71cec1932152c9838d0a7142409d8ce Mon Sep 17 00:00:00 2001 From: Stephane Carrez Date: Wed, 18 Jul 2001 20:59:00 +0000 Subject: [PATCH] * tuiData.h (TuiLocatorElement): Use CORE_ADDR for address member. (TuiLineOrAddress): Likewise. * tuiDisassem.c (tuiGetBeginAsmAddress): Use CORE_ADDR to specify an address. (tuiSetDisassemContent): Likewise. (tuiShowDisassem, tuiShowDisassemAndUpdateSource): Likewise. * tuiLayout.c (_extractDisplayStartAddr): Likewise. (tuiSetLayout): Likewise. * tuiSourceWin.c (tuiDisplayMainFunction): Likewise. (tuiUpdateSourceWindowsWithAddr): Likewise. (tuiUpdateSourceWindowsWithLine): Likewise. (tuiSetHasBreakAt): Likewise. * tuiStack.c (tuiSetLocatorInfo): Likewise. (tuiSwitchFilename): Likewise. (tuiUpdateLocatorInfoFromFrame): Likewise. (tuiSetLocatorContent): Likewise. (tuiShowFrameInfo): Likewise. * tuiDisassem.h: Update prototypes to use CORE_ADDR. * tuiSourceWin.h: Likewise. * tuiStack.h: Likewise. --- gdb/tui/ChangeLog | 23 +++++++++++++++++++++++ gdb/tui/tuiData.h | 4 ++-- gdb/tui/tuiDisassem.c | 26 +++++++++++++------------- gdb/tui/tuiDisassem.h | 6 +++--- gdb/tui/tuiLayout.c | 12 ++++++------ gdb/tui/tuiSourceWin.c | 26 +++++++++++++------------- gdb/tui/tuiSourceWin.h | 2 +- gdb/tui/tuiStack.c | 14 +++++++------- gdb/tui/tuiStack.h | 2 +- 9 files changed, 69 insertions(+), 46 deletions(-) diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index bfa8370a42a..fd2b9cbd8fa 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,26 @@ +2001-07-18 Stephane Carrez + + * tuiData.h (TuiLocatorElement): Use CORE_ADDR for address member. + (TuiLineOrAddress): Likewise. + * tuiDisassem.c (tuiGetBeginAsmAddress): Use CORE_ADDR to specify + an address. + (tuiSetDisassemContent): Likewise. + (tuiShowDisassem, tuiShowDisassemAndUpdateSource): Likewise. + * tuiLayout.c (_extractDisplayStartAddr): Likewise. + (tuiSetLayout): Likewise. + * tuiSourceWin.c (tuiDisplayMainFunction): Likewise. + (tuiUpdateSourceWindowsWithAddr): Likewise. + (tuiUpdateSourceWindowsWithLine): Likewise. + (tuiSetHasBreakAt): Likewise. + * tuiStack.c (tuiSetLocatorInfo): Likewise. + (tuiSwitchFilename): Likewise. + (tuiUpdateLocatorInfoFromFrame): Likewise. + (tuiSetLocatorContent): Likewise. + (tuiShowFrameInfo): Likewise. + * tuiDisassem.h: Update prototypes to use CORE_ADDR. + * tuiSourceWin.h: Likewise. + * tuiStack.h: Likewise. + 2001-07-17 Stephane Carrez * tuiWin.c: Add missing includes. diff --git a/gdb/tui/tuiData.h b/gdb/tui/tuiData.h index 033cdaaa60d..0f590e23c49 100644 --- a/gdb/tui/tuiData.h +++ b/gdb/tui/tuiData.h @@ -142,7 +142,7 @@ TuiRegisterDisplayType, *TuiRegisterDisplayTypePtr; typedef union _TuiLineOrAddress { int lineNo; - Opaque addr; + CORE_ADDR addr; } TuiLineOrAddress, *TuiLineOrAddressPtr; @@ -195,7 +195,7 @@ typedef struct _TuiLocatorElement char fileName[MAX_LOCATOR_ELEMENT_LEN]; char procName[MAX_LOCATOR_ELEMENT_LEN]; int lineNo; - Opaque addr; + CORE_ADDR addr; } TuiLocatorElement, *TuiLocatorElementPtr; diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c index b80edd70bea..e73b40a66d7 100644 --- a/gdb/tui/tuiDisassem.c +++ b/gdb/tui/tuiDisassem.c @@ -49,12 +49,12 @@ static struct breakpoint *_hasBreak (CORE_ADDR); ** Function to set the disassembly window's content. */ TuiStatus -tuiSetDisassemContent (struct symtab *s, Opaque startAddr) +tuiSetDisassemContent (struct symtab *s, CORE_ADDR startAddr) { TuiStatus ret = TUI_FAILURE; struct ui_file *gdb_dis_out; - if (startAddr != (Opaque) NULL) + if (startAddr != 0) { register int i, desc; @@ -83,7 +83,7 @@ extern void strcat_address_numeric (CORE_ADDR, int, char *, int); disassemWin->detail.sourceInfo.startLineOrAddr.addr = startAddr; /* Now construct each line */ - for (curLine = 0, pc = (CORE_ADDR) startAddr; (curLine < maxLines);) + for (curLine = 0, pc = startAddr; (curLine < maxLines);) { TuiWinElementPtr element = (TuiWinElementPtr) disassemWin->generic.content[curLine]; struct breakpoint *bp; @@ -142,9 +142,9 @@ extern void strcat_address_numeric (CORE_ADDR, int, char *, int); ** Function to display the disassembly window with disassembled code. */ void -tuiShowDisassem (Opaque startAddr) +tuiShowDisassem (CORE_ADDR startAddr) { - struct symtab *s = find_pc_symtab ((CORE_ADDR) startAddr); + struct symtab *s = find_pc_symtab (startAddr); TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); tuiAddWinToLayout (DISASSEM_WIN); @@ -165,7 +165,7 @@ tuiShowDisassem (Opaque startAddr) ** Function to display the disassembly window. */ void -tuiShowDisassemAndUpdateSource (Opaque startAddr) +tuiShowDisassemAndUpdateSource (CORE_ADDR startAddr) { struct symtab_and_line sal; @@ -177,7 +177,7 @@ tuiShowDisassemAndUpdateSource (Opaque startAddr) ** 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 ((CORE_ADDR) startAddr, 0); + sal = find_pc_line (startAddr, 0); current_source_symtab = sal.symtab; tuiUpdateSourceWindow (srcWin, sal.symtab, (Opaque) sal.line, TRUE); tuiUpdateLocatorFilename (sal.symtab->filename); @@ -211,24 +211,24 @@ tuiShowDisassemAsIs (Opaque addr) /* ** tuiGetBeginAsmAddress(). */ -Opaque +CORE_ADDR tuiGetBeginAsmAddress (void) { TuiGenWinInfoPtr locator; TuiLocatorElementPtr element; - Opaque addr; + CORE_ADDR addr; locator = locatorWinInfoPtr (); element = &((TuiWinElementPtr) locator->content[0])->whichElement.locator; - if (element->addr == (Opaque) 0) + if (element->addr == 0) { /*the target is not executing, because the pc is 0 */ - addr = (Opaque) parse_and_eval_address ("main"); + addr = parse_and_eval_address ("main"); - if (addr == (Opaque) 0) - addr = (Opaque) parse_and_eval_address ("MAIN"); + if (addr == 0) + addr = parse_and_eval_address ("MAIN"); } else /* the target is executing */ diff --git a/gdb/tui/tuiDisassem.h b/gdb/tui/tuiDisassem.h index a23d5652534..d977fab8f50 100644 --- a/gdb/tui/tuiDisassem.h +++ b/gdb/tui/tuiDisassem.h @@ -31,11 +31,11 @@ /***************************************** ** PUBLIC FUNCTION EXTERNAL DECLS ** ******************************************/ -extern TuiStatus tuiSetDisassemContent (struct symtab *, Opaque); -extern void tuiShowDisassem (Opaque); +extern TuiStatus tuiSetDisassemContent (struct symtab *, CORE_ADDR); +extern void tuiShowDisassem (CORE_ADDR); extern void tuiShowDisassemAndUpdateSource (Opaque); extern void tuiVerticalDisassemScroll (TuiScrollDirection, int); -extern Opaque tuiGetBeginAsmAddress (void); +extern CORE_ADDR tuiGetBeginAsmAddress (void); #endif /*_TUI_DISASSEM_H*/ diff --git a/gdb/tui/tuiLayout.c b/gdb/tui/tuiLayout.c index 5db7f083246..3a0d0cef497 100644 --- a/gdb/tui/tuiLayout.c +++ b/gdb/tui/tuiLayout.c @@ -58,7 +58,7 @@ static void _tuiToggleLayout_command (char *, int); static void _tui_vToggleLayout_command (va_list); static void _tuiToggleSplitLayout_command (char *, int); static void _tui_vToggleSplitLayout_command (va_list); -static Opaque _extractDisplayStartAddr (void); +static CORE_ADDR _extractDisplayStartAddr (void); static void _tuiHandleXDBLayout (TuiLayoutDefPtr); static TuiStatus _tuiSetLayoutTo (char *); @@ -152,7 +152,7 @@ tuiSetLayout (TuiLayoutType layoutType, { TuiLayoutType curLayout = currentLayout (), newLayout = UNDEFINED_LAYOUT; int regsPopulate = FALSE; - Opaque addr = _extractDisplayStartAddr (); + CORE_ADDR addr = _extractDisplayStartAddr (); TuiWinInfoPtr newWinWithFocus = (TuiWinInfoPtr) NULL, winWithFocus = tuiWinWithFocus (); TuiLayoutDefPtr layoutDef = tuiLayoutDef (); @@ -581,11 +581,11 @@ _tuiSetLayoutTo (char *layoutName) } /* _tuiSetLayoutTo */ -static Opaque +static CORE_ADDR _extractDisplayStartAddr (void) { TuiLayoutType curLayout = currentLayout (); - Opaque addr; + CORE_ADDR addr; CORE_ADDR pc; switch (curLayout) @@ -595,7 +595,7 @@ _extractDisplayStartAddr (void) find_line_pc (current_source_symtab, srcWin->detail.sourceInfo.startLineOrAddr.lineNo, &pc); - addr =(Opaque) pc; + addr = pc; break; case DISASSEM_COMMAND: case SRC_DISASSEM_COMMAND: @@ -603,7 +603,7 @@ _extractDisplayStartAddr (void) addr = disassemWin->detail.sourceInfo.startLineOrAddr.addr; break; default: - addr = (Opaque) NULL; + addr = 0; break; } diff --git a/gdb/tui/tuiSourceWin.c b/gdb/tui/tuiSourceWin.c index 4bfc04e2024..8edb60bab11 100644 --- a/gdb/tui/tuiSourceWin.c +++ b/gdb/tui/tuiSourceWin.c @@ -28,6 +28,8 @@ #include "tui.h" #include "tuiData.h" #include "tuiStack.h" +#include "tuiWin.h" +#include "tuiGeneralWin.h" #include "tuiSourceWin.h" #include "tuiSource.h" #include "tuiDisassem.h" @@ -93,13 +95,13 @@ tuiDisplayMainFunction (void) CORE_ADDR addr; addr = parse_and_eval_address ("main"); - if (addr <= (CORE_ADDR) 0) + if (addr == (CORE_ADDR) 0) addr = parse_and_eval_address ("MAIN"); - if (addr > (CORE_ADDR) 0) + if (addr != (CORE_ADDR) 0) { struct symtab_and_line sal; - tuiUpdateSourceWindowsWithAddr ((Opaque) addr); + tuiUpdateSourceWindowsWithAddr (addr); sal = find_pc_line (addr, 0); tuiSwitchFilename (sal.symtab->filename); } @@ -178,9 +180,9 @@ tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s, ** reflect the input address. */ void -tuiUpdateSourceWindowsWithAddr (Opaque addr) +tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr) { - if (addr > (Opaque) NULL) + if (addr != 0) { struct symtab_and_line sal; @@ -194,10 +196,8 @@ tuiUpdateSourceWindowsWithAddr (Opaque addr) tuiShowDisassemAndUpdateSource (addr); break; default: - sal = find_pc_line ((CORE_ADDR) addr, 0); - tuiShowSource (sal.symtab, - (Opaque) sal.line, - FALSE); + sal = find_pc_line (addr, 0); + tuiShowSource (sal.symtab, sal.line, FALSE); break; } } @@ -248,14 +248,14 @@ tuiUpdateSourceWindowsWithLine (struct symtab *s, int line) case DISASSEM_COMMAND: case DISASSEM_DATA_COMMAND: find_line_pc (s, line, &pc); - tuiUpdateSourceWindowsWithAddr ((Opaque) pc); + tuiUpdateSourceWindowsWithAddr (pc); break; default: - tuiShowSource (s, (Opaque) line, FALSE); + tuiShowSource (s, line, FALSE); if (currentLayout () == SRC_DISASSEM_COMMAND) { find_line_pc (s, line, &pc); - tuiShowDisassem ((Opaque) pc); + tuiShowDisassem (pc); } break; } @@ -527,7 +527,7 @@ tuiSetHasBreakAt (struct breakpoint *bp, TuiWinInfoPtr winInfo, int hasBreak) } else gotIt = (content[i]->whichElement.source.lineOrAddr.addr - == (Opaque) bp->address); + == bp->address); if (gotIt) { content[i]->whichElement.source.hasBreak = hasBreak; diff --git a/gdb/tui/tuiSourceWin.h b/gdb/tui/tuiSourceWin.h index b5127d909b3..fcc2bd46472 100644 --- a/gdb/tui/tuiSourceWin.h +++ b/gdb/tui/tuiSourceWin.h @@ -27,7 +27,7 @@ extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, Opaque, int); extern void tuiUpdateSourceWindowAsIs (TuiWinInfoPtr, struct symtab *, Opaque, int); -extern void tuiUpdateSourceWindowsWithAddr (Opaque); +extern void tuiUpdateSourceWindowsWithAddr (CORE_ADDR); extern void tui_vUpdateSourceWindowsWithAddr (va_list); extern void tuiUpdateSourceWindowsWithLine (struct symtab *, int); extern void tui_vUpdateSourceWindowsWithLine (va_list); diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c index edff5cb988a..80fb33d58e6 100644 --- a/gdb/tui/tuiStack.c +++ b/gdb/tui/tuiStack.c @@ -113,7 +113,7 @@ tuiShowLocatorContent (void) */ void tuiSetLocatorInfo (char *fname, char *procname, int lineNo, - Opaque addr, TuiLocatorElementPtr element) + CORE_ADDR addr, TuiLocatorElementPtr element) { #ifdef COMMENT /* first free the old info */ @@ -137,7 +137,7 @@ tuiSetLocatorInfo (char *fname, char *procname, int lineNo, strcat_to_buf (element->procName, MAX_LOCATOR_ELEMENT_LEN, procname); #endif element->lineNo = lineNo; - element->addr = (Opaque) addr; + element->addr = addr; return; } /* tuiSetLocatorInfo */ @@ -198,7 +198,7 @@ tuiSwitchFilename (char *fileName) tuiSetLocatorInfo (fileName, (char *) NULL, 0, - (Opaque) NULL, + (CORE_ADDR) 0, &((TuiWinElementPtr) locator->content[0])->whichElement.locator); tuiShowLocatorContent (); @@ -251,13 +251,13 @@ tuiUpdateLocatorInfoFromFrame (struct frame_info *frameInfo, tuiSetLocatorInfo (symtabAndLine.symtab->filename, _getFuncNameFromFrame (frameInfo), symtabAndLine.line, - (Opaque) frameInfo->pc, + frameInfo->pc, element); else tuiSetLocatorInfo ((char *) NULL, _getFuncNameFromFrame (frameInfo), 0, - (Opaque) frameInfo->pc, + frameInfo->pc, element); return; @@ -292,7 +292,7 @@ tuiSetLocatorContent (struct frame_info *frameInfo) tuiSetLocatorInfo ((char *) NULL, (char *) NULL, 0, - (Opaque) NULL, + (CORE_ADDR) 0, &((TuiWinElementPtr) locator->content[0])->whichElement.locator); return; } /* tuiSetLocatorContent */ @@ -354,7 +354,7 @@ tuiShowFrameInfo (struct frame_info *fi) 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 = (CORE_ADDR) tuiGetLowDisassemblyAddress ((Opaque) low, (Opaque) fi->pc); + low = tuiGetLowDisassemblyAddress (low, fi->pc); } if (winInfo == srcWin) diff --git a/gdb/tui/tuiStack.h b/gdb/tui/tuiStack.h index fcb86d285b3..6a987eb8d66 100644 --- a/gdb/tui/tuiStack.h +++ b/gdb/tui/tuiStack.h @@ -25,7 +25,7 @@ ** This header file supports */ -extern void tuiSetLocatorInfo (char *, char *, int, Opaque, +extern void tuiSetLocatorInfo (char *, char *, int, CORE_ADDR, TuiLocatorElementPtr); extern void tuiUpdateLocatorFilename (char *); extern void tui_vUpdateLocatorFilename (va_list); -- 2.30.2