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.
This commit is contained in:
parent
fe053b9e85
commit
238b5c9f08
4 changed files with 72 additions and 61 deletions
|
@ -36,6 +36,7 @@
|
|||
#include "bcache.h"
|
||||
#include "gdbarch.h"
|
||||
#include "gdbsupport/refcounted-object.h"
|
||||
#include "jit.h"
|
||||
|
||||
struct htab;
|
||||
struct objfile_data;
|
||||
|
@ -697,6 +698,9 @@ public:
|
|||
store these here rather than in struct block. Static links must be
|
||||
allocated on the objfile's obstack. */
|
||||
htab_up static_links;
|
||||
|
||||
/* JIT-related data for this objfile. */
|
||||
std::unique_ptr<jit_objfile_data> jit_data = nullptr;
|
||||
};
|
||||
|
||||
/* A deleter for objfile. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue