public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Convert breakpoint.c to type-safe registry API
@ 2019-05-08 22:08 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-05-08 22:08 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=51d3063a35fad1fa0cd53c167bb5a4325afeea16
commit 51d3063a35fad1fa0cd53c167bb5a4325afeea16
Author: Tom Tromey <tom@tromey.com>
Date: Sun Apr 21 12:45:00 2019 -0600
Convert breakpoint.c to type-safe registry API
This changes breakpoint.c to use the type-safe registry API.
gdb/ChangeLog
2019-05-08 Tom Tromey <tom@tromey.com>
* breakpoint.c (breakpoint_objfile_key): Change type.
(get_breakpoint_objfile_data): Update.
(free_breakpoint_objfile_data): Remove.
(_initialize_breakpoint): Update.
Diff:
---
gdb/ChangeLog | 7 +++++++
gdb/breakpoint.c | 23 ++++-------------------
2 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 708b736..05a06ec 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2019-05-08 Tom Tromey <tom@tromey.com>
+ * breakpoint.c (breakpoint_objfile_key): Change type.
+ (get_breakpoint_objfile_data): Update.
+ (free_breakpoint_objfile_data): Remove.
+ (_initialize_breakpoint): Update.
+
+2019-05-08 Tom Tromey <tom@tromey.com>
+
* linux-tdep.c (struct linux_info): Add initializers.
(linux_inferior_data): Move. Change type.
(invalidate_linux_cache_inf): Update.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index f6d2f36..35da97b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3156,7 +3156,8 @@ struct breakpoint_objfile_data
std::vector<probe *> exception_probes;
};
-static const struct objfile_data *breakpoint_objfile_key;
+static const struct objfile_key<breakpoint_objfile_data>
+ breakpoint_objfile_key;
/* Minimal symbol not found sentinel. */
static struct minimal_symbol msym_not_found;
@@ -3177,26 +3178,13 @@ get_breakpoint_objfile_data (struct objfile *objfile)
{
struct breakpoint_objfile_data *bp_objfile_data;
- bp_objfile_data = ((struct breakpoint_objfile_data *)
- objfile_data (objfile, breakpoint_objfile_key));
+ bp_objfile_data = breakpoint_objfile_key.get (objfile);
if (bp_objfile_data == NULL)
- {
- bp_objfile_data = new breakpoint_objfile_data ();
- set_objfile_data (objfile, breakpoint_objfile_key, bp_objfile_data);
- }
+ bp_objfile_data = breakpoint_objfile_key.emplace (objfile);
return bp_objfile_data;
}
static void
-free_breakpoint_objfile_data (struct objfile *obj, void *data)
-{
- struct breakpoint_objfile_data *bp_objfile_data
- = (struct breakpoint_objfile_data *) data;
-
- delete bp_objfile_data;
-}
-
-static void
create_overlay_event_breakpoint (void)
{
const char *const func_name = "_ovly_debug_event";
@@ -15448,9 +15436,6 @@ _initialize_breakpoint (void)
gdb::observers::free_objfile.attach (disable_breakpoints_in_freed_objfile);
gdb::observers::memory_changed.attach (invalidate_bp_value_on_memory_change);
- breakpoint_objfile_key
- = register_objfile_data_with_cleanup (NULL, free_breakpoint_objfile_data);
-
breakpoint_chain = 0;
/* Don't bother to call set_breakpoint_count. $bpnum isn't useful
before a breakpoint is set. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-08 22:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 22:08 [binutils-gdb] Convert breakpoint.c to type-safe registry API Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).