From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17422 invoked by alias); 1 Jan 2007 23:50:22 -0000 Received: (qmail 17412 invoked by uid 22791); 1 Jan 2007 23:50:20 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 01 Jan 2007 23:50:13 +0000 Received: from kahikatea.snap.net.nz (p202-124-124-112.snap.net.nz [202.124.124.112]) by viper.snap.net.nz (Postfix) with ESMTP id C2C773D83B3 for ; Tue, 2 Jan 2007 12:50:09 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 949D84F6EC; Tue, 2 Jan 2007 12:50:08 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17817.40495.289353.14514@kahikatea.snap.net.nz> Date: Mon, 01 Jan 2007 23:50:00 -0000 To: gdb-patches@sourceware.org Subject: [RFC] MI: Event notification X-Mailer: VM 7.19 under Emacs 22.0.92.4 X-IsSubscribed: yes 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: 2007-01/txt/msg00037.txt.bz2 This is another change based on Apple's work. It is part of my focus on improving responsivity of the frontend, along with the timing patch. The general idea is to report changes in program state to the frontend so that it only updates the parts that need it. For example, after "up" frame_changed_hook triggers and the frontend knows it has to update the locals display. This means that stepping through a single frame should be much quicker. If GDB enters a new frame during execution, stack_changed_hook triggers and the frontend knows it has to update the call stack display. I would eventually like to add more hooks like target-changed-hook when the user attaches to/detaches from a process, kills the process, or selects a new target with the "file" command. The hooks are inserted/removed through "interpreter-exec console cli-command" so I envisage not using MI commands like -exec-run, -exec-next, -stack-select-frame that change that state. -- Nick http://www.inet.net.nz/~nickrob Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.198 diff -c -p -r1.198 defs.h *** defs.h 21 Sep 2006 13:50:51 -0000 1.198 --- defs.h 1 Jan 2007 23:17:13 -0000 *************** extern void (*deprecated_show_load_progr *** 1124,1129 **** --- 1124,1136 ---- extern void (*deprecated_print_frame_info_listing_hook) (struct symtab * s, int line, int stopline, int noerror); + + /* called when the frame changes (e.g. as the result of "up") */ + extern void (*frame_changed_hook) (int new_frame_number); + + /* called when the stack changes (i.e. a new frame is added) */ + extern void (*stack_changed_hook) (void); + extern int (*deprecated_query_hook) (const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1,0); extern void (*deprecated_warning_hook) (const char *, va_list) Index: frame.c =================================================================== RCS file: /cvs/src/src/gdb/frame.c,v retrieving revision 1.215 diff -c -p -r1.215 frame.c *** frame.c 10 Nov 2006 20:11:35 -0000 1.215 --- frame.c 1 Jan 2007 23:17:16 -0000 *************** select_frame (struct frame_info *fi) *** 905,910 **** --- 905,913 ---- if (deprecated_selected_frame_level_changed_hook) deprecated_selected_frame_level_changed_hook (frame_relative_level (fi)); + if (frame_changed_hook) + frame_changed_hook (frame_relative_level (fi)); + /* FIXME: kseitz/2002-08-28: It would be nice to call selected_frame_level_changed_event() right here, but due to limitations in the current interfaces, we would end up flooding UIs with events Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.217 diff -c -p -r1.217 infrun.c *** infrun.c 30 Dec 2006 15:56:00 -0000 1.217 --- infrun.c 1 Jan 2007 23:17:25 -0000 *************** Further execution is probably impossible *** 3084,3089 **** --- 3084,3097 ---- breakpoint_auto_delete (stop_bpstat); + if (!stop_stack_dummy) + { + if ((stack_changed_hook != NULL) && + (!frame_id_eq (step_frame_id, get_frame_id (get_current_frame ())) || + step_start_function != find_pc_function (stop_pc))) + stack_changed_hook (); + } + /* If an auto-display called a function and that got a signal, delete that auto-display to avoid an infinite recursion. */ Index: stack.c =================================================================== RCS file: /cvs/src/src/gdb/stack.c,v retrieving revision 1.140 diff -c -p -r1.140 stack.c *** stack.c 18 Oct 2006 19:52:05 -0000 1.140 --- stack.c 1 Jan 2007 23:17:28 -0000 *************** If you continue, the return value that y *** 1872,1877 **** --- 1872,1880 ---- if (get_frame_type (get_current_frame ()) == DUMMY_FRAME) frame_pop (get_current_frame ()); + if (stack_changed_hook != NULL) + stack_changed_hook (); + /* If interactive, print the frame that is now current. */ if (from_tty) frame_command ("0", 1); Index: mi/mi-interp.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-interp.c,v retrieving revision 1.17 diff -c -p -r1.17 mi-interp.c *** mi/mi-interp.c 23 Dec 2005 18:57:46 -0000 1.17 --- mi/mi-interp.c 1 Jan 2007 23:17:29 -0000 *************** mi_cmd_interpreter_exec (char *command, *** 277,293 **** --- 277,325 ---- * the gdb CLI interpreter from within the MI, while still producing MI style output * when actions in the CLI command change gdb's state. */ + void + mi_interp_stack_changed_hook (void) + { + struct ui_out *uiout = interp_ui_out (NULL); + fprintf_unfiltered (raw_stdout, "%s", "=stack_changed"); + mi_out_put (uiout, raw_stdout); + mi_out_rewind (uiout); + fputs_unfiltered ("\n", raw_stdout); + gdb_flush (raw_stdout); + } + + void + mi_interp_frame_changed_hook (int new_frame_number) + { + struct ui_out *uiout = interp_ui_out (NULL); + + /* Don't report new_frame_number == -1, that is just the invalidate frame + message, and there is not much the UI can do with that. */ + if (new_frame_number == -1) + return; + + fprintf_unfiltered (raw_stdout, "%s", "=frame_changed"); + ui_out_field_int (uiout, "frame", new_frame_number); + mi_out_put (uiout, raw_stdout); + mi_out_rewind (uiout); + fputs_unfiltered ("\n", raw_stdout); + gdb_flush (raw_stdout); + } static void mi_insert_notify_hooks (void) { deprecated_query_hook = mi_interp_query_hook; + frame_changed_hook = mi_interp_frame_changed_hook; + stack_changed_hook = mi_interp_stack_changed_hook; } static void mi_remove_notify_hooks (void) { deprecated_query_hook = NULL; + frame_changed_hook = NULL; + stack_changed_hook = NULL; } static int