diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-12-04 16:43:56 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-12-04 16:43:56 -0500 |
commit | d965505887c27e8b1d6e84cb06c2b131aad08093 (patch) | |
tree | 23c84518bed4de4907a17c7bbaba400110f28ac2 /gdb | |
parent | 187b041e2514827b9d86190ed2471c4c7a352874 (diff) | |
download | gdb-d965505887c27e8b1d6e84cb06c2b131aad08093.zip gdb-d965505887c27e8b1d6e84cb06c2b131aad08093.tar.gz gdb-d965505887c27e8b1d6e84cb06c2b131aad08093.tar.bz2 |
gdb: change linux gdbarch data from post to pre-init
The following patch will need to fill a field in linux_gdbarch_data
while the gdbarch is being built. linux_gdbarch_data is currently
allocated as a post-init gdbarch data, meaning it's not possible to fill
it before the gdbarch is completely initialized. Change it to a
pre-init gdbarch data to allow this.
The init_linux_gdbarch_data function doesn't use the created gdbarch,
it only allocates the linux_gdbarch_data structure on the gdbarch's
obstack, so the change is trivial.
gdb/ChangeLog:
* linux-tdep.c (init_linux_gdbarch_data): Change parameter to
obkstack.
(_initialize_linux_tdep): Register pre-init gdb data instead of
post-init.
Change-Id: If35ce91b6bb5435680d43b9268d811d95661644f
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/linux-tdep.c | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f39730f..d79b221 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2020-12-04 Simon Marchi <simon.marchi@efficios.com> + * linux-tdep.c (init_linux_gdbarch_data): Change parameter to + obkstack. + (_initialize_linux_tdep): Register pre-init gdb data instead of + post-init. + +2020-12-04 Simon Marchi <simon.marchi@efficios.com> + * displaced-stepping.h (struct displaced_step_copy_insn_closure): Adjust comments. (struct displaced_step_inferior_state) <step_thread, diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 70e74d5..57ea45c 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -171,9 +171,9 @@ struct linux_gdbarch_data }; static void * -init_linux_gdbarch_data (struct gdbarch *gdbarch) +init_linux_gdbarch_data (struct obstack *obstack) { - return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct linux_gdbarch_data); + return obstack_zalloc<linux_gdbarch_data> (obstack); } static struct linux_gdbarch_data * @@ -2676,7 +2676,7 @@ void _initialize_linux_tdep () { linux_gdbarch_data_handle = - gdbarch_data_register_post_init (init_linux_gdbarch_data); + gdbarch_data_register_pre_init (init_linux_gdbarch_data); /* Observers used to invalidate the cache when needed. */ gdb::observers::inferior_exit.attach (invalidate_linux_cache_inf); |