aboutsummaryrefslogtreecommitdiff
path: root/gdb/jit.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-04-03 14:52:02 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-04-17 13:47:13 -0400
commit4a1283c8d56a43a5146744cec6960556d9b40605 (patch)
tree53d93294ddcff0748b4abed362d1987d21fa5be4 /gdb/jit.c
parente49831ba4340688d7685a52099db09d12177945b (diff)
downloadgdb-4a1283c8d56a43a5146744cec6960556d9b40605.zip
gdb-4a1283c8d56a43a5146744cec6960556d9b40605.tar.gz
gdb-4a1283c8d56a43a5146744cec6960556d9b40605.tar.bz2
gdb: pass execing and following inferior to inferior_execd observers
The upcoming patch to support exec in the amd-dbgapi target needs to detach amd-dbgapi from the inferior doing the exec and attach amd-dbgapi to the inferior continuing the execution. They may or may not be the same, depending on the `set follow-exec-mode` setting. But even if they are the same, we need to do the detach / attach dance. With the current observable signature, the observers only receive the inferior in which execution continues (the "following" inferior). Change the signature to pass both inferiors, and update all existing observers. Change-Id: I259d1ea09f70f43be739378d6023796f2fce2659 Reviewed-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/jit.c')
-rw-r--r--gdb/jit.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gdb/jit.c b/gdb/jit.c
index e276b34..e085d56 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1147,7 +1147,10 @@ jit_prepend_unwinder (struct gdbarch *gdbarch)
}
}
-/* Register any already created translations. */
+/* Looks for the descriptor and registration symbols and breakpoints
+ the registration function. If it finds both, it registers all the
+ already JITed code. If it has already found the symbols, then it
+ doesn't try again. */
static void
jit_inferior_init (inferior *inf)
@@ -1203,10 +1206,7 @@ jit_inferior_init (inferior *inf)
}
}
-/* Looks for the descriptor and registration symbols and breakpoints
- the registration function. If it finds both, it registers all the
- already JITed code. If it has already found the symbols, then it
- doesn't try again. */
+/* inferior_created observer. */
static void
jit_inferior_created_hook (inferior *inf)
@@ -1214,6 +1214,14 @@ jit_inferior_created_hook (inferior *inf)
jit_inferior_init (inf);
}
+/* inferior_execd observer. */
+
+static void
+jit_inferior_execd_hook (inferior *exec_inf, inferior *follow_inf)
+{
+ jit_inferior_init (follow_inf);
+}
+
/* Exported routine to call to re-set the jit breakpoints,
e.g. when a program is rerun. */
@@ -1304,7 +1312,7 @@ _initialize_jit ()
&maintenanceinfolist);
gdb::observers::inferior_created.attach (jit_inferior_created_hook, "jit");
- gdb::observers::inferior_execd.attach (jit_inferior_created_hook, "jit");
+ gdb::observers::inferior_execd.attach (jit_inferior_execd_hook, "jit");
gdb::observers::inferior_exit.attach (jit_inferior_exit_hook, "jit");
gdb::observers::breakpoint_deleted.attach (jit_breakpoint_deleted, "jit");