aboutsummaryrefslogtreecommitdiff
path: root/gdb/jit.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2020-07-22 15:56:06 +0200
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-07-22 15:56:06 +0200
commit238b5c9f0881b2e27d2eb111ad9c7fe874859acf (patch)
tree4a6c48835685490c23f61d568798cf575ed39acc /gdb/jit.h
parentfe053b9e85378b4df1397684266b2cddcce8123b (diff)
downloadgdb-238b5c9f0881b2e27d2eb111ad9c7fe874859acf.zip
gdb-238b5c9f0881b2e27d2eb111ad9c7fe874859acf.tar.gz
gdb-238b5c9f0881b2e27d2eb111ad9c7fe874859acf.tar.bz2
gdb/jit: link to jit_objfile_data directly from the objfile struct
Remove the use of objfile_data to associate a jit_objfile_data with an objfile. Instead, directly link to a jit_objfile_data from an objfile struct. The goal is to eliminate unnecessary abstraction. The free_objfile_data function naturally becomes the destructor of jit_objfile_data. However, free_objfile_data accesses the objfile to which the data is attached, which the destructor of jit_objfile_data doesn't have access to. To work around this, add a backlink to the owning objfile in jit_objfile_data. This is however temporary, it goes away in a subsequent patch. gdb/ChangeLog: 2020-07-22 Simon Marchi <simon.marchi@polymtl.ca> * jit.h: Forward-declare `struct minimal_symbol`. (struct jit_objfile_data): Migrate to here from jit.c; also add a constructor, destructor, and an objfile* field. * jit.c (jit_objfile_data): Remove. (struct jit_objfile_data): Migrate from here to jit.h. (jit_objfile_data::~jit_objfile_data): New destructor implementation with code moved from free_objfile_data. (free_objfile_data): Delete. (get_jit_objfile_data): Update to use the jit_data field of objfile. (jit_find_objf_with_entry_addr): Ditto. (jit_inferior_exit_hook): Ditto. (_initialize_jit): Remove the call to register_objfile_data_with_cleanup. * objfiles.h (struct objfile) <jit_data>: New field.
Diffstat (limited to 'gdb/jit.h')
-rw-r--r--gdb/jit.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/gdb/jit.h b/gdb/jit.h
index 71e78a5..6109216 100644
--- a/gdb/jit.h
+++ b/gdb/jit.h
@@ -21,6 +21,7 @@
#define JIT_H
struct objfile;
+struct minimal_symbol;
/* When the JIT breakpoint fires, the inferior wants us to take one of
these actions. These values are used by the inferior, so the
@@ -66,6 +67,34 @@ 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. */
+
+struct jit_objfile_data
+{
+ jit_objfile_data (struct objfile *objfile)
+ : objfile (objfile)
+ {}
+
+ ~jit_objfile_data ();
+
+ /* Back-link to the objfile. */
+ struct objfile *objfile;
+
+ /* Symbol for __jit_debug_register_code. */
+ minimal_symbol *register_code = nullptr;
+
+ /* 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;
+};
+
/* 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