aboutsummaryrefslogtreecommitdiff
path: root/gdb/jit.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/jit.c')
-rw-r--r--gdb/jit.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/jit.c b/gdb/jit.c
index b3c52c0..666262e 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -74,6 +74,30 @@ show_jit_debug (struct ui_file *file, int from_tty,
fprintf_filtered (file, _("JIT debugging is %s.\n"), value);
}
+/* Implementation of the "maintenance info jit" command. */
+
+static void
+maint_info_jit_cmd (const char *args, int from_tty)
+{
+ inferior *inf = current_inferior ();
+ bool printed_header = false;
+
+ /* Print a line for each JIT-ed objfile. */
+ for (objfile *obj : inf->pspace->objfiles ())
+ {
+ if (obj->jited_data == nullptr)
+ continue;
+
+ if (!printed_header)
+ {
+ printf_filtered ("Base address of known JIT-ed objfiles:\n");
+ printed_header = true;
+ }
+
+ printf_filtered (" %s\n", paddress (obj->arch (), obj->jited_data->addr));
+ }
+}
+
struct jit_reader
{
jit_reader (struct gdb_reader_funcs *f, gdb_dlhandle_up &&h)
@@ -1248,6 +1272,10 @@ _initialize_jit ()
show_jit_debug,
&setdebuglist, &showdebuglist);
+ add_cmd ("jit", class_maintenance, maint_info_jit_cmd,
+ _("Print information about JIT-ed code objects."),
+ &maintenanceinfolist);
+
gdb::observers::inferior_created.attach (jit_inferior_created_hook, "jit");
gdb::observers::inferior_execd.attach (jit_inferior_created_hook, "jit");
gdb::observers::inferior_exit.attach (jit_inferior_exit_hook, "jit");