From: Orjan Friberg <orjan.friberg@axis.com>
To: Andrew Cagney <cagney@gnu.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Multiplexed registers and invalidating the register cache
Date: Fri, 23 Apr 2004 15:20:00 -0000 [thread overview]
Message-ID: <40893437.2020907@axis.com> (raw)
In-Reply-To: <408927CF.10807@gnu.org>
Andrew Cagney wrote:
> Yes, on all counts!
Wohoo! Patches below:
2004-04-23 Orjan Friberg <orjanf@axis.com>
* observer.texi (GDB Observers): Add target_changed event.
Index: doc/observer.texi
===================================================================
RCS file: /cvs/src/src/gdb/doc/observer.texi,v
retrieving revision 1.3
diff -u -p -r1.3 observer.texi
--- doc/observer.texi 15 Apr 2004 14:29:21 -0000 1.3
+++ doc/observer.texi 23 Apr 2004 15:02:02 -0000
@@ -73,3 +73,7 @@ The following observable events are defi
@deftypefun void normal_stop (struct bpstats *@var{bs})
The inferior has stopped for real.
@end deftypefun
+
+@deftypefun void target_changed (struct target_ops *@var{current_target})
+The target's register contents has changed.
+@end deftypefun
2004-04-23 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.
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.172
diff -u -p -r1.172 frame.c
--- frame.c 21 Apr 2004 23:52:20 -0000 1.172
+++ frame.c 23 Apr 2004 15:17:59 -0000
@@ -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_
return NULL;
}
+/* Observer for the target_changed event. */
+
+void
+frame_observer_target_changed (struct target_ops *current_target)
+{
+ flush_cached_frames ();
+}
+
/* Flush the entire frame cache. */
void
@@ -2355,6 +2364,8 @@ void
_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\
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.112
diff -u -p -r1.112 regcache.c
--- regcache.c 21 Apr 2004 23:52:20 -0000 1.112
+++ regcache.c 23 Apr 2004 15:17:59 -0000
@@ -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 *current_target)
+{
+ registers_changed ();
+}
+
/* Low level examining and depositing of registers.
The caller is responsible for making sure that the inferior is
@@ -1696,6 +1705,8 @@ _initialize_regcache (void)
DEPRECATED_REGISTER_GDBARCH_SWAP (deprecated_registers);
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)");
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.123
diff -u -p -r1.123 valops.c
--- valops.c 21 Apr 2004 23:52:21 -0000 1.123
+++ valops.c 23 Apr 2004 15:18:00 -0000
@@ -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, struc
if (deprecated_register_changed_hook)
deprecated_register_changed_hook (-1);
target_changed_event ();
+ observer_notify_target_changed (current_target);
break;
}
--
Orjan Friberg
Axis Communications
next prev parent reply other threads:[~2004-04-23 15:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-14 11:44 Orjan Friberg
2004-04-14 14:46 ` Daniel Jacobowitz
2004-04-14 16:01 ` Andrew Cagney
2004-04-15 10:46 ` Orjan Friberg
2004-04-15 11:25 ` Orjan Friberg
2004-04-15 15:29 ` Andrew Cagney
2004-04-16 12:51 ` Orjan Friberg
2004-04-16 14:13 ` Daniel Jacobowitz
2004-04-16 14:54 ` Orjan Friberg
2004-04-16 19:15 ` Andrew Cagney
2004-04-19 14:13 ` Orjan Friberg
2004-04-21 16:48 ` Andrew Cagney
2004-04-22 13:58 ` Orjan Friberg
2004-04-22 14:33 ` Andrew Cagney
2004-04-23 11:25 ` Orjan Friberg
2004-04-24 0:03 ` Andrew Cagney
2004-04-23 15:20 ` Orjan Friberg [this message]
2004-04-23 17:58 ` Eli Zaretskii
2004-04-26 9:41 ` Orjan Friberg
2004-04-24 0:03 ` Andrew Cagney
2004-04-24 8:30 ` Eli Zaretskii
2004-04-28 16:43 ` Andrew Cagney
2004-04-28 17:40 ` Eli Zaretskii
2004-04-29 8:09 ` Orjan Friberg
2004-04-29 17:56 ` Eli Zaretskii
2004-04-30 7:39 ` Orjan Friberg
2004-04-26 9:50 ` Orjan Friberg
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=40893437.2020907@axis.com \
--to=orjan.friberg@axis.com \
--cc=cagney@gnu.org \
--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