From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15439 invoked by alias); 17 Aug 2005 23:13:59 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15424 invoked by uid 22791); 17 Aug 2005 23:13:51 -0000 Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 17 Aug 2005 23:13:51 +0000 Received: from farnswood.snap.net.nz (p115-tnt2.snap.net.nz [202.124.108.115]) by viper.snap.net.nz (Postfix) with ESMTP id E3D04688953 for ; Thu, 18 Aug 2005 11:13:47 +1200 (NZST) Received: by farnswood.snap.net.nz (Postfix, from userid 501) id AD18362A99; Thu, 18 Aug 2005 00:15:44 +0100 (BST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17155.50463.475238.328408@farnswood.snap.net.nz> Date: Thu, 18 Aug 2005 13:28:00 -0000 To: gdb-patches@sources.redhat.com Subject: Re: RFC: MI output during program execution X-SW-Source: 2005-08/txt/msg00207.txt.bz2 I've updated my previous patch to use mi_insert/mi_remove_notify_hooks instead of the condition (strcmp (interpreter_p, "mi") == 0). This mechanism could be used more pervasively with ui_out_is_mi_like_p to give furher MI output e.g reason for stopping. It could also be used for any event notification that is developed for MI. It might not work with true asynchronous behaviour but in that case the existing suppression of queries using mi_interp_query_hook must also fail. Nick *** defs.h.~1.189.~ 2005-08-08 18:20:44.000000000 +1200 --- defs.h 2005-08-18 09:51:14.000000000 +1200 *************** extern struct continuation *cmd_continua *** 711,716 **** --- 711,718 ---- /* Used only by the step_1 function. */ extern struct continuation *intermediate_continuation; + extern int gdb_mi_run_status; + /* From utils.c */ extern void add_continuation (void (*)(struct continuation_arg *), struct continuation_arg *); *** infrun.c.~1.203~ 2005-08-15 10:38:14.000000000 +1200 --- infrun.c 2005-08-18 11:06:01.000000000 +1200 *************** *** 49,54 **** --- 49,57 ---- #include "gdb_assert.h" #include "mi/mi-common.h" + #include "mi/mi-out.h" + + extern struct ui_file *raw_stdout; /* Prototypes for local functions */ *************** proceed (CORE_ADDR addr, enum target_sig *** 785,790 **** --- 788,803 ---- annotate_starting (); + if (gdb_mi_run_status || (ui_out_is_mi_like_p (uiout))) + { + fputs_unfiltered ("^running\n", raw_stdout); + if (!target_can_async_p ()) + { + fputs_unfiltered ("(gdb) \n", raw_stdout); + gdb_flush (raw_stdout); + } + } + /* Make sure that output from GDB appears before output from the inferior. */ gdb_flush (gdb_stdout); *************** Further execution is probably impossible *** 3136,3141 **** --- 3149,3164 ---- done: annotate_stopped (); observer_notify_normal_stop (stop_bpstat); + if (gdb_mi_run_status || (ui_out_is_mi_like_p (uiout))) + { + fputs_unfiltered ("*stopped", raw_stdout); + if (ui_out_is_mi_like_p (uiout)) + { + mi_out_put (uiout, raw_stdout); + mi_out_rewind (uiout); + } + fputs_unfiltered ("\n", raw_stdout); + } } static int *** mi/mi-interp.c.~1.15.~ 2005-08-01 10:45:28.000000000 +1200 --- mi/mi-interp.c 2005-08-18 09:54:29.000000000 +1200 *************** struct mi_interp *** 48,53 **** --- 48,55 ---- struct interp *mi_interp; }; + int gdb_mi_run_status = 0; + /* These are the interpreter setup, etc. functions for the MI interpreter */ static void mi_execute_command_wrapper (char *cmd); static void mi_command_loop (int mi_version); *************** static void *** 280,291 **** --- 282,295 ---- mi_insert_notify_hooks (void) { deprecated_query_hook = mi_interp_query_hook; + gdb_mi_run_status = 1; } static void mi_remove_notify_hooks (void) { deprecated_query_hook = NULL; + gdb_mi_run_status = 0; } static int *************** mi_interp_query_hook (const char *ctlstr *** 294,299 **** --- 298,309 ---- return 1; } + static int + mi_cli_hook (const char *ctlstr, va_list ap) + { + return 1; + } + static void mi_execute_command_wrapper (char *cmd) {