From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17759 invoked by alias); 17 Jul 2008 22:55:32 -0000 Received: (qmail 17749 invoked by uid 22791); 17 Jul 2008 22:55:30 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 17 Jul 2008 22:55:02 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m6HMt0kT009851 for ; Thu, 17 Jul 2008 18:55:00 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m6HMsxd2012030; Thu, 17 Jul 2008 18:54:59 -0400 Received: from opsy.redhat.com (vpn-10-17.bos.redhat.com [10.16.10.17]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m6HMsxBK025256; Thu, 17 Jul 2008 18:54:59 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 3CCFA37829E; Thu, 17 Jul 2008 16:54:58 -0600 (MDT) To: gdb-patches@sources.redhat.com Subject: RFA: lift no-argument restriction on observers From: Tom Tromey Reply-To: Tom Tromey X-Attribution: Tom Date: Thu, 17 Jul 2008 22:55:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2008-07/txt/msg00356.txt.bz2 I noticed a comment in observer.texi to the effect that no-argument observers are not possible. Sure enough, observer.sh does not handle this case, and there is one observer that takes a dummy argument to work around this problem. This patch lifts the restriction by changing observer.sh. It also modifies that one observer to remove the dummy argument. Tested on x86 F8, no regressions. Ok? Tom ChangeLog: 2008-07-17 Tom Tromey * symfile.c (reread_symbols): Don't pass argument to observer. * exec.c (exec_file_attach): Don't pass argument to observer. * ada-lang.c (ada_executable_changed_observer): Remove argument. * symtab.c (symtab_observer_executable_changed): Remove argument. * observer.sh: Handle functions with no arguments. doc/ChangeLog: 2008-07-17 Tom Tromey * observer.texi (GDB Observers): Remove obsolete comment. : Remove argument. Index: ada-lang.c =================================================================== RCS file: /cvs/src/src/gdb/ada-lang.c,v retrieving revision 1.150 diff -u -r1.150 ada-lang.c --- ada-lang.c 15 Jul 2008 19:11:34 -0000 1.150 +++ ada-lang.c 17 Jul 2008 22:23:50 -0000 @@ -9769,7 +9769,7 @@ each time a new executable is loaded by GDB. */ static void -ada_executable_changed_observer (void *unused) +ada_executable_changed_observer (void) { /* If the executable changed, then it is possible that the Ada runtime is different. So we need to invalidate the exception support info Index: exec.c =================================================================== RCS file: /cvs/src/src/gdb/exec.c,v retrieving revision 1.75 diff -u -r1.75 exec.c --- exec.c 3 May 2008 18:04:02 -0000 1.75 +++ exec.c 17 Jul 2008 22:23:50 -0000 @@ -275,7 +275,7 @@ (*deprecated_exec_file_display_hook) (filename); } bfd_cache_close_all (); - observer_notify_executable_changed (NULL); + observer_notify_executable_changed (); } /* Process the first arg in ARGS as the new exec file. Index: observer.sh =================================================================== RCS file: /cvs/src/src/gdb/observer.sh,v retrieving revision 1.15 diff -u -r1.15 observer.sh --- observer.sh 14 Mar 2008 17:21:07 -0000 1.15 +++ observer.sh 17 Jul 2008 22:23:51 -0000 @@ -123,8 +123,14 @@ static struct observer_list *${event}_subject = NULL; +EOF + if test "$formal" != "void"; then + cat<>${otmp} struct ${event}_args { `echo "${formal}" | sed -e 's/,/;/g'`; }; +EOF + fi + cat <>${otmp} static void observer_${event}_notification_stub (const void *data, const void *args_data) { @@ -150,8 +156,17 @@ void observer_notify_${event} (${formal}) { +EOF + if test "$formal" != "void"; then + cat<>${otmp} struct ${event}_args args; `echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args.\1 = \1/g'`; + +EOF + else + echo "char *args = NULL;" >> ${otmp} + fi + cat<>${otmp} if (observer_debug) fprintf_unfiltered (gdb_stdlog, "observer_notify_${event}() called\n"); generic_observer_notify (${event}_subject, &args); Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.207 diff -u -r1.207 symfile.c --- symfile.c 10 Jul 2008 23:08:21 -0000 1.207 +++ symfile.c 17 Jul 2008 22:23:51 -0000 @@ -2495,7 +2495,7 @@ clear_symtab_users (); /* At least one objfile has changed, so we can consider that the executable we're debugging has changed too. */ - observer_notify_executable_changed (NULL); + observer_notify_executable_changed (); } } Index: symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.191 diff -u -r1.191 symtab.c --- symtab.c 13 Jul 2008 16:58:19 -0000 1.191 +++ symtab.c 17 Jul 2008 22:23:51 -0000 @@ -4325,7 +4325,7 @@ /* Handle ``executable_changed'' events for the symtab module. */ static void -symtab_observer_executable_changed (void *unused) +symtab_observer_executable_changed (void) { /* NAME_OF_MAIN may no longer be the same, so reset it for now. */ set_main_name (NULL); Index: doc/observer.texi =================================================================== RCS file: /cvs/src/src/gdb/doc/observer.texi,v retrieving revision 1.16 diff -u -r1.16 observer.texi --- doc/observer.texi 10 Jun 2008 10:23:54 -0000 1.16 +++ doc/observer.texi 17 Jul 2008 22:23:54 -0000 @@ -88,8 +88,6 @@ The following observable events are defined: -@c note: all events must take at least one parameter. - @deftypefun void normal_stop (struct bpstats *@var{bs}) The inferior has stopped for real. @end deftypefun @@ -98,7 +96,7 @@ The target's register contents have changed. @end deftypefun -@deftypefun void executable_changed (void *@var{unused_args}) +@deftypefun void executable_changed (void) The executable being debugged by GDB has changed: The user decided to debug a different program, or the program he was debugging has been modified since being loaded by the debugger (by being recompiled, @@ -141,4 +139,3 @@ The target was resumed. The @var{ptid} parameter specifies which thread was resume, and may be RESUME_ALL if all threads are resumed. @end deftypefun -