aboutsummaryrefslogtreecommitdiff
path: root/gdb/observable.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-04-03 14:52:03 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-04-17 13:47:13 -0400
commitf56944000c014116905d4fffe27da05ef8896cfd (patch)
tree38816146448e8be99b9eacc7261470f3c7e1f8d7 /gdb/observable.h
parent4a1283c8d56a43a5146744cec6960556d9b40605 (diff)
downloadgdb-f56944000c014116905d4fffe27da05ef8896cfd.zip
gdb-f56944000c014116905d4fffe27da05ef8896cfd.tar.gz
gdb-f56944000c014116905d4fffe27da05ef8896cfd.tar.bz2
gdb: add inferior_forked observable
In the upcoming patch to support fork in the amd-dbgapi target, the amd-dbgapi target will need to be notified of fork events through an observer, to attach itself (attach in the amd-dbgapi sense, not ptrace sense) to the new inferior / process. The reason that this can't be done through target_ops::follow_fork is that the amd-dbgapi target isn't pushed on the inferior's target stack right away. It attaches itself to the process and only pushes itself on its target stack if and when the inferior initializes the ROCm runtime. If an inferior that is not using the ROCm runtime forks, we want to be notified of it, so we can attach to the child, and catch if the child starts using the ROCm runtime. So, add a new observable and notify it in follow_fork_inferior. It will be used later in this series. Change-Id: I67fced5a9cba6d5da72b9c7ea1c8397644ca1d54 Reviewed-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/observable.h')
-rw-r--r--gdb/observable.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/observable.h b/gdb/observable.h
index 00955cb..3066cf6 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -21,6 +21,7 @@
#define OBSERVABLE_H
#include "gdbsupport/observable.h"
+#include "target/waitstatus.h"
struct bpstat;
struct so_list;
@@ -97,6 +98,14 @@ extern observable<inferior */* inferior */> inferior_created;
extern observable<inferior */* exec_inf */, inferior */* follow_inf */>
inferior_execd;
+/* The inferior PARENT_INF has forked. If we are setting up an inferior for
+ the child (because we follow only the child or we follow both), CHILD_INF
+ is the child inferior. Otherwise, CHILD_INF is nullptr.
+
+ FORK_KIND is TARGET_WAITKIND_FORKED or TARGET_WAITKIND_VFORKED. */
+extern observable<inferior */* parent_inf */, inferior */* child_inf */,
+ target_waitkind /* fork_kind */> inferior_forked;
+
/* The status of process record for inferior inferior in gdb has
changed. The process record is started if STARTED is true, and
the process record is stopped if STARTED is false.