From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 8/9] Change solib-spu.c to use type-safe registry
Date: Wed, 10 Jul 2019 15:39:00 -0000 [thread overview]
Message-ID: <20190710153947.25721-9-tromey@adacore.com> (raw)
In-Reply-To: <20190710153947.25721-1-tromey@adacore.com>
This changes solib-spu.c to use the type-safe registry.
gdb/ChangeLog
2019-07-10 Tom Tromey <tromey@adacore.com>
* solib-spu.c (ocl_program_data_key): Change type.
(append_ocl_sos, ocl_enable_break, _initialize_spu_solib):
Update.
---
gdb/ChangeLog | 6 ++++++
gdb/solib-spu.c | 12 +++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index c5dc8639f1e..448e1a64f4c 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -94,7 +94,8 @@ spu_skip_standalone_loader (void)
}
}
-static const struct objfile_data *ocl_program_data_key;
+static objfile_key<CORE_ADDR, gdb::noop_deleter<CORE_ADDR>>
+ ocl_program_data_key;
/* Appends OpenCL programs to the list of `struct so_list' objects. */
static void
@@ -104,8 +105,7 @@ append_ocl_sos (struct so_list **link_ptr)
for (objfile *objfile : current_program_space->objfiles ())
{
- ocl_program_addr_base
- = (CORE_ADDR *) objfile_data (objfile, ocl_program_data_key);
+ ocl_program_addr_base = ocl_program_data_key.get (objfile);
if (ocl_program_addr_base != NULL)
{
enum bfd_endian byte_order = bfd_big_endian (objfile->obfd)?
@@ -448,15 +448,14 @@ ocl_enable_break (struct objfile *objfile)
/* Store the address of the symbol that will point to OpenCL program
using the per-objfile private data mechanism. */
- if (objfile_data (objfile, ocl_program_data_key) == NULL)
+ if (ocl_program_data_key.get (objfile) == NULL)
{
CORE_ADDR *ocl_program_addr_base = OBSTACK_CALLOC (
&objfile->objfile_obstack,
objfile->sections_end - objfile->sections,
CORE_ADDR);
*ocl_program_addr_base = BMSYMBOL_VALUE_ADDRESS (addr_sym);
- set_objfile_data (objfile, ocl_program_data_key,
- ocl_program_addr_base);
+ ocl_program_data_key.set (objfile, ocl_program_addr_base);
}
}
}
@@ -544,6 +543,5 @@ void
_initialize_spu_solib (void)
{
gdb::observers::solib_loaded.attach (spu_solib_loaded);
- ocl_program_data_key = register_objfile_data ();
}
--
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 7/9] Change solib-aix.c to use type-safe registry 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:39 ` [PATCH 2/9] Change solib-darwin.c " Tom Tromey
2019-07-10 15:39 ` [PATCH 6/9] Change solib-dsbt.c " Tom Tromey
2019-07-10 15:39 ` Tom Tromey [this message]
2019-07-10 15:39 ` [PATCH 1/9] Change remote-sim.c " 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:49 ` [PATCH 4/9] Change dbxread.c " Tom Tromey
2019-07-10 15:49 ` [PATCH 9/9] Change arm-tdep.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-9-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