2004-04-26 Orjan Friberg <orjanf@axis.com>

* 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).
This commit is contained in:
Orjan Friberg 2004-04-26 09:49:36 +00:00
parent 79346bcbc0
commit f4c5303c32
5 changed files with 39 additions and 3 deletions

View file

@ -1,3 +1,15 @@
2004-04-26 Orjan Friberg <orjanf@axis.com>
* 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 <orjanf@axis.com>
From Paul Koning <pkoning@equallogic.com>:

View file

@ -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)

View file

@ -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",

View file

@ -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)");

View file

@ -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 (&current_target);
break;
}