aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2020-10-24 22:59:51 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2020-10-25 09:06:09 -0400
commit324956617c35b0e204f54b8da8db2de2bd3b129e (patch)
tree27c477731c7b60c9a7fbbd88db7ce6b9ef453024
parent3f66685e9e92717af0cafa20480de5548aea7298 (diff)
downloadgdb-324956617c35b0e204f54b8da8db2de2bd3b129e.zip
gdb-324956617c35b0e204f54b8da8db2de2bd3b129e.tar.gz
gdb-324956617c35b0e204f54b8da8db2de2bd3b129e.tar.bz2
gdb: make jit.c use the inferior_created inferior parameter
Use the inferior parameter now available in jit_inferior_created_hook. It is passed down to jit_inferior_init, which uses it as much as possible instead of the current inferior or current program space. gdb/ChangeLog: * jit.c (jit_reader_load_command): Pass current inferior. (jit_inferior_init): Change parameter type to inferior, use it. (jit_inferior_created): Remove. (jit_inferior_created_hook): Pass inferior parameter down. (_initialize_jit): Use jit_inferior_created_hook instead of jit_inferior_created. * jit.h (jit_inferior_created_hook): Add inferior parameter. * infrun.c (follow_exec): Pass inferior to jit_inferior_created_hook. Change-Id: If3a2114a933370dd313d5abd623136d273cdb8fa
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/infrun.c2
-rw-r--r--gdb/jit.c27
-rw-r--r--gdb/jit.h3
4 files changed, 25 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index af9d5ab..c1a92bb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2020-10-24 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * jit.c (jit_reader_load_command): Pass current inferior.
+ (jit_inferior_init): Change parameter type to inferior, use it.
+ (jit_inferior_created): Remove.
+ (jit_inferior_created_hook): Pass inferior parameter down.
+ (_initialize_jit): Use jit_inferior_created_hook instead of
+ jit_inferior_created.
+ * jit.h (jit_inferior_created_hook): Add inferior parameter.
+ * infrun.c (follow_exec): Pass inferior to
+ jit_inferior_created_hook.
+
2020-10-24 Simon Marchi <simon.marchi@efficios.com>
* linux-thread-db.c (check_pid_namespace_match): Add inferior
diff --git a/gdb/infrun.c b/gdb/infrun.c
index c2acea6..5a6ff16 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1236,7 +1236,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
solib_create_inferior_hook (0);
- jit_inferior_created_hook ();
+ jit_inferior_created_hook (inf);
breakpoint_re_set ();
diff --git a/gdb/jit.c b/gdb/jit.c
index 6f1f7e6..fd24d53 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -49,7 +49,6 @@ static const char jit_break_name[] = "__jit_debug_register_code";
static const char jit_descriptor_name[] = "__jit_debug_descriptor";
-static void jit_inferior_init (struct gdbarch *gdbarch);
static void jit_inferior_exit_hook (struct inferior *inf);
/* An unwinder is registered for every gdbarch. This key is used to
@@ -221,7 +220,7 @@ jit_reader_load_command (const char *args, int from_tty)
loaded_jit_reader = jit_reader_load (file.get ());
reinit_frame_cache ();
- jit_inferior_created_hook ();
+ jit_inferior_created_hook (current_inferior ());
}
/* Provides the jit-reader-unload command. */
@@ -1178,20 +1177,22 @@ jit_prepend_unwinder (struct gdbarch *gdbarch)
/* Register any already created translations. */
static void
-jit_inferior_init (struct gdbarch *gdbarch)
+jit_inferior_init (inferior *inf)
{
struct jit_descriptor descriptor;
struct jit_code_entry cur_entry;
CORE_ADDR cur_entry_addr;
+ struct gdbarch *gdbarch = inf->gdbarch;
+ program_space *pspace = inf->pspace;
if (jit_debug)
fprintf_unfiltered (gdb_stdlog, "jit_inferior_init\n");
jit_prepend_unwinder (gdbarch);
- jit_breakpoint_re_set_internal (gdbarch, current_program_space);
+ jit_breakpoint_re_set_internal (gdbarch, pspace);
- for (objfile *jiter : current_program_space->objfiles ())
+ for (objfile *jiter : pspace->objfiles ())
{
if (jiter->jiter_data == nullptr)
continue;
@@ -1229,20 +1230,12 @@ jit_inferior_init (struct gdbarch *gdbarch)
}
}
-/* inferior_created observer. */
-
-static void
-jit_inferior_created (inferior *inf)
-{
- jit_inferior_created_hook ();
-}
-
-/* Exported routine to call when an inferior has been created. */
+/* See jit.h. */
void
-jit_inferior_created_hook (void)
+jit_inferior_created_hook (inferior *inf)
{
- jit_inferior_init (target_gdbarch ());
+ jit_inferior_init (inf);
}
/* Exported routine to call to re-set the jit breakpoints,
@@ -1343,7 +1336,7 @@ _initialize_jit ()
show_jit_debug,
&setdebuglist, &showdebuglist);
- gdb::observers::inferior_created.attach (jit_inferior_created);
+ gdb::observers::inferior_created.attach (jit_inferior_created_hook);
gdb::observers::inferior_exit.attach (jit_inferior_exit_hook);
gdb::observers::breakpoint_deleted.attach (jit_breakpoint_deleted);
diff --git a/gdb/jit.h b/gdb/jit.h
index 739a8f3..6f972a6 100644
--- a/gdb/jit.h
+++ b/gdb/jit.h
@@ -20,6 +20,7 @@
#ifndef JIT_H
#define JIT_H
+struct inferior;
struct objfile;
struct minimal_symbol;
@@ -107,7 +108,7 @@ struct jited_objfile_data
already JITed code. If it has already found the symbols, then it
doesn't try again. */
-extern void jit_inferior_created_hook (void);
+extern void jit_inferior_created_hook (inferior *inf);
/* Re-establish the jit breakpoint(s). */