Re: [patch] Dummy first call to gdb_has_a_terminal()

Balazs Kezes
2010-07-28T21:21:34Z

Okay, now I checked this more thoroughly. initalize_all_files() in init.c
calls tui initialization functions which mess up the terminal and call
gdb_has_a_terminal() afterwards. So it must be called before this function.

The other way (start gdbtui /bin/echo, switch to gdb, run) seems to work
after the gdb_has_a_terminal is added to the initialize_stdin_serial().

So here is my revised patch:

Changelog:
* inflow.c (initialize_stdin_serial): Added gdb_has_a_terminal to
actually save all the tty settings.
* top.c (gdb_init): Move initialize_stdin_serial before
initialize_all_files because it assumes it has been already called.

Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.59
diff -c -p -r1.59 inflow.c
*** inflow.c 14 May 2010 21:25:51 -0000 1.59
--- inflow.c 28 Jul 2010 21:09:15 -0000
*************** void
*** 843,848 ****
--- 843,849 ----
initialize_stdin_serial (void)
{
stdin_serial = serial_fdopen (0);
+ (void) gdb_has_a_terminal ();
}

void
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.181.2.1
diff -c -p -r1.181.2.1 top.c
*** top.c 27 Jul 2010 19:13:11 -0000 1.181.2.1
--- top.c 28 Jul 2010 21:09:15 -0000
*************** gdb_init (char *argv0)
*** 1613,1618 ****
--- 1613,1619 ----
init_cmd_lists (); /* This needs to be done first */
initialize_targets (); /* Setup target_terminal macros for utils.c */
initialize_utils (); /* Make errors and warnings possible */
+ initialize_stdin_serial (); /* Make sure interpreters can init properly */
initialize_all_files ();
/* This creates the current_program_space. Do this after all the
_initialize_foo routines have had a chance to install their
*************** gdb_init (char *argv0)
*** 1625,1632 ****
init_cli_cmds();
init_main (); /* But that omits this file! Do it now */

- initialize_stdin_serial ();
-
async_init_signals ();

/* We need a default language for parsing expressions, so simple things like
--- 1626,1631 ----

--
Balazs