]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/jit.c
Fix JIT clang-lli regression (unable to read JIT descriptor from memory)
[thirdparty/binutils-gdb.git] / gdb / jit.c
index be123a542ccff6e95aac28216343d26277247006..01ac5fa3a0d9502a5385020fe86716a7b1b8afdd 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -40,6 +40,9 @@ static const char *const jit_descriptor_name = "__jit_debug_descriptor";
 
 static const struct inferior_data *jit_inferior_data = NULL;
 
+static void
+jit_inferior_init (struct gdbarch *gdbarch);
+
 /* Non-zero if we want to see trace of jit level stuff.  */
 
 static int jit_debug = 0;
@@ -351,6 +354,11 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
       inf_data->breakpoint_addr = SYMBOL_VALUE_ADDRESS (reg_symbol);
       if (inf_data->breakpoint_addr == 0)
        return 2;
+
+      /* If we have not read the jit descriptor yet (e.g. because the JITer
+        itself is in a shared library which just got loaded), do so now.  */
+      if (inf_data->descriptor_addr == 0)
+       jit_inferior_init (gdbarch);
     }
   else
     return 0;