* [PATCH]: Always define tui commands
@ 2001-07-19 15:48 Stephane Carrez
2001-07-20 0:46 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Carrez @ 2001-07-19 15:48 UTC (permalink / raw)
To: gdb-patches
Hi!
The tui commands were defined only when the -tui option was specified.
Since we are able to switch to/from tui, it is annoying because when
gdb is started without -tui, we can switch later to TUI but the commands
are not defined.
I've committed this patch to always define the tui specific commands
and to define a help class for tui.
Stephane
2001-07-20 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* tuiWin.c (_initialize_tuiWin): Always define the tui commands;
create the tui class help.
* tuiLayout.c (_initialize_tuiLayout): Always define the tui commands.
* tuiRegs.c (_initialize_tuiRegs): Likewise.
* tuiStack.c (_initialize_tuiStack): Likewise.
Index: tuiWin.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiWin.c,v
retrieving revision 1.9
diff -u -p -r1.9 tuiWin.c
--- tuiWin.c 2001/07/18 22:03:22 1.9
+++ tuiWin.c 2001/07/19 22:45:46
@@ -31,6 +31,7 @@
#include "symtab.h"
#include "breakpoint.h"
#include "frame.h"
+#include "cli/cli-cmds.h"
#include "tui.h"
#include "tuiData.h"
@@ -85,51 +86,53 @@ static void _parseScrollingArgs (char *,
void
_initialize_tuiWin (void)
{
- if (tui_version)
- {
- add_com ("refresh", class_tui, _tuiRefreshAll_command,
- "Refresh the terminal display.\n");
- if (xdb_commands)
- add_com_alias ("U", "refresh", class_tui, 0);
- add_com ("tabset", class_tui, _tuiSetTabWidth_command,
- "Set the width (in characters) of tab stops.\n\
+ /* Define the classes of commands.
+ They will appear in the help list in the reverse of this order. */
+
+ add_cmd ("tui", class_tui, NO_FUNCTION,
+ "Text User Interface commands.",
+ &cmdlist);
+
+ add_com ("refresh", class_tui, _tuiRefreshAll_command,
+ "Refresh the terminal display.\n");
+ if (xdb_commands)
+ add_com_alias ("U", "refresh", class_tui, 0);
+ add_com ("tabset", class_tui, _tuiSetTabWidth_command,
+ "Set the width (in characters) of tab stops.\n\
Usage: tabset <n>\n");
- add_com ("winheight", class_tui, _tuiSetWinHeight_command,
- "Set the height of a specified window.\n\
+ add_com ("winheight", class_tui, _tuiSetWinHeight_command,
+ "Set the height of a specified window.\n\
Usage: winheight <win_name> [+ | -] <#lines>\n\
Window names are:\n\
src : the source window\n\
cmd : the command window\n\
asm : the disassembly window\n\
regs : the register display\n");
- add_com_alias ("wh", "winheight", class_tui, 0);
- add_info ("win", _tuiAllWindowsInfo,
- "List of all displayed windows.\n");
- add_com ("focus", class_tui, _tuiSetFocus_command,
- "Set focus to named window or next/prev window.\n\
+ add_com_alias ("wh", "winheight", class_tui, 0);
+ add_info ("win", _tuiAllWindowsInfo,
+ "List of all displayed windows.\n");
+ add_com ("focus", class_tui, _tuiSetFocus_command,
+ "Set focus to named window or next/prev window.\n\
Usage: focus {<win> | next | prev}\n\
Valid Window names are:\n\
src : the source window\n\
asm : the disassembly window\n\
regs : the register display\n\
cmd : the command window\n");
- add_com_alias ("fs", "focus", class_tui, 0);
- add_com ("+", class_tui, _tuiScrollForward_command,
- "Scroll window forward.\nUsage: + [win] [n]\n");
- add_com ("-", class_tui, _tuiScrollBackward_command,
- "Scroll window backward.\nUsage: - [win] [n]\n");
- add_com ("<", class_tui, _tuiScrollLeft_command,
- "Scroll window forward.\nUsage: < [win] [n]\n");
- add_com (">", class_tui, _tuiScrollRight_command,
- "Scroll window backward.\nUsage: > [win] [n]\n");
- if (xdb_commands)
- add_com ("w", class_xdb, _tuiXDBsetWinHeight_command,
- "XDB compatibility command for setting the height of a command window.\n\
+ add_com_alias ("fs", "focus", class_tui, 0);
+ add_com ("+", class_tui, _tuiScrollForward_command,
+ "Scroll window forward.\nUsage: + [win] [n]\n");
+ add_com ("-", class_tui, _tuiScrollBackward_command,
+ "Scroll window backward.\nUsage: - [win] [n]\n");
+ add_com ("<", class_tui, _tuiScrollLeft_command,
+ "Scroll window forward.\nUsage: < [win] [n]\n");
+ add_com (">", class_tui, _tuiScrollRight_command,
+ "Scroll window backward.\nUsage: > [win] [n]\n");
+ if (xdb_commands)
+ add_com ("w", class_xdb, _tuiXDBsetWinHeight_command,
+ "XDB compatibility command for setting the height of a command window.\n\
Usage: w <#lines>\n");
- }
-
- return;
-} /* _intialize_tuiWin */
+}
/*
Index: tuiLayout.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiLayout.c,v
retrieving revision 1.11
diff -u -p -r1.11 tuiLayout.c
--- tuiLayout.c 2001/07/18 22:03:22 1.11
+++ tuiLayout.c 2001/07/19 22:45:48
@@ -435,10 +435,8 @@ tuiDefaultWinViewportHeight (TuiWinType
void
_initialize_tuiLayout (void)
{
- if (tui_version)
- {
- add_com ("layout", class_tui, _tuiLayout_command,
- "Change the layout of windows.\n\
+ add_com ("layout", class_tui, _tuiLayout_command,
+ "Change the layout of windows.\n\
Usage: layout prev | next | <layout_name> \n\
Layout names are:\n\
src : Displays source and command windows.\n\
@@ -450,18 +448,15 @@ Layout names are:\n\
source/assembly/command (split) is displayed, \n\
the register window is displayed with \n\
the window that has current logical focus.\n");
- if (xdb_commands)
- {
- add_com ("td", class_tui, _tuiToggleLayout_command,
- "Toggle between Source/Command and Disassembly/Command layouts.\n");
- add_com ("ts", class_tui, _tuiToggleSplitLayout_command,
- "Toggle between Source/Command or Disassembly/Command and \n\
+ if (xdb_commands)
+ {
+ add_com ("td", class_tui, _tuiToggleLayout_command,
+ "Toggle between Source/Command and Disassembly/Command layouts.\n");
+ add_com ("ts", class_tui, _tuiToggleSplitLayout_command,
+ "Toggle between Source/Command or Disassembly/Command and \n\
Source/Disassembly/Command layouts.\n");
- }
}
-
- return;
-} /* _intialize_tuiLayout */
+}
/*************************
Index: tuiRegs.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiRegs.c,v
retrieving revision 1.8
diff -u -p -r1.8 tuiRegs.c
--- tuiRegs.c 2001/07/18 22:03:22 1.8
+++ tuiRegs.c 2001/07/19 22:45:50
@@ -540,7 +540,7 @@ tuiToggleFloatRegs (void)
void
_initialize_tuiRegs (void)
{
- if (tui_version && xdb_commands)
+ if (xdb_commands)
{
add_com ("fr", class_tui, _tuiShowFloat_command,
"Display only floating point registers\n");
@@ -561,9 +561,7 @@ _initialize_tuiRegs (void)
registers.\n",
&togglelist);
}
-
- return;
-} /* _initialize_tuiRegs */
+}
/*****************************************
Index: tuiStack.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiStack.c,v
retrieving revision 1.7
diff -u -p -r1.7 tuiStack.c
--- tuiStack.c 2001/07/18 20:59:00 1.7
+++ tuiStack.c 2001/07/19 22:45:51
@@ -422,14 +422,9 @@ tui_vShowFrameInfo (va_list args)
void
_initialize_tuiStack (void)
{
- if (tui_version)
- {
- add_com ("update", class_tui, _tuiUpdateLocation_command,
- "Update the source window and locator to display the current execution point.\n");
- }
-
- return;
-} /* _initialize_tuiStack */
+ add_com ("update", class_tui, _tuiUpdateLocation_command,
+ "Update the source window and locator to display the current execution point.\n");
+}
/*****************************************
From Stephane.Carrez@worldnet.fr Thu Jul 19 15:50:00 2001
From: Stephane Carrez <Stephane.Carrez@worldnet.fr>
To: gdb-patches@sources.redhat.com
Subject: [RFA]: New function terminal_save_ours()
Date: Thu, 19 Jul 2001 15:50:00 -0000
Message-id: <3B576530.13178D50@worldnet.fr>
X-SW-Source: 2001-07/msg00497.html
Content-length: 2249
Hi!
When using gdb-tui and switching to or leaving the TUI mode, the terminal
settings are changed. This is part of the curses management (endwin).
Gdb keeps in a static variable in inflow.c for the tty setting of himself.
It switches it with the inferior terminal (terminal_inferior, terminal_ours).
The gdb terminal settings are fetched only once, the first time it is
used/checked (so we don't know when).
For the TUI to work correctly, it needs to update the gdb knowledge of
its terminal. The patch below proposes a new function `terminal_save_ours'
which is called by TUI each time the TUI changes from mode; that is
after we enter in TUI mode (curses), and after we left the TUI mode.
Can you approve this patch ?
Stephane
2001-07-20 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* inferior.h (terminal_save_ours): Declare.
* inflow.c (terminal_save_ours): New function.
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.11
diff -u -p -r1.11 inflow.c
--- inflow.c 2001/07/15 20:34:13 1.11
+++ inflow.c 2001/07/19 22:48:49
@@ -200,6 +200,23 @@ terminal_init_inferior_with_pgrp (int pg
}
}
+/* Save the terminal settings again. This is necessary for the TUI
+ when it switches to TUI or non-TUI mode; curses changes the terminal
+ and gdb must be able to restore it correctly. */
+
+void
+terminal_save_ours ()
+{
+ if (gdb_has_a_terminal ())
+ {
+ /* We could just as well copy our_ttystate (if we felt like adding
+ a new function serial_copy_tty_state). */
+ if (our_ttystate)
+ xfree (our_ttystate);
+ our_ttystate = serial_get_tty_state (stdin_serial);
+ }
+}
+
void
terminal_init_inferior (void)
{
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.23
diff -u -p -r1.23 inferior.h
--- inferior.h 2001/05/15 00:03:36 1.23
+++ inferior.h 2001/07/19 22:48:51
@@ -151,6 +151,8 @@ extern void generic_mourn_inferior (void
extern void terminal_ours (void);
+extern void terminal_save_ours (void);
+
extern int run_stack_dummy (CORE_ADDR, char *);
extern CORE_ADDR read_pc (void);
From dmj+@andrew.cmu.edu Thu Jul 19 16:09:00 2001
From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
To: Elena Zannoni <ezannoni@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] GDB's mdebug support vs. GCC 3.0
Date: Thu, 19 Jul 2001 16:09:00 -0000
Message-id: <20010719160858.A30318@nevyn.them.org>
References: <20010629123944.A3423@nevyn.them.org> <15191.24417.472551.89834@krustylu.cygnus.com>
X-SW-Source: 2001-07/msg00498.html
Content-length: 1485
On Thu, Jul 19, 2001 at 06:29:53PM -0400, Elena Zannoni wrote:
>
> Wow, what a messy control flow. Makes me dizzy. I am starting to
> understand this patch a bit. Just a few questions. Do you go through
> mipsread.c at all? If so, does mipscoff_new_init get called? If so,
> can you try to add the call to init_header_files in there instead?
The problem is that I don't go through mipsread at all. What we have
here is mdebug-in-ELF; elfmdebug_read_psymtab is where we enter mdebug
from.
> Next problem:
>
> Can you explain a bit more what happens there? I see that your new
> code in the if branch does the same things that process_one_symbol would do.
> . Change valu by the offset
> . call end_symtab
> . call end_stabs
>
> Are you saying that the symtab would be ended twice in that case? Once
> in process_one_symbol and once in psymtab_to_symtab_1?
> I think this the problem right?
> I am going to think some more.
That bit I'm not thrilled with. You're right; we used to not get the
final N_SO at all, and so process_one_symbol would not call end_symtab,
and we'd be safe when we called it ourselves after the loop. But GCC
3.0 does emit these N_SO's. We need to prevent process_one_symbol
(whose logic I'm not convinced we should be reusing on this path at
all, it's heinous!) from ending the symtab prematurely.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH]: Always define tui commands
2001-07-19 15:48 [PATCH]: Always define tui commands Stephane Carrez
@ 2001-07-20 0:46 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2001-07-20 0:46 UTC (permalink / raw)
To: Stephane.Carrez; +Cc: gdb-patches
> Date: Fri, 20 Jul 2001 00:52:59 +0200
> From: Stephane Carrez <Stephane.Carrez@worldnet.fr>
>
> I've committed this patch to always define the tui specific commands
> and to define a help class for tui.
If TUI commands are always defined, they should be documented in
gdb.texinfo.
I also think that your extensive changes in TUI deserve a few words in
NEWS. There's _got_ to be something users would like to know about
all those improvements you've done.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-07-20 0:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-19 15:48 [PATCH]: Always define tui commands Stephane Carrez
2001-07-20 0:46 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox