From: Orjan Friberg Date: Mon, 26 Apr 2004 09:49:36 +0000 (+0000) Subject: 2004-04-26 Orjan Friberg X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f4c5303c32d8fda229d182d9d7db4ceb64bf9e02;p=binutils-gdb.git 2004-04-26 Orjan Friberg * frame.c: Include "observer.h". (frame_observer_target_changed): New function. (_initialize_frame): Attach target_changed observer. * regcache.c: Include "observer.h". (regcache_observer_target_changed): New function. (_initialize_regcache): Attach target_changed observer. * valops.c: Include "observer.h". (value_assign): Notify target_changed event when modifying register. * Makefile.in (frame.o, regcache.o, valops.o): Add $(observer_h). --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ccc04d24a48..2b854559397 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2004-04-26 Orjan Friberg + + * frame.c: Include "observer.h". + (frame_observer_target_changed): New function. + (_initialize_frame): Attach target_changed observer. + * regcache.c: Include "observer.h". + (regcache_observer_target_changed): New function. + (_initialize_regcache): Attach target_changed observer. + * valops.c: Include "observer.h". + (value_assign): Notify target_changed event when modifying register. + * Makefile.in (frame.o, regcache.o, valops.o): Add $(observer_h). + 2004-04-26 Orjan Friberg From Paul Koning : diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 2e8944e79cc..0262409f5b7 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1775,7 +1775,7 @@ frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \ $(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(user_regs_h) \ $(gdb_obstack_h) $(dummy_frame_h) $(sentinel_frame_h) $(gdbcore_h) \ $(annotate_h) $(language_h) $(frame_unwind_h) $(frame_base_h) \ - $(command_h) $(gdbcmd_h) + $(command_h) $(gdbcmd_h) $(observer_h) frame-unwind.o: frame-unwind.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(gdb_assert_h) $(dummy_frame_h) $(gdb_obstack_h) frv-linux-tdep.o: frv-linux-tdep.c $(defs_h) $(target_h) $(frame_h) \ @@ -2190,7 +2190,7 @@ p-valprint.o: p-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \ $(language_h) $(target_h) $(annotate_h) $(p_lang_h) $(cp_abi_h) regcache.o: regcache.c $(defs_h) $(inferior_h) $(target_h) $(gdbarch_h) \ $(gdbcmd_h) $(regcache_h) $(reggroups_h) $(gdb_assert_h) \ - $(gdb_string_h) $(gdbcmd_h) + $(gdb_string_h) $(gdbcmd_h) $(observer_h) reggroups.o: reggroups.c $(defs_h) $(reggroups_h) $(gdbtypes_h) \ $(gdb_assert_h) $(regcache_h) $(command_h) $(gdbcmd_h) remote.o: remote.c $(defs_h) $(gdb_string_h) $(inferior_h) $(bfd_h) \ @@ -2493,7 +2493,7 @@ valops.o: valops.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) $(frame_h) \ $(inferior_h) $(gdbcore_h) $(target_h) $(demangle_h) $(language_h) \ $(gdbcmd_h) $(regcache_h) $(cp_abi_h) $(block_h) $(infcall_h) \ $(dictionary_h) $(cp_support_h) $(gdb_string_h) $(gdb_assert_h) \ - $(cp_support_h) + $(cp_support_h) $(observer_h) valprint.o: valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(language_h) \ $(annotate_h) $(valprint_h) $(floatformat_h) $(doublest_h) diff --git a/gdb/frame.c b/gdb/frame.c index f9384fe5d54..bdb6cb9221c 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -39,6 +39,7 @@ #include "frame-base.h" #include "command.h" #include "gdbcmd.h" +#include "observer.h" static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame); @@ -1237,6 +1238,14 @@ get_next_frame (struct frame_info *this_frame) return NULL; } +/* Observer for the target_changed event. */ + +void +frame_observer_target_changed (struct target_ops *target) +{ + flush_cached_frames (); +} + /* Flush the entire frame cache. */ void @@ -2356,6 +2365,8 @@ _initialize_frame (void) { obstack_init (&frame_cache_obstack); + observer_attach_target_changed (frame_observer_target_changed); + add_prefix_cmd ("backtrace", class_maintenance, set_backtrace_cmd, "\ Set backtrace specific variables.\n\ Configure backtrace variables such as the backtrace limit", diff --git a/gdb/regcache.c b/gdb/regcache.c index 91204b8e9a4..e775e4d8c24 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -30,6 +30,7 @@ #include "gdb_assert.h" #include "gdb_string.h" #include "gdbcmd.h" /* For maintenanceprintlist. */ +#include "observer.h" /* * DATA STRUCTURE @@ -566,6 +567,14 @@ real_register (int regnum) return regnum >= 0 && regnum < NUM_REGS; } +/* Observer for the target_changed event. */ + +void +regcache_observer_target_changed (struct target_ops *target) +{ + registers_changed (); +} + /* Low level examining and depositing of registers. The caller is responsible for making sure that the inferior is @@ -1697,6 +1706,8 @@ _initialize_regcache (void) DEPRECATED_REGISTER_GDBARCH_SWAP (deprecated_register_valid); deprecated_register_gdbarch_swap (NULL, 0, build_regcache); + observer_attach_target_changed (regcache_observer_target_changed); + add_com ("flushregs", class_maintenance, reg_flush_command, "Force gdb to flush its register cache (maintainer command)"); diff --git a/gdb/valops.c b/gdb/valops.c index be7dec585f2..5ab41496e95 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -42,6 +42,7 @@ #include "gdb_string.h" #include "gdb_assert.h" #include "cp-support.h" +#include "observer.h" extern int overload_debug; /* Local functions. */ @@ -701,6 +702,7 @@ value_assign (struct value *toval, struct value *fromval) if (deprecated_register_changed_hook) deprecated_register_changed_hook (-1); target_changed_event (); + observer_notify_target_changed (¤t_target); break; }