From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 6/9] Change solib-dsbt.c to use type-safe registry
Date: Wed, 10 Jul 2019 15:39:00 -0000 [thread overview]
Message-ID: <20190710153947.25721-7-tromey@adacore.com> (raw)
In-Reply-To: <20190710153947.25721-1-tromey@adacore.com>
This changes solib-dsbt.c to use the type-safe registry.
gdb/ChangeLog
2019-07-10 Tom Tromey <tromey@adacore.com>
* solib-dsbt.c (struct dsbt_info): Add initializers.
(solib_dsbt_pspace_data): Change type.
(dsbt_pspace_data_cleanup): Remove.
(get_dsbt_info, _initialize_dsbt_solib): Update.
---
gdb/ChangeLog | 7 +++++++
gdb/solib-dsbt.c | 40 ++++++++++++----------------------------
2 files changed, 19 insertions(+), 28 deletions(-)
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 3053c189802..59b195f491e 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -142,35 +142,29 @@ struct dsbt_info
of loaded shared objects. ``main_executable_lm_info'' provides
a way to get at this information so that it doesn't need to be
frequently recomputed. Initialized by dsbt_relocate_main_executable. */
- struct lm_info_dsbt *main_executable_lm_info;
+ struct lm_info_dsbt *main_executable_lm_info = nullptr;
/* Load maps for the main executable and the interpreter. These are obtained
from ptrace. They are the starting point for getting into the program,
and are required to find the solib list with the individual load maps for
each module. */
- struct int_elf32_dsbt_loadmap *exec_loadmap;
- struct int_elf32_dsbt_loadmap *interp_loadmap;
+ struct int_elf32_dsbt_loadmap *exec_loadmap = nullptr;
+ struct int_elf32_dsbt_loadmap *interp_loadmap = nullptr;
/* Cached value for lm_base, below. */
- CORE_ADDR lm_base_cache;
+ CORE_ADDR lm_base_cache = 0;
/* Link map address for main module. */
- CORE_ADDR main_lm_addr;
+ CORE_ADDR main_lm_addr = 0;
- CORE_ADDR interp_text_sect_low;
- CORE_ADDR interp_text_sect_high;
- CORE_ADDR interp_plt_sect_low;
- CORE_ADDR interp_plt_sect_high;
+ CORE_ADDR interp_text_sect_low = 0;
+ CORE_ADDR interp_text_sect_high = 0;
+ CORE_ADDR interp_plt_sect_low = 0;
+ CORE_ADDR interp_plt_sect_high = 0;
};
/* Per-program-space data key. */
-static const struct program_space_data *solib_dsbt_pspace_data;
-
-static void
-dsbt_pspace_data_cleanup (struct program_space *pspace, void *arg)
-{
- xfree (arg);
-}
+static program_space_key<dsbt_info> solib_dsbt_pspace_data;
/* Get the current dsbt data. If none is found yet, add it now. This
function always returns a valid object. */
@@ -180,18 +174,11 @@ get_dsbt_info (void)
{
struct dsbt_info *info;
- info = (struct dsbt_info *) program_space_data (current_program_space,
- solib_dsbt_pspace_data);
+ info = solib_dsbt_pspace_data.get (current_program_space);
if (info != NULL)
return info;
- info = XCNEW (struct dsbt_info);
- set_program_space_data (current_program_space, solib_dsbt_pspace_data, info);
-
- info->lm_base_cache = 0;
- info->main_lm_addr = 0;
-
- return info;
+ return solib_dsbt_pspace_data.emplace (current_program_space);
}
@@ -1043,9 +1030,6 @@ struct target_so_ops dsbt_so_ops;
void
_initialize_dsbt_solib (void)
{
- solib_dsbt_pspace_data
- = register_program_space_data_with_cleanup (NULL, dsbt_pspace_data_cleanup);
-
dsbt_so_ops.relocate_section_addresses = dsbt_relocate_section_addresses;
dsbt_so_ops.free_so = dsbt_free_so;
dsbt_so_ops.clear_solib = dsbt_clear_solib;
--
2.20.1
next prev parent reply other threads:[~2019-07-10 15:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 15:39 [PATCH 0/9] Use the type-safe registry in more cases Tom Tromey
2019-07-10 15:39 ` [PATCH 1/9] Change remote-sim.c to use type-safe registry Tom Tromey
2019-07-10 16:59 ` Simon Marchi
2019-07-10 17:03 ` Tom Tromey
2019-07-10 15:39 ` [PATCH 3/9] Change jit.c " Tom Tromey
2019-07-10 17:02 ` Simon Marchi
2019-07-10 18:44 ` Tom Tromey
2019-07-10 15:39 ` [PATCH 8/9] Change solib-spu.c " Tom Tromey
2019-07-10 15:39 ` Tom Tromey [this message]
2019-07-10 15:39 ` [PATCH 2/9] Change solib-darwin.c " Tom Tromey
2019-07-10 15:39 ` [PATCH 7/9] Change solib-aix.c " Tom Tromey
2019-07-10 18:55 ` Simon Marchi
2019-07-10 20:34 ` Tom Tromey
2019-07-10 20:38 ` Simon Marchi
2019-07-10 15:49 ` [PATCH 9/9] Change arm-tdep.c " Tom Tromey
2019-07-10 15:49 ` [PATCH 4/9] Change dbxread.c " Tom Tromey
2019-07-10 19:03 ` [PATCH 0/9] Use the type-safe registry in more cases Simon Marchi
2019-07-10 20:34 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190710153947.25721-7-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox