Rename fprintf_symbol_filtered
[binutils-gdb.git] / gdb / jit.h
index 6109216639142cc5e6ba4ac8feacd8c30f85abd5..274ce456f471bb8717fc7e14ed9a454949defdab 100644 (file)
--- a/gdb/jit.h
+++ b/gdb/jit.h
@@ -1,6 +1,6 @@
 /* JIT declarations for GDB, the GNU Debugger.
 
-   Copyright (C) 2009-2020 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -20,6 +20,7 @@
 #ifndef JIT_H
 #define JIT_H
 
+struct inferior;
 struct objfile;
 struct minimal_symbol;
 
@@ -67,22 +68,12 @@ struct jit_descriptor
   CORE_ADDR first_entry;
 };
 
-/* Per-objfile structure recording the addresses in the program space.
-   This object serves two purposes: for ordinary objfiles, it may
-   cache some symbols related to the JIT interface; and for
-   JIT-created objfiles, it holds some information about the
-   jit_code_entry.  */
+/* An objfile that defines the required symbols of the JIT interface has an
+   instance of this type attached to it.  */
 
-struct jit_objfile_data
+struct jiter_objfile_data
 {
-  jit_objfile_data (struct objfile *objfile)
-    : objfile (objfile)
-  {}
-
-  ~jit_objfile_data ();
-
-  /* Back-link to the objfile. */
-  struct objfile *objfile;
+  ~jiter_objfile_data ();
 
   /* Symbol for __jit_debug_register_code.  */
   minimal_symbol *register_code = nullptr;
@@ -90,17 +81,36 @@ struct jit_objfile_data
   /* Symbol for __jit_debug_descriptor.  */
   minimal_symbol *descriptor = nullptr;
 
-  /* Address of struct jit_code_entry in this objfile.  This is only
-     non-zero for objfiles that represent code created by the JIT.  */
-  CORE_ADDR addr = 0;
+  /* This is the relocated address of the __jit_debug_register_code function
+     provided by this objfile.  This is used to detect relocations changes
+     requiring the breakpoint to be re-created.  */
+  CORE_ADDR cached_code_address = 0;
+
+  /* This is the JIT event breakpoint, or nullptr if it has been deleted.  */
+  breakpoint *jit_breakpoint = nullptr;
 };
 
-/* 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.  */
+/* An objfile that is the product of JIT compilation and was registered
+   using the JIT interface has an instance of this type attached to it.  */
+
+struct jited_objfile_data
+{
+  jited_objfile_data (CORE_ADDR addr, CORE_ADDR symfile_addr,
+                     ULONGEST symfile_size)
+    : addr (addr),
+      symfile_addr (symfile_addr),
+      symfile_size (symfile_size)
+  {}
+
+  /* Address of struct jit_code_entry for this objfile.  */
+  CORE_ADDR addr;
+
+  /* Value of jit_code_entry->symfile_addr for this objfile.  */
+  CORE_ADDR symfile_addr;
 
-extern void jit_inferior_created_hook (void);
+  /* Value of jit_code_entry->symfile_size for this objfile.  */
+  ULONGEST symfile_size;
+};
 
 /* Re-establish the jit breakpoint(s).  */