Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: gdb-patches@sources.redhat.com, Eli Zaretskii <eliz@is.elta.co.il>
Subject: patch;rfa:doco] "set/show debug observer" command
Date: Fri, 07 May 2004 14:19:00 -0000	[thread overview]
Message-ID: <409B9AE2.6030009@gnu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

Hello,

This adds the commands:
	set debug observer {int}
	show debug observer
so that its possible to see what the observer code is doing.

Eli doco look ok?

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 4704 bytes --]

2004-05-07  Andrew Cagney  <cagney@redhat.com>

	* observer.c: Include "commands.h" and "gdbcmd.h".
	(observer_debug, _initialize_observer): Add the
	command "set/show debug observer".
	* observer.sh: When observer debugging, log notify calls.
	* Makefile.in (observer.o): Update dependencies.

Index: doc/ChangeLog
2004-05-07  Andrew Cagney  <cagney@redhat.com>

	* observer.texi (GDB Observers): Add "Debugging" section.  Include
	cross reference to "set/show debug observer".
	* gdb.texinfo (Debugging Output): Document "set/show debug
	observer".

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.561
diff -p -u -r1.561 Makefile.in
--- Makefile.in	7 May 2004 05:48:48 -0000	1.561
+++ Makefile.in	7 May 2004 14:16:02 -0000
@@ -2118,7 +2118,8 @@ objfiles.o: objfiles.c $(defs_h) $(bfd_h
 	$(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(gdb_assert_h) \
 	$(gdb_stat_h) $(gdb_obstack_h) $(gdb_string_h) $(hashtab_h) \
 	$(breakpoint_h) $(block_h) $(dictionary_h)
-observer.o: observer.c $(defs_h) $(observer_h) $(observer_inc)
+observer.o: observer.c $(defs_h) $(observer_h) $(observer_inc) \
+	$(command_h) $(gdbcmd_h)
 ocd.o: ocd.c $(defs_h) $(gdbcore_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
 	$(bfd_h) $(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) \
 	$(gdb_stabs_h) $(serial_h) $(ocd_h) $(regcache_h)
Index: observer.c
===================================================================
RCS file: /cvs/src/src/gdb/observer.c,v
retrieving revision 1.6
diff -p -u -r1.6 observer.c
--- observer.c	16 Apr 2004 17:26:40 -0000	1.6
+++ observer.c	7 May 2004 14:16:03 -0000
@@ -52,6 +52,10 @@
 
 #include "defs.h"
 #include "observer.h"
+#include "command.h"
+#include "gdbcmd.h"
+
+static int observer_debug;
 
 /* The internal generic observer.  */
 
@@ -187,6 +191,20 @@ void
 observer_test_third_notification_function (struct bpstats *bs)
 {
   observer_test_third_observer++;
+}
+
+extern initialize_file_ftype _initialize_observer; /* -Wmissing-prototypes */
+
+void
+_initialize_observer (void)
+{
+  add_setshow_zinteger_cmd ("observer", class_maintenance, &observer_debug, "\
+Set observer debugging.\n\
+When non-zero, observer debugging is enabled.",  "\
+Show observer debugging.\n\
+When non-zero, observer debugging is enabled.",
+			    NULL, NULL,
+			    &setdebuglist, &showdebuglist);
 }
 
 #include "observer.inc"
Index: observer.sh
===================================================================
RCS file: /cvs/src/src/gdb/observer.sh,v
retrieving revision 1.2
diff -p -u -r1.2 observer.sh
--- observer.sh	17 Apr 2004 04:45:32 -0000	1.2
+++ observer.sh	7 May 2004 14:16:03 -0000
@@ -134,6 +134,8 @@ observer_notify_${event} (${formal})
 {
   struct ${event}_args args;
   `echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args.\1 = \1/g'`;
+  if (observer_debug)
+    fprintf_unfiltered (gdb_stdlog, "observer_notify_${event}() called\n");
   generic_observer_notify (${event}_subject, &args);
 }
 EOF
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.202
diff -p -u -r1.202 gdb.texinfo
--- doc/gdb.texinfo	28 Mar 2004 12:22:55 -0000	1.202
+++ doc/gdb.texinfo	7 May 2004 14:16:17 -0000
@@ -13404,6 +13404,13 @@ default is off.
 @item show debug frame
 Displays the current state of displaying @value{GDBN} frame debugging
 info.
+@kindex set debug observer
+@item set debug observer
+Turns on or off display of @value{GDBN} observer debugging.  This
+includes info such as the notification of observable events.
+@kindex show debug observer
+@item show debug observer
+Displays the current state of observer debugging.
 @kindex set debug overload
 @item set debug overload
 Turns on or off display of @value{GDBN} C@t{++} overload debugging
Index: doc/observer.texi
===================================================================
RCS file: /cvs/src/src/gdb/doc/observer.texi,v
retrieving revision 1.5
diff -p -u -r1.5 observer.texi
--- doc/observer.texi	30 Apr 2004 07:38:50 -0000	1.5
+++ doc/observer.texi	7 May 2004 14:16:17 -0000
@@ -35,6 +35,11 @@ The observer implementation is also curr
 In particular, it is therefore not possible to call the attach
 or detach routines during a notification.
 
+@section Debugging
+Observer notifications can be traced using the command @samp{set debug
+observer 1} (@pxref{Debugging Output, , Optional messages about
+internal happenings, gdb, Debugging with @var{GDBN}}).
+
 @section @code{normal_stop} Notifications
 @cindex @code{normal_stop} observer
 @cindex notification about inferior execution stop

             reply	other threads:[~2004-05-07 14:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-07 14:19 Andrew Cagney [this message]
2004-05-07 15:33 ` Eli Zaretskii
2004-05-07 22:56   ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=409B9AE2.6030009@gnu.org \
    --to=cagney@gnu.org \
    --cc=eliz@is.elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox