From 22940a245df9e2473270137fbfbf1280db4eebcf Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 7 Feb 2004 17:46:14 +0000 Subject: [PATCH] 2004-02-07 Andrew Cagney * tui/tui.h (Opaque, OpaquePtr OpaqueList): Delete definition. (TuiPoint, TuiPointPtr): Ditto. (TuiStatus, TuiStatusPtr): Ditto. (TuiWinType, TuiWinTypePtr): Ditto. (struct tui_point): Rename _TuiPoint. (tui_get_low_disassembly_address): Rename tuiGetLowDisassemblyAddress. (tui_update_all_exec_infos): Rename tuiUpdateAllExecInfos. (tuiFree): Delete declaration. (OpaqueFuncPtr, TuiOpaqueFuncPtr): Delete definitions. (TuiVoidFuncPtr, TuiIntFuncPtr): Delete definitions. * tui/tui.c (tuiFree): Delete function. * cli/cli-cmds.c (disassemble_command): Update references. * tui/tui-data.c, tui/tui-data.h, tui/tui-disasm.c: Ditto. * tui/tui-layout.c, tui/tui-regs.c, tui/tui-source.c: Ditto. * tui/tui-stack.c, tui/tui-win.c, tui/tui-wingeneral.c: Ditto. * tui/tui-winsource.c: Ditto. --- gdb/ChangeLog | 20 ++++++++++ gdb/cli/cli-cmds.c | 10 +++-- gdb/tui/tui-data.c | 73 +++++++++++++++++----------------- gdb/tui/tui-data.h | 16 ++++---- gdb/tui/tui-disasm.c | 6 +-- gdb/tui/tui-layout.c | 46 +++++++++++----------- gdb/tui/tui-regs.c | 44 ++++++++++----------- gdb/tui/tui-source.c | 6 +-- gdb/tui/tui-stack.c | 6 +-- gdb/tui/tui-win.c | 20 +++++----- gdb/tui/tui-wingeneral.c | 2 +- gdb/tui/tui-winsource.c | 22 +++++------ gdb/tui/tui.c | 13 +----- gdb/tui/tui.h | 85 ++++++++++++++++------------------------ 14 files changed, 179 insertions(+), 190 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f1a24b303b5..86f3449c558 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2004-02-07 Andrew Cagney + + * tui/tui.h (Opaque, OpaquePtr OpaqueList): Delete definition. + (TuiPoint, TuiPointPtr): Ditto. + (TuiStatus, TuiStatusPtr): Ditto. + (TuiWinType, TuiWinTypePtr): Ditto. + (struct tui_point): Rename _TuiPoint. + (tui_get_low_disassembly_address): Rename + tuiGetLowDisassemblyAddress. + (tui_update_all_exec_infos): Rename tuiUpdateAllExecInfos. + (tuiFree): Delete declaration. + (OpaqueFuncPtr, TuiOpaqueFuncPtr): Delete definitions. + (TuiVoidFuncPtr, TuiIntFuncPtr): Delete definitions. + * tui/tui.c (tuiFree): Delete function. + * cli/cli-cmds.c (disassemble_command): Update references. + * tui/tui-data.c, tui/tui-data.h, tui/tui-disasm.c: Ditto. + * tui/tui-layout.c, tui/tui-regs.c, tui/tui-source.c: Ditto. + * tui/tui-stack.c, tui/tui-win.c, tui/tui-wingeneral.c: Ditto. + * tui/tui-winsource.c: Ditto. + 2004-02-07 Elena Zannoni * objfiles.h (struct objfile): Add objfile_obstack field. diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 8f2e5e34119..70cec1743b0 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -850,8 +850,9 @@ disassemble_command (char *arg, int from_tty) #if defined(TUI) /* NOTE: cagney/2003-02-13 The `tui_active' was previously `tui_version'. */ - else if (tui_active) - low = tuiGetLowDisassemblyAddress (low, pc); + if (tui_active) + /* FIXME: cagney/2004-02-07: This should be an observer. */ + low = tui_get_low_disassembly_address (low, pc); #endif low += FUNCTION_START_OFFSET; } @@ -864,8 +865,9 @@ disassemble_command (char *arg, int from_tty) #if defined(TUI) /* NOTE: cagney/2003-02-13 The `tui_active' was previously `tui_version'. */ - else if (tui_active) - low = tuiGetLowDisassemblyAddress (low, pc); + if (tui_active) + /* FIXME: cagney/2004-02-07: This should be an observer. */ + low = tui_get_low_disassembly_address (low, pc); #endif low += FUNCTION_START_OFFSET; } diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index b962eee22e5..752f4ceb726 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -49,8 +49,7 @@ static int _termHeight, _termWidth; static struct tui_gen_win_info _locator; static struct tui_gen_win_info _execInfo[2]; static struct tui_win_info * _srcWinList[2]; -static struct tui_list _sourceWindows = -{(OpaqueList) _srcWinList, 0}; +static struct tui_list _sourceWindows = {(void **) _srcWinList, 0}; static int _defaultTabLen = DEFAULT_TAB_LEN; static struct tui_win_info * _winWithFocus = (struct tui_win_info *) NULL; static struct tui_layout_def _layoutDef = @@ -64,8 +63,8 @@ static int _winResized = FALSE; /********************************* ** Static function forward decls **********************************/ -static void freeContent (tui_win_content, int, TuiWinType); -static void freeContentElements (tui_win_content, int, TuiWinType); +static void freeContent (tui_win_content, int, enum tui_win_type); +static void freeContentElements (tui_win_content, int, enum tui_win_type); @@ -152,8 +151,8 @@ tui_source_windows (void) void tui_clear_source_windows (void) { - _sourceWindows.list[0] = (Opaque) NULL; - _sourceWindows.list[1] = (Opaque) NULL; + _sourceWindows.list[0] = NULL; + _sourceWindows.list[1] = NULL; _sourceWindows.count = 0; } @@ -176,7 +175,7 @@ void tui_add_to_source_windows (struct tui_win_info * winInfo) { if (_sourceWindows.count < 2) - _sourceWindows.list[_sourceWindows.count++] = (Opaque) winInfo; + _sourceWindows.list[_sourceWindows.count++] = (void *) winInfo; } @@ -321,7 +320,7 @@ setGenWinOrigin (struct tui_gen_win_info * winInfo, int x, int y) struct tui_win_info * tui_next_win (struct tui_win_info * curWin) { - TuiWinType type = curWin->generic.type; + enum tui_win_type type = curWin->generic.type; struct tui_win_info * nextWin = (struct tui_win_info *) NULL; if (curWin->generic.type == CMD_WIN) @@ -350,7 +349,7 @@ tui_next_win (struct tui_win_info * curWin) struct tui_win_info * tui_prev_win (struct tui_win_info * curWin) { - TuiWinType type = curWin->generic.type; + enum tui_win_type type = curWin->generic.type; struct tui_win_info * prev = (struct tui_win_info *) NULL; if (curWin->generic.type == SRC_WIN) @@ -469,7 +468,7 @@ tui_init_generic_part (struct tui_gen_win_info * win) win->contentSize = win->lastVisibleLine = 0; win->handle = (WINDOW *) NULL; - win->content = (OpaquePtr) NULL; + win->content = NULL; win->contentInUse = win->isVisible = FALSE; win->title = 0; @@ -480,7 +479,7 @@ tui_init_generic_part (struct tui_gen_win_info * win) ** initContentElement(). */ void -initContentElement (struct tui_win_element * element, TuiWinType type) +initContentElement (struct tui_win_element * element, enum tui_win_type type) { element->highlight = FALSE; switch (type) @@ -496,7 +495,7 @@ initContentElement (struct tui_win_element * element, TuiWinType type) tui_init_generic_part (&element->whichElement.dataWindow); element->whichElement.dataWindow.type = DATA_ITEM_WIN; ((struct tui_gen_win_info *) & element->whichElement.dataWindow)->content = - (OpaquePtr) tui_alloc_content (1, DATA_ITEM_WIN); + (void **) tui_alloc_content (1, DATA_ITEM_WIN); ((struct tui_gen_win_info *) & element->whichElement.dataWindow)->contentSize = 1; break; @@ -507,7 +506,7 @@ initContentElement (struct tui_win_element * element, TuiWinType type) element->whichElement.data.name = (char *) NULL; element->whichElement.data.type = TUI_REGISTER; element->whichElement.data.itemNo = UNDEFINED_ITEM; - element->whichElement.data.value = (Opaque) NULL; + element->whichElement.data.value = NULL; element->whichElement.data.highlight = FALSE; break; case LOCATOR_WIN: @@ -560,7 +559,7 @@ initWinInfo (struct tui_win_info * winInfo) winInfo->detail.commandInfo.curch = 0; break; default: - winInfo->detail.opaque = (Opaque) NULL; + winInfo->detail.opaque = NULL; break; } @@ -569,7 +568,7 @@ initWinInfo (struct tui_win_info * winInfo) struct tui_win_info * -tui_alloc_win_info (TuiWinType type) +tui_alloc_win_info (enum tui_win_type type) { struct tui_win_info * winInfo = (struct tui_win_info *) NULL; @@ -589,7 +588,7 @@ tui_alloc_win_info (TuiWinType type) ** Allocates the content and elements in a block. */ tui_win_content -tui_alloc_content (int numElements, TuiWinType type) +tui_alloc_content (int numElements, enum tui_win_type type) { tui_win_content content = (tui_win_content) NULL; char *elementBlockPtr = (char *) NULL; @@ -616,7 +615,7 @@ tui_alloc_content (int numElements, TuiWinType type) } else { - tuiFree ((char *) content); + xfree (content); content = (tui_win_content) NULL; } } @@ -637,21 +636,21 @@ tui_add_content_elements (struct tui_gen_win_info * winInfo, int numElements) struct tui_win_element * elementPtr; int i, indexStart; - if (winInfo->content == (OpaquePtr) NULL) + if (winInfo->content == NULL) { - winInfo->content = (OpaquePtr) tui_alloc_content (numElements, winInfo->type); + winInfo->content = (void **) tui_alloc_content (numElements, winInfo->type); indexStart = 0; } else indexStart = winInfo->contentSize; - if (winInfo->content != (OpaquePtr) NULL) + if (winInfo->content != NULL) { for (i = indexStart; (i < numElements + indexStart); i++) { if ((elementPtr = (struct tui_win_element *) xmalloc (sizeof (struct tui_win_element))) != (struct tui_win_element *) NULL) { - winInfo->content[i] = (Opaque) elementPtr; + winInfo->content[i] = (void *) elementPtr; initContentElement (elementPtr, winInfo->type); winInfo->contentSize++; } @@ -696,7 +695,7 @@ tuiDelWindow (struct tui_win_info * winInfo) } break; case DATA_WIN: - if (winInfo->generic.content != (OpaquePtr) NULL) + if (winInfo->generic.content != NULL) { tui_del_data_windows (winInfo->detail.dataDisplayInfo.regsContent, winInfo->detail.dataDisplayInfo.regsContentCount); @@ -746,7 +745,7 @@ tui_free_window (struct tui_win_info * winInfo) } break; case DATA_WIN: - if (winInfo->generic.content != (OpaquePtr) NULL) + if (winInfo->generic.content != NULL) { tui_free_data_content (winInfo->detail.dataDisplayInfo.regsContent, winInfo->detail.dataDisplayInfo.regsContentCount); @@ -762,7 +761,7 @@ tui_free_window (struct tui_win_info * winInfo) TUI_UNDEFINED_REGS; winInfo->detail.dataDisplayInfo.regsColumnCount = 1; winInfo->detail.dataDisplayInfo.displayRegs = FALSE; - winInfo->generic.content = (OpaquePtr) NULL; + winInfo->generic.content = NULL; winInfo->generic.contentSize = 0; } break; @@ -802,12 +801,12 @@ tui_free_all_source_wins_content (void) void tui_free_win_content (struct tui_gen_win_info * winInfo) { - if (winInfo->content != (OpaquePtr) NULL) + if (winInfo->content != NULL) { freeContent ((tui_win_content) winInfo->content, winInfo->contentSize, winInfo->type); - winInfo->content = (OpaquePtr) NULL; + winInfo->content = NULL; } winInfo->contentSize = 0; @@ -875,12 +874,12 @@ tui_free_data_content (tui_win_content content, int contentSize) ** freeContent(). */ static void -freeContent (tui_win_content content, int contentSize, TuiWinType winType) +freeContent (tui_win_content content, int contentSize, enum tui_win_type winType) { if (content != (tui_win_content) NULL) { freeContentElements (content, contentSize, winType); - tuiFree ((char *) content); + xfree (content); } return; @@ -891,7 +890,7 @@ freeContent (tui_win_content content, int contentSize, TuiWinType winType) ** freeContentElements(). */ static void -freeContentElements (tui_win_content content, int contentSize, TuiWinType type) +freeContentElements (tui_win_content content, int contentSize, enum tui_win_type type) { if (content != (tui_win_content) NULL) { @@ -900,8 +899,7 @@ freeContentElements (tui_win_content content, int contentSize, TuiWinType type) if (type == SRC_WIN || type == DISASSEM_WIN) { /* free whole source block */ - if (content[0]->whichElement.source.line != (char *) NULL) - tuiFree (content[0]->whichElement.source.line); + xfree (content[0]->whichElement.source.line); } else { @@ -915,7 +913,7 @@ freeContentElements (tui_win_content content, int contentSize, TuiWinType type) switch (type) { case DATA_WIN: - tuiFree ((char *) element); + xfree (element); break; case DATA_ITEM_WIN: /* @@ -923,13 +921,12 @@ freeContentElements (tui_win_content content, int contentSize, TuiWinType type) ** in a single block, but individually, as needed. */ if (element->whichElement.data.type != TUI_REGISTER) - tuiFree ((char *) - element->whichElement.data.name); - tuiFree ((char *) element->whichElement.data.value); - tuiFree ((char *) element); + xfree ((void *)element->whichElement.data.name); + xfree (element->whichElement.data.value); + xfree (element); break; case CMD_WIN: - tuiFree ((char *) element->whichElement.command.line); + xfree (element->whichElement.command.line); break; default: break; @@ -938,7 +935,7 @@ freeContentElements (tui_win_content content, int contentSize, TuiWinType type) } } if (type != DATA_WIN && type != DATA_ITEM_WIN) - tuiFree ((char *) content[0]); /* free the element block */ + xfree (content[0]); /* free the element block */ } return; diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index e0269cb1265..82c03ad683c 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -35,11 +35,11 @@ struct tui_gen_win_info { WINDOW *handle; /* window handle */ - TuiWinType type; /* type of window */ + enum tui_win_type type; /* type of window */ int width; /* window width */ int height; /* window height */ - TuiPoint origin; /* origin of window */ - OpaquePtr content; /* content of window */ + struct tui_point origin; /* origin of window */ + void **content; /* content of window */ int contentSize; /* Size of content (# of elements) */ int contentInUse; /* Can it be used, or is it already used? */ int viewportHeight; /* viewport height */ @@ -107,7 +107,7 @@ enum tui_scroll_direction /* General list struct. */ struct tui_list { - OpaqueList list; + void **list; int count; }; @@ -153,7 +153,7 @@ union tui_line_or_address /* Current Layout definition */ struct tui_layout_def { - TuiWinType displayMode; + enum tui_win_type displayMode; int split; enum tui_register_display_type regsDisplayType; enum tui_register_display_type floatRegsDisplayType; @@ -175,7 +175,7 @@ struct tui_data_element const char *name; int itemNo; /* the register number, or data display number */ enum tui_data_type type; - Opaque value; + void *value; int highlight; }; @@ -276,7 +276,7 @@ struct tui_win_info struct tui_source_info sourceInfo; struct tui_data_info dataDisplayInfo; struct tui_command_info commandInfo; - Opaque opaque; + void *opaque; } detail; int canHighlight; /* Can this window ever be highlighted? */ @@ -324,7 +324,7 @@ extern struct tui_win_info *(winList[MAX_MAJOR_WINDOWS]); /* Data Manipulation Functions */ extern void tui_initialize_static_data (void); extern struct tui_gen_win_info *tui_alloc_generic_win_info (void); -extern struct tui_win_info *tui_alloc_win_info (TuiWinType); +extern struct tui_win_info *tui_alloc_win_info (enum tui_win_type); extern void tui_init_generic_part (struct tui_gen_win_info *); extern void tui_init_win_info (struct tui_win_info *); extern tui_win_content tui_alloc_content (int, enum tui_win_type); diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 00c2a81b186..1143ba2b7f3 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -175,7 +175,7 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) enum tui_status tui_set_disassem_content (CORE_ADDR pc) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; register int i; register int offset = disassemWin->detail.sourceInfo.horizontalOffset; register int lineWidth, maxLines; @@ -358,7 +358,7 @@ tui_get_begin_asm_address (void) disassembly window. This may or may not be the same as the low address input. */ CORE_ADDR -tuiGetLowDisassemblyAddress (CORE_ADDR low, CORE_ADDR pc) +tui_get_low_disassembly_address (CORE_ADDR low, CORE_ADDR pc) { int pos; @@ -377,7 +377,7 @@ void tui_vertical_disassem_scroll (enum tui_scroll_direction scrollDirection, int numToScroll) { - if (disassemWin->generic.content != (OpaquePtr) NULL) + if (disassemWin->generic.content != NULL) { CORE_ADDR pc; tui_win_content content; diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index e4a5d21b2c3..f6dde02a7b1 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -51,10 +51,10 @@ ** Static Local Decls ********************************/ static void showLayout (enum tui_layout_type); -static void _initGenWinInfo (struct tui_gen_win_info *, TuiWinType, int, int, int, int); -static void _initAndMakeWin (Opaque *, TuiWinType, int, int, int, int, int); +static void _initGenWinInfo (struct tui_gen_win_info *, enum tui_win_type, int, int, int, int); +static void _initAndMakeWin (void **, enum tui_win_type, int, int, int, int, int); static void _showSourceOrDisassemAndCommand (enum tui_layout_type); -static void _makeSourceOrDisassemWindow (struct tui_win_info * *, TuiWinType, int, int); +static void _makeSourceOrDisassemWindow (struct tui_win_info * *, enum tui_win_type, int, int); static void _makeCommandWindow (struct tui_win_info * *, int, int); static void _makeSourceWindow (struct tui_win_info * *, int, int); static void _makeDisassemWindow (struct tui_win_info * *, int, int); @@ -137,7 +137,7 @@ enum tui_status tui_set_layout (enum tui_layout_type layoutType, enum tui_register_display_type regsDisplayType) { - TuiStatus status = TUI_SUCCESS; + enum tui_status status = TUI_SUCCESS; if (layoutType != UNDEFINED_LAYOUT || regsDisplayType != TUI_UNDEFINED_REGS) { @@ -325,7 +325,7 @@ tui_add_win_to_layout (enum tui_win_type type) ** type and the layout. */ int -tuiDefaultWinHeight (TuiWinType type, enum tui_layout_type layout) +tuiDefaultWinHeight (enum tui_win_type type, enum tui_layout_type layout) { int h; @@ -422,10 +422,10 @@ Source/Disassembly/Command layouts.\n"); ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS, ** $REGS, $GREGS, $FREGS, $SREGS. */ -TuiStatus +enum tui_status tui_set_layout_for_display_command (const char *layoutName) { - TuiStatus status = TUI_SUCCESS; + enum tui_status status = TUI_SUCCESS; if (layoutName != (char *) NULL) { @@ -673,7 +673,7 @@ _prevLayout (void) static void _makeCommandWindow (struct tui_win_info * * winInfoPtr, int height, int originY) { - _initAndMakeWin ((Opaque *) winInfoPtr, + _initAndMakeWin ((void **) winInfoPtr, CMD_WIN, height, tui_term_width (), @@ -717,7 +717,7 @@ _makeDisassemWindow (struct tui_win_info * * winInfoPtr, int height, int originY static void _makeDataWindow (struct tui_win_info * * winInfoPtr, int height, int originY) { - _initAndMakeWin ((Opaque *) winInfoPtr, + _initAndMakeWin ((void **) winInfoPtr, DATA_WIN, height, tui_term_width (), @@ -804,7 +804,7 @@ _showSourceDisassemCommand (void) if (m_winPtrIsNull (disassemWin)) { _makeDisassemWindow (&disassemWin, asmHeight, srcHeight - 1); - _initAndMakeWin ((Opaque *) & locator, + _initAndMakeWin ((void **) & locator, LOCATOR_WIN, 2 /* 1 */ , tui_term_width (), @@ -881,7 +881,7 @@ _showData (enum tui_layout_type newLayout) { int totalHeight = (tui_term_height () - cmdWin->generic.height); int srcHeight, dataHeight; - TuiWinType winType; + enum tui_win_type winType; struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); @@ -901,7 +901,7 @@ _showData (enum tui_layout_type newLayout) _makeSourceWindow (&winList[winType], srcHeight, dataHeight - 1); else _makeDisassemWindow (&winList[winType], srcHeight, dataHeight - 1); - _initAndMakeWin ((Opaque *) & locator, + _initAndMakeWin ((void **) & locator, LOCATOR_WIN, 2 /* 1 */ , tui_term_width (), @@ -945,7 +945,7 @@ _showData (enum tui_layout_type newLayout) ** _initGenWinInfo(). */ static void -_initGenWinInfo (struct tui_gen_win_info * winInfo, TuiWinType type, +_initGenWinInfo (struct tui_gen_win_info * winInfo, enum tui_win_type type, int height, int width, int originX, int originY) { int h = height; @@ -971,25 +971,25 @@ _initGenWinInfo (struct tui_gen_win_info * winInfo, TuiWinType type, ** _initAndMakeWin(). */ static void -_initAndMakeWin (Opaque * winInfoPtr, TuiWinType winType, +_initAndMakeWin (void ** winInfoPtr, enum tui_win_type winType, int height, int width, int originX, int originY, int boxIt) { - Opaque opaqueWinInfo = *winInfoPtr; + void *opaqueWinInfo = *winInfoPtr; struct tui_gen_win_info * generic; - if (opaqueWinInfo == (Opaque) NULL) + if (opaqueWinInfo == NULL) { if (m_winIsAuxillary (winType)) - opaqueWinInfo = (Opaque) tui_alloc_generic_win_info (); + opaqueWinInfo = (void *) tui_alloc_generic_win_info (); else - opaqueWinInfo = (Opaque) tui_alloc_win_info (winType); + opaqueWinInfo = (void *) tui_alloc_win_info (winType); } if (m_winIsAuxillary (winType)) generic = (struct tui_gen_win_info *) opaqueWinInfo; else generic = &((struct tui_win_info *) opaqueWinInfo)->generic; - if (opaqueWinInfo != (Opaque) NULL) + if (opaqueWinInfo != NULL) { _initGenWinInfo (generic, winType, height, width, originX, originY); if (!m_winIsAuxillary (winType)) @@ -1009,7 +1009,7 @@ _initAndMakeWin (Opaque * winInfoPtr, TuiWinType winType, ** _makeSourceOrDisassemWindow(). */ static void -_makeSourceOrDisassemWindow (struct tui_win_info * * winInfoPtr, TuiWinType type, +_makeSourceOrDisassemWindow (struct tui_win_info * * winInfoPtr, enum tui_win_type type, int height, int originY) { struct tui_gen_win_info * executionInfo = (struct tui_gen_win_info *) NULL; @@ -1021,7 +1021,7 @@ _makeSourceOrDisassemWindow (struct tui_win_info * * winInfoPtr, TuiWinType type executionInfo = tui_source_exec_info_win_ptr (); else executionInfo = tui_disassem_exec_info_win_ptr (); - _initAndMakeWin ((Opaque *) & executionInfo, + _initAndMakeWin ((void **) & executionInfo, EXEC_INFO_WIN, height, 3, @@ -1031,7 +1031,7 @@ _makeSourceOrDisassemWindow (struct tui_win_info * * winInfoPtr, TuiWinType type /* ** Now create the source window. */ - _initAndMakeWin ((Opaque *) winInfoPtr, + _initAndMakeWin ((void **) winInfoPtr, type, height, tui_term_width () - executionInfo->width, @@ -1076,7 +1076,7 @@ _showSourceOrDisassemAndCommand (enum tui_layout_type layoutType) _makeSourceWindow (winInfoPtr, srcHeight - 1, 0); else _makeDisassemWindow (winInfoPtr, srcHeight - 1, 0); - _initAndMakeWin ((Opaque *) & locator, + _initAndMakeWin ((void **) & locator, LOCATOR_WIN, 2 /* 1 */ , tui_term_width (), diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 94fa914da71..e5222c297ca 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -76,19 +76,19 @@ /***************************************** ** STATIC LOCAL FUNCTIONS FORWARD DECLS ** ******************************************/ -static TuiStatus _tuiSetRegsContent +static enum tui_status _tuiSetRegsContent (int, int, struct frame_info *, enum tui_register_display_type, int); static const char *_tuiRegisterName (int); -static TuiStatus _tuiGetRegisterRawValue (int, char *, struct frame_info *); +static enum tui_status _tuiGetRegisterRawValue (int, char *, struct frame_info *); static void _tuiSetRegisterElement (int, struct frame_info *, struct tui_data_element *, int); static void _tuiDisplayRegister (int, struct tui_gen_win_info *, enum precision_type); static void _tuiRegisterFormat (char *, int, int, struct tui_data_element *, enum precision_type); -static TuiStatus _tuiSetGeneralRegsContent (int); -static TuiStatus _tuiSetSpecialRegsContent (int); -static TuiStatus _tuiSetGeneralAndSpecialRegsContent (int); -static TuiStatus _tuiSetFloatRegsContent (enum tui_register_display_type, int); +static enum tui_status _tuiSetGeneralRegsContent (int); +static enum tui_status _tuiSetSpecialRegsContent (int); +static enum tui_status _tuiSetGeneralAndSpecialRegsContent (int); +static enum tui_status _tuiSetFloatRegsContent (enum tui_register_display_type, int); static int _tuiRegValueHasChanged (struct tui_data_element *, struct frame_info *, char *); static void _tuiShowFloat_command (char *, int); @@ -211,7 +211,7 @@ tui_calculate_regs_column_count (enum tui_register_display_type dpyType) void tui_show_registers (enum tui_register_display_type dpyType) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; int refreshValuesOnly = FALSE; /* Say that registers should be displayed, even if there is a problem */ @@ -641,7 +641,7 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum, ** _tuiSetGeneralRegsContent(). ** Set the content of the data window to consist of the general registers. */ -static TuiStatus +static enum tui_status _tuiSetGeneralRegsContent (int refreshValuesOnly) { return (_tuiSetRegsContent (0, @@ -663,10 +663,10 @@ _tuiSetGeneralRegsContent (int refreshValuesOnly) ** _tuiSetSpecialRegsContent(). ** Set the content of the data window to consist of the special registers. */ -static TuiStatus +static enum tui_status _tuiSetSpecialRegsContent (int refreshValuesOnly) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; int endRegNum; endRegNum = FP0_REGNUM - 1; @@ -684,10 +684,10 @@ _tuiSetSpecialRegsContent (int refreshValuesOnly) ** _tuiSetGeneralAndSpecialRegsContent(). ** Set the content of the data window to consist of the special registers. */ -static TuiStatus +static enum tui_status _tuiSetGeneralAndSpecialRegsContent (int refreshValuesOnly) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; int endRegNum = (-1); endRegNum = FP0_REGNUM - 1; @@ -701,10 +701,10 @@ _tuiSetGeneralAndSpecialRegsContent (int refreshValuesOnly) ** _tuiSetFloatRegsContent(). ** Set the content of the data window to consist of the float registers. */ -static TuiStatus +static enum tui_status _tuiSetFloatRegsContent (enum tui_register_display_type dpyType, int refreshValuesOnly) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; int startRegNum; startRegNum = FP0_REGNUM; @@ -759,10 +759,10 @@ _tuiRegValueHasChanged (struct tui_data_element * dataElement, ** _tuiGetRegisterRawValue(). ** Get the register raw value. The raw value is returned in regValue. */ -static TuiStatus +static enum tui_status _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; if (target_has_registers) { @@ -796,9 +796,9 @@ _tuiSetRegisterElement (int regNum, struct frame_info *frame, dataElement->name = _tuiRegisterName (regNum); dataElement->highlight = FALSE; } - if (dataElement->value == (Opaque) NULL) - dataElement->value = (Opaque) xmalloc (MAX_REGISTER_SIZE); - if (dataElement->value != (Opaque) NULL) + if (dataElement->value == NULL) + dataElement->value = xmalloc (MAX_REGISTER_SIZE); + if (dataElement->value != NULL) _tuiGetRegisterRawValue (regNum, dataElement->value, frame); } @@ -812,13 +812,13 @@ _tuiSetRegisterElement (int regNum, struct frame_info *frame, ** numbered from startRegNum to endRegNum. Note that if ** refreshValuesOnly is TRUE, startRegNum and endRegNum are ignored. */ -static TuiStatus +static enum tui_status _tuiSetRegsContent (int startRegNum, int endRegNum, struct frame_info *frame, enum tui_register_display_type dpyType, int refreshValuesOnly) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; int numRegs = endRegNum - startRegNum + 1; int allocatedHere = FALSE; @@ -842,7 +842,7 @@ _tuiSetRegsContent (int startRegNum, int endRegNum, if (!refreshValuesOnly || allocatedHere) { - dataWin->generic.content = (OpaquePtr) NULL; + dataWin->generic.content = NULL; dataWin->generic.contentSize = 0; tui_add_content_elements (&dataWin->generic, numRegs); dataWin->detail.dataDisplayInfo.regsContent = diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 8d68c7e86fe..530ee434455 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -48,7 +48,7 @@ enum tui_status tui_set_source_content (struct symtab *s, int lineNo, int noerror) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; if (s != (struct symtab *) NULL && s->filename != (char *) NULL) { @@ -214,7 +214,7 @@ tui_set_source_content (struct symtab *s, int lineNo, int noerror) curLineNo++; } if (offset > 0) - tuiFree (srcLine); + xfree (srcLine); fclose (stream); srcWin->generic.contentSize = nlines; ret = TUI_SUCCESS; @@ -323,7 +323,7 @@ void tui_vertical_source_scroll (enum tui_scroll_direction scrollDirection, int numToScroll) { - if (srcWin->generic.content != (OpaquePtr) NULL) + if (srcWin->generic.content != NULL) { union tui_line_or_address l; struct symtab *s; diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index e2f996ece43..e8cf9272f29 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -280,7 +280,7 @@ tui_set_locator_filename (const char *filename) struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); struct tui_locator_element * element; - if (locator->content[0] == (Opaque) NULL) + if (locator->content[0] == NULL) { tui_set_locator_info (filename, NULL, 0, 0); return; @@ -302,7 +302,7 @@ tui_set_locator_info (const char *filename, const char *procname, int lineno, /* Allocate the locator content if necessary. */ if (locator->contentSize <= 0) { - locator->content = (OpaquePtr) tui_alloc_content (1, locator->type); + locator->content = (void **) tui_alloc_content (1, locator->type); locator->contentSize = 1; } @@ -366,7 +366,7 @@ tui_show_frame_info (struct frame_info *fi) &low, (CORE_ADDR) NULL) == 0) error ("No function contains program counter for selected frame.\n"); else - low = tuiGetLowDisassemblyAddress (low, get_frame_pc (fi)); + low = tui_get_low_disassembly_address (low, get_frame_pc (fi)); } if (winInfo == srcWin) diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 43e11bb315b..d95c38a11ef 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -63,7 +63,7 @@ ********************************/ static void _makeVisibleWithNewHeight (struct tui_win_info *); static void _makeInvisibleAndSetNewHeight (struct tui_win_info *, int); -static TuiStatus _tuiAdjustWinHeights (struct tui_win_info *, int); +static enum tui_status _tuiAdjustWinHeights (struct tui_win_info *, int); static int _newHeightOk (struct tui_win_info *, int); static void _tuiSetTabWidth_command (char *, int); static void _tuiRefreshAll_command (char *, int); @@ -563,7 +563,7 @@ tui_scroll (enum tui_scroll_direction direction, void tui_refresh_all_win (void) { - TuiWinType type; + enum tui_win_type type; clearok (curscr, TRUE); tui_refresh_all (winList); @@ -613,7 +613,7 @@ tuiResizeAll (void) struct tui_win_info *firstWin; struct tui_win_info *secondWin; struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); - TuiWinType winType; + enum tui_win_type winType; int newHeight, splitDiff, cmdSplitDiff, numWinsDisplayed = 2; /* turn keypad off while we resize */ @@ -885,7 +885,7 @@ The window name specified must be valid and visible.\n"); if (dataWin && dataWin->generic.isVisible) tui_refresh_data_win (); - tuiFree (bufPtr); + xfree (bufPtr); printf_filtered ("Focus set to %s window.\n", tui_win_name ((struct tui_gen_win_info *) tui_win_with_focus ())); } @@ -913,7 +913,7 @@ _tuiSetFocus_command (char *arg, int fromTTY) static void _tuiAllWindowsInfo (char *arg, int fromTTY) { - TuiWinType type; + enum tui_win_type type; struct tui_win_info * winWithFocus = tui_win_with_focus (); for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++) @@ -1052,7 +1052,7 @@ The window name specified must be valid and visible.\n"); printf_filtered (WIN_HEIGHT_USAGE); if (buf != (char *) NULL) - tuiFree (buf); + xfree (buf); } else printf_filtered (WIN_HEIGHT_USAGE); @@ -1122,10 +1122,10 @@ _tuiXDBsetWinHeight_command (char *arg, int fromTTY) ** _tuiAdjustWinHeights(). ** Function to adjust all window heights around the primary */ -static TuiStatus +static enum tui_status _tuiAdjustWinHeights (struct tui_win_info * primaryWinInfo, int newHeight) { - TuiStatus status = TUI_FAILURE; + enum tui_status status = TUI_FAILURE; if (_newHeightOk (primaryWinInfo, newHeight)) { @@ -1350,7 +1350,7 @@ _makeVisibleWithNewHeight (struct tui_win_info * winInfo) case DISASSEM_WIN: tui_free_win_content (winInfo->detail.sourceInfo.executionInfo); tui_make_visible (winInfo->detail.sourceInfo.executionInfo); - if (winInfo->generic.content != (OpaquePtr) NULL) + if (winInfo->generic.content != NULL) { union tui_line_or_address lineOrAddr; struct symtab_and_line cursal @@ -1582,7 +1582,7 @@ The window name specified must be valid and visible.\n"); else if (*winToScroll == cmdWin) *winToScroll = (struct tui_win_info *) (tui_source_windows ())->list[0]; } - tuiFree (buf); + xfree (buf); } return; diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index da3aaa681ee..12fc4158482 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -252,7 +252,7 @@ tui_make_all_invisible (void) void tui_refresh_all (struct tui_win_info * * list) { - TuiWinType type; + enum tui_win_type type; struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 5c145fc04ad..0a943998555 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -91,7 +91,7 @@ void tui_update_source_window_as_is (struct tui_win_info * winInfo, struct symtab *s, union tui_line_or_address lineOrAddr, int noerror) { - TuiStatus ret; + enum tui_status ret; if (winInfo->generic.type == SRC_WIN) ret = tui_set_source_content (s, lineOrAddr.lineNo, noerror); @@ -314,7 +314,7 @@ tui_horizontal_source_scroll (struct tui_win_info * winInfo, enum tui_scroll_direction direction, int numToScroll) { - if (winInfo->generic.content != (OpaquePtr) NULL) + if (winInfo->generic.content != NULL) { int offset; struct symtab *s; @@ -459,20 +459,20 @@ tui_update_breakpoint_info (struct tui_win_info * win, int current_only) ** based upon the input window which is either the source or ** disassembly window. */ -TuiStatus +enum tui_status tuiSetExecInfoContent (struct tui_win_info * winInfo) { - TuiStatus ret = TUI_SUCCESS; + enum tui_status ret = TUI_SUCCESS; if (winInfo->detail.sourceInfo.executionInfo != (struct tui_gen_win_info *) NULL) { struct tui_gen_win_info * execInfoPtr = winInfo->detail.sourceInfo.executionInfo; - if (execInfoPtr->content == (OpaquePtr) NULL) + if (execInfoPtr->content == NULL) execInfoPtr->content = - (OpaquePtr) tui_alloc_content (winInfo->generic.height, + (void **) tui_alloc_content (winInfo->generic.height, execInfoPtr->type); - if (execInfoPtr->content != (OpaquePtr) NULL) + if (execInfoPtr->content != NULL) { int i; @@ -575,7 +575,7 @@ tui_alloc_source_buffer (struct tui_win_info *winInfo) { register char *srcLineBuf; register int i, lineWidth, maxLines; - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; maxLines = winInfo->generic.height; /* less the highlight box */ lineWidth = winInfo->generic.width - 1; @@ -584,7 +584,7 @@ tui_alloc_source_buffer (struct tui_win_info *winInfo) ** will be re-used for all source displays. The only other time this will ** be done is when a window's size changes. */ - if (winInfo->generic.content == (OpaquePtr) NULL) + if (winInfo->generic.content == NULL) { srcLineBuf = (char *) xmalloc ((maxLines * lineWidth) * sizeof (char)); if (srcLineBuf == (char *) NULL) @@ -595,9 +595,9 @@ tui_alloc_source_buffer (struct tui_win_info *winInfo) { /* allocate the content list */ if ((winInfo->generic.content = - (OpaquePtr) tui_alloc_content (maxLines, SRC_WIN)) == (OpaquePtr) NULL) + (void **) tui_alloc_content (maxLines, SRC_WIN)) == NULL) { - tuiFree (srcLineBuf); + xfree (srcLineBuf); srcLineBuf = (char *) NULL; fputs_unfiltered ( "Unable to Allocate Memory for Source or Disassembly Display.\n", diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 038401cbec1..49a9937cb7e 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -456,17 +456,6 @@ tui_disable (void) tui_update_gdb_sizes (); } -/* Wrapper on top of free() to ensure that input address - is greater than 0x0. */ -void -tuiFree (char *ptr) -{ - if (ptr != (char *) NULL) - { - xfree (ptr); - } -} - void strcat_to_buf (char *buf, int buflen, const char *itemToAdd) { @@ -577,7 +566,7 @@ tui_show_assembly (CORE_ADDR addr) } int -tui_is_window_visible (TuiWinType type) +tui_is_window_visible (enum tui_win_type type) { if (tui_active == 0) return 0; diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index 1aba29e8bd7..d6221b74f91 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -38,63 +38,44 @@ struct ui_file; -/* Opaque data type */ -typedef char *Opaque; -typedef -Opaque (*OpaqueFuncPtr) (va_list); - typedef char **OpaqueList; - typedef OpaqueList OpaquePtr; - -/* Generic function pointer */ - typedef void (*TuiVoidFuncPtr) (va_list); - typedef int (*TuiIntFuncPtr) (va_list); -/* - typedef Opaque (*TuiOpaqueFuncPtr) (va_list); - */ - typedef OpaqueFuncPtr TuiOpaqueFuncPtr; - extern void strcat_to_buf (char *, int, const char *); -/* Types of error returns */ - typedef enum tui_status - { - TUI_SUCCESS, - TUI_FAILURE - } -TuiStatus, *TuiStatusPtr; +/* Types of error returns. */ +enum tui_status +{ + TUI_SUCCESS, + TUI_FAILURE +}; /* Types of windows */ -typedef enum tui_win_type - { - SRC_WIN = 0, - DISASSEM_WIN, - DATA_WIN, - CMD_WIN, - /* This must ALWAYS be AFTER the major windows last */ - MAX_MAJOR_WINDOWS, - /* auxillary windows */ - LOCATOR_WIN, - EXEC_INFO_WIN, - DATA_ITEM_WIN, - /* This must ALWAYS be next to last */ - MAX_WINDOWS, - UNDEFINED_WIN /* LAST */ - } -TuiWinType, *TuiWinTypePtr; - -/* This is a point definition */ - typedef struct _TuiPoint - { - int x, y; - } -TuiPoint, *TuiPointPtr; +enum tui_win_type +{ + SRC_WIN = 0, + DISASSEM_WIN, + DATA_WIN, + CMD_WIN, + /* This must ALWAYS be AFTER the major windows last. */ + MAX_MAJOR_WINDOWS, + /* Auxillary windows. */ + LOCATOR_WIN, + EXEC_INFO_WIN, + DATA_ITEM_WIN, + /* This must ALWAYS be next to last. */ + MAX_WINDOWS, + UNDEFINED_WIN /* LAST */ +}; + +/* This is a point definition. */ +struct tui_point +{ + int x, y; +}; /* GENERAL TUI FUNCTIONS */ /* tui.c */ -extern void tuiFree (char *); -extern CORE_ADDR tuiGetLowDisassemblyAddress (CORE_ADDR, CORE_ADDR); +extern CORE_ADDR tui_get_low_disassembly_address (CORE_ADDR, CORE_ADDR); extern void tui_show_assembly (CORE_ADDR addr); -extern int tui_is_window_visible (TuiWinType type); +extern int tui_is_window_visible (enum tui_win_type type); extern int tui_get_command_dimension (int *width, int *height); /* Initialize readline and configure the keymap for the switching @@ -137,10 +118,10 @@ extern void tui_show_source (const char *file, int line); extern struct ui_out *tui_out_new (struct ui_file *stream); -/* tuiLayout.c */ +/* tui-layout.c */ extern enum tui_status tui_set_layout_for_display_command (const char *name); -/* tuiSourceWin.c */ -extern void tuiUpdateAllExecInfos (void); +/* tui-winsource.c */ +extern void tui_update_all_exec_infos (void); #endif /* TUI_H */ -- 2.30.2