Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: lift no-argument restriction on observers
@ 2008-07-17 22:55 Tom Tromey
  2008-07-21 15:56 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2008-07-17 22:55 UTC (permalink / raw)
  To: gdb-patches

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  <tromey@redhat.com>

	* 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  <tromey@redhat.com>

	* observer.texi (GDB Observers): Remove obsolete comment.
	<executable_changed>: 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<<EOF >>${otmp}
 struct ${event}_args { `echo "${formal}" | sed -e 's/,/;/g'`; };
 
+EOF
+	fi
+	cat <<EOF >>${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<<EOF >>${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<<EOF >>${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
-


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFA: lift no-argument restriction on observers
  2008-07-17 22:55 RFA: lift no-argument restriction on observers Tom Tromey
@ 2008-07-21 15:56 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2008-07-21 15:56 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Thu, Jul 17, 2008 at 04:54:57PM -0600, Tom Tromey wrote:
> 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?

Ok.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-21 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-17 22:55 RFA: lift no-argument restriction on observers Tom Tromey
2008-07-21 15:56 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox