From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14849 invoked by alias); 9 Mar 2006 15:41:59 -0000 Received: (qmail 14837 invoked by uid 22791); 9 Mar 2006 15:41:57 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-01.spheriq.net (HELO lon-del-01.spheriq.net) (195.46.50.97) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 09 Mar 2006 15:41:53 +0000 Received: from lon-out-01.spheriq.net ([195.46.50.129]) by lon-del-01.spheriq.net with ESMTP id k29FfLWc007564 for ; Thu, 9 Mar 2006 15:41:39 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-01.spheriq.net with ESMTP id k29FfLvL022986 for ; Thu, 9 Mar 2006 15:41:21 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id k29FfHLu019949 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Thu, 9 Mar 2006 15:41:20 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 007D0DA56; Thu, 9 Mar 2006 15:41:14 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F2DB34760A; Thu, 9 Mar 2006 15:43:35 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CHI53339 (AUTH stubbsa); Thu, 9 Mar 2006 15:39:43 GMT Message-ID: <44104BB2.6000108@st.com> Date: Thu, 09 Mar 2006 18:15:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: GDB Patches , insight@sourceware.org Subject: [PATCH] Don't call Insight hooks when not appropriate Content-Type: multipart/mixed; boundary="------------040506090705030400080406" X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.2.01 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00137.txt.bz2 This is a multi-part message in MIME format. --------------040506090705030400080406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 887 Hi all, I'm not really sure whether this should go to GDB patches or Insight so you've both got it. The attached patch prevents annoying messages and dialogue boxes when sourcing command scripts and running user-defined commands. It stops all yes/no questions and all 'Type commands for ...' messages. Output and prompts from these scripts are normally suppressed by GDB, but not by Insight. In order to achieve this I had to find a way to tell the difference between the normal Insight input state, and the state when executing user commands - both were previously identified by instream==NULL. I have changed instream to -1 when running user-defined commands. An inspection of the uses of instream suggests this will not have any detrimental affects, but it is hard to be totally sure. I know these hooks are marked deprecated, but we're still using them. Andrew Stubbs --------------040506090705030400080406 Content-Type: text/plain; name="insight-dialogue.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="insight-dialogue.patch" Content-length: 2185 2006-03-09 Andrew Stubbs * cli/cli-script.c (execute_user_command): Set instream to -1, not 0. (read_command_lines): Check instream before calling the prompt hook. * utils.c: Include top.h. (query): Check instream before calling the query hook. Index: src/gdb/cli/cli-script.c =================================================================== --- src.orig/gdb/cli/cli-script.c 2006-02-20 18:19:58.000000000 +0000 +++ src/gdb/cli/cli-script.c 2006-03-09 15:21:40.000000000 +0000 @@ -268,10 +268,11 @@ execute_user_command (struct cmd_list_el old_chain = make_cleanup (do_restore_user_call_depth, &user_call_depth); - /* Set the instream to 0, indicating execution of a - user-defined function. */ + /* Set the instream to -1, indicating execution of a + user-defined function. Don't use 0 any more, because this is + the same as NULL, which is the instream value used by insight. */ old_chain = make_cleanup (do_restore_instream_cleanup, instream); - instream = (FILE *) 0; + instream = (FILE *) -1; while (cmdlines) { ret = execute_control_command (cmdlines); @@ -920,7 +921,7 @@ read_command_lines (char *prompt_arg, in enum misc_command_type val; control_level = 0; - if (deprecated_readline_begin_hook) + if ((instream == stdin || instream == NULL) && deprecated_readline_begin_hook) { /* Note - intentional to merge messages with no newline */ (*deprecated_readline_begin_hook) ("%s %s\n", prompt_arg, END_MESSAGE); Index: src/gdb/utils.c =================================================================== --- src.orig/gdb/utils.c 2006-02-20 18:12:38.000000000 +0000 +++ src/gdb/utils.c 2006-03-09 15:17:43.000000000 +0000 @@ -54,6 +54,7 @@ #include "filenames.h" #include "symfile.h" #include "gdb_obstack.h" +#include "top.h" #include "inferior.h" /* for signed_pointer_to_address */ @@ -1141,7 +1142,7 @@ query (const char *ctlstr, ...) int ans2; int retval; - if (deprecated_query_hook) + if ((instream == stdin || instream == NULL) && deprecated_query_hook) { va_start (args, ctlstr); return deprecated_query_hook (ctlstr, args); --------------040506090705030400080406--