aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-04-13 16:18:34 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-09-15 16:16:26 -0400
commitc6ae604573f9e9d7b7a15388bdba2d1dabecd131 (patch)
tree1a24a4f98fb7f3bbfb7da1dd079876b3b87046d6
parent0e0edacca5f34621f85e93a22ee31c6810b5941c (diff)
downloadgdb-c6ae604573f9e9d7b7a15388bdba2d1dabecd131.zip
gdb-c6ae604573f9e9d7b7a15388bdba2d1dabecd131.tar.gz
gdb-c6ae604573f9e9d7b7a15388bdba2d1dabecd131.tar.bz2
gdb: add inferior_cloned observable
The following patch makes the amdgpu port transfer a property from the original inferior to the new inferior when using the clone-inferior command. Add the inferior_cloned observable to help with this. Change-Id: Id845a799813ec49b1b7b2fcb97b07d0a1e5e2631 Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r--gdb/inferior.c2
-rw-r--r--gdb/observable.c1
-rw-r--r--gdb/observable.h4
3 files changed, 7 insertions, 0 deletions
diff --git a/gdb/inferior.c b/gdb/inferior.c
index ce4960a..550bbd2 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -1041,6 +1041,8 @@ clone_inferior_command (const char *args, int from_tty)
for (const std::string &unset_var
: orginf->environment.user_unset_env ())
inf->environment.unset (unset_var.c_str ());
+
+ gdb::observers::inferior_cloned.notify (orginf, inf);
}
}
diff --git a/gdb/observable.c b/gdb/observable.c
index a18b863..33e5122 100644
--- a/gdb/observable.c
+++ b/gdb/observable.c
@@ -58,6 +58,7 @@ DEFINE_OBSERVABLE (inferior_appeared);
DEFINE_OBSERVABLE (inferior_pre_detach);
DEFINE_OBSERVABLE (inferior_exit);
DEFINE_OBSERVABLE (inferior_removed);
+DEFINE_OBSERVABLE (inferior_cloned);
DEFINE_OBSERVABLE (memory_changed);
DEFINE_OBSERVABLE (before_prompt);
DEFINE_OBSERVABLE (gdb_datadir_changed);
diff --git a/gdb/observable.h b/gdb/observable.h
index c0bafc5..4ea203c 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -172,6 +172,10 @@ extern observable<struct inferior */* inf */> inferior_exit;
This method is called immediately before freeing INF. */
extern observable<struct inferior */* inf */> inferior_removed;
+/* The inferior CLONE has been created by cloning INF. */
+extern observable<struct inferior */* inf */, struct inferior */* clone */>
+ inferior_cloned;
+
/* Bytes from DATA to DATA + LEN have been written to the inferior
at ADDR. */
extern observable<struct inferior */* inferior */, CORE_ADDR /* addr */,