From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7290 invoked by alias); 28 Jul 2010 21:21:34 -0000 Received: (qmail 7277 invoked by uid 22791); 28 Jul 2010 21:21:33 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,TW_DB X-Spam-Check-By: sourceware.org Received: from mail-bw0-f41.google.com (HELO mail-bw0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Jul 2010 21:21:23 +0000 Received: by bwz9 with SMTP id 9so5057607bwz.0 for ; Wed, 28 Jul 2010 14:21:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.82.200 with SMTP id c8mr8398417bkl.102.1280352078837; Wed, 28 Jul 2010 14:21:18 -0700 (PDT) Received: by 10.204.18.144 with HTTP; Wed, 28 Jul 2010 14:21:18 -0700 (PDT) In-Reply-To: References: <201007201552.03274.pedro@codesourcery.com> Date: Wed, 28 Jul 2010 21:21:00 -0000 Message-ID: Subject: Re: [patch] Dummy first call to gdb_has_a_terminal() From: Balazs Kezes To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-07/txt/msg00523.txt.bz2 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