From 2b4855ab6b8e69b375c49df490db63ececf17da8 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 7 May 2004 22:51:55 +0000 Subject: [PATCH] 2004-05-07 Andrew Cagney * 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 * observer.texi (GDB Observers): Add "Debugging" section. Include cross reference to "set/show debug observer". * gdb.texinfo (Debugging Output): Document "set/show debug observer". --- gdb/ChangeLog | 8 ++++++++ gdb/Makefile.in | 3 ++- gdb/doc/ChangeLog | 7 +++++++ gdb/doc/gdb.texinfo | 7 +++++++ gdb/doc/observer.texi | 5 +++++ gdb/observer.c | 18 ++++++++++++++++++ gdb/observer.sh | 2 ++ 7 files changed, 49 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8c187a4..d7d33e6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2004-05-07 Andrew Cagney + + * 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. + 2004-05-07 Jason Molenda (jmolenda@apple.com) * cli/cli-decode.c: Fix "SHOW_DOR" comment typeos. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 89ddd42..45ad2bb 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2118,7 +2118,8 @@ objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_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) diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 977a00f..00f666d 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2004-05-07 Andrew Cagney + + * observer.texi (GDB Observers): Add "Debugging" section. Include + cross reference to "set/show debug observer". + * gdb.texinfo (Debugging Output): Document "set/show debug + observer". + 2004-05-01 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Delete diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 80d3225..aa82d06 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -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 diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi index 5c1c2c5..fa7e1c3 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi @@ -35,6 +35,11 @@ The observer implementation is also currently not reentrant. 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 diff --git a/gdb/observer.c b/gdb/observer.c index 53916ce..6bdcdf5 100644 --- a/gdb/observer.c +++ b/gdb/observer.c @@ -52,6 +52,10 @@ #include "defs.h" #include "observer.h" +#include "command.h" +#include "gdbcmd.h" + +static int observer_debug; /* The internal generic observer. */ @@ -189,4 +193,18 @@ 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" diff --git a/gdb/observer.sh b/gdb/observer.sh index c5d3779..2cc0e7f 100755 --- a/gdb/observer.sh +++ b/gdb/observer.sh @@ -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 -- 2.7.4