This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA]: Fix utils.c and printcmd.c for tui
- To: gdb-patches at sources dot redhat dot com
- Subject: [RFA]: Fix utils.c and printcmd.c for tui
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Thu, 19 Jul 2001 00:08:48 +0200
Hi!
The following patch simplifies the tui portions in utils.c and printcmd.c
by calling simple tui functions rather than having some tui specific code.
I've not found a better solution (yet) to solve these tui dependencies in
gdb common code.
Can you approve this patch?
Stephane
gdb/ChangeLog
2001-07-18 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* utils.c (init_page_info): Use tui_get_command_dimension.
* printcmd.c (disassemble_command): Simplify tui specific code,
use tui_is_window_visible, tui_show_assembly.
gdb/tui/ChangeLog
2001-07-18 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* tui.h (tui_show_assembly): Declare.
(tui_is_window_visible): Declare.
* tui.c (tui_show_assembly): New function.
(tui_is_window_visible): New function.
(tui_get_command_dimension): New function.
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.45
diff -u -i -r1.45 utils.c
--- utils.c 2001/07/15 20:34:14 1.45
+++ utils.c 2001/07/18 21:02:52
@@ -1500,12 +1500,7 @@
init_page_info (void)
{
#if defined(TUI)
- if (tui_version && m_winPtrNotNull (cmdWin))
- {
- lines_per_page = cmdWin->generic.height;
- chars_per_line = cmdWin->generic.width;
- }
- else
+ if (!tui_get_command_dimension (&chars_per_line, &lines_per_page))
#endif
{
/* These defaults will be used if we are unable to get the correct
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.23
diff -u -i -r1.23 printcmd.c
--- printcmd.c 2001/07/10 21:24:48 1.23
+++ printcmd.c 2001/07/18 21:03:01
@@ -1396,8 +1396,7 @@
#if defined(TUI)
if (tui_version && *exp == '$')
- display_it = ((TuiStatus) tuiDo (
- (TuiOpaqueFuncPtr) tui_vSetLayoutTo, exp) == TUI_FAILURE);
+ display_it = (tui_set_layout (exp) == TUI_FAILURE);
#endif
if (display_it)
@@ -2335,9 +2334,7 @@
error ("No function contains program counter for selected frame.\n");
#if defined(TUI)
else if (tui_version)
- low = (CORE_ADDR) tuiDo ((TuiOpaqueFuncPtr) tui_vGetLowDisassemblyAddress,
- (Opaque) low,
- (Opaque) pc);
+ low = tuiGetLowDisassemblyAddress (low, pc);
#endif
low += FUNCTION_START_OFFSET;
}
@@ -2349,9 +2346,7 @@
error ("No function contains specified address.\n");
#if defined(TUI)
else if (tui_version)
- low = (CORE_ADDR) tuiDo ((TuiOpaqueFuncPtr) tui_vGetLowDisassemblyAddress,
- (Opaque) low,
- (Opaque) pc);
+ low = tuiGetLowDisassemblyAddress (low, pc);
#endif
#if 0
if (overlay_debugging)
@@ -2378,8 +2373,7 @@
}
#if defined(TUI)
- if (!tui_version ||
- m_winPtrIsNull (disassemWin) || !disassemWin->generic.isVisible)
+ if (!tui_is_window_visible (DISASSEM_WIN))
#endif
{
printf_filtered ("Dump of assembler code ");
@@ -2427,8 +2421,7 @@
#if defined(TUI)
else
{
- tuiDo ((TuiOpaqueFuncPtr) tui_vAddWinToLayout, DISASSEM_WIN);
- tuiDo ((TuiOpaqueFuncPtr) tui_vUpdateSourceWindowsWithAddr, low);
+ tui_show_assembly (low);
}
#endif
}
Index: tui/tui.h
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.h,v
retrieving revision 1.6
diff -u -i -r1.6 tui.h
--- tui.h 2001/07/16 22:05:02 1.6
+++ tui.h 2001/07/18 21:03:02
@@ -102,6 +102,9 @@
extern Opaque tuiGetLowDisassemblyAddress (Opaque, Opaque);
extern Opaque tui_vGetLowDisassemblyAddress (va_list);
extern void tui_vSelectSourceSymtab (va_list);
+extern void tui_show_assembly (CORE_ADDR addr);
+extern int tui_is_window_visible (TuiWinType type);
+extern int tui_get_command_dimension (int *width, int *height);
/* tuiDataWin.c */
extern void tui_vCheckDataValues (va_list);
Index: tui/tui.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.c,v
retrieving revision 1.8
diff -u -i -r1.8 tui.c
--- tui.c 2001/07/17 21:37:18 1.8
+++ tui.c 2001/07/18 21:03:04
@@ -682,3 +682,35 @@
return;
} /* _tuiReset */
+
+void
+tui_show_assembly (CORE_ADDR addr)
+{
+ tuiAddWinToLayout (DISASSEM_WIN);
+ tuiUpdateSourceWindowsWithAddr (addr);
+}
+
+int
+tui_is_window_visible (TuiWinType type)
+{
+ if (tui_version == 0)
+ return 0;
+
+ if (winList[type] == 0)
+ return 0;
+
+ return winList[type]->generic.isVisible;
+}
+
+int
+tui_get_command_dimension (int *width, int *height)
+{
+ if (!tui_version || !m_winPtrNotNull (cmdWin))
+ {
+ return 0;
+ }
+
+ *width = cmdWin->generic.width;
+ *height = cmdWin->generic.height;
+ return 1;
+}