public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Convert break-catch-syscall.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=6ae614f66a0a86c9e83b9f40ee1f4e105b681f7b
commit 6ae614f66a0a86c9e83b9f40ee1f4e105b681f7b
Author: Tom Tromey <tom@tromey.com>
Date: Sun Apr 21 09:25:07 2019 -0600
Convert break-catch-syscall.c to type-safe registry API
This changes break-catch-syscall.c to use the type-safe registry API.
gdb/ChangeLog
2019-05-08 Tom Tromey <tom@tromey.com>
* break-catch-syscall.c (catch_syscall_inferior_data): Move.
Change type.
(get_catch_syscall_inferior_data): Update.
(catch_syscall_inferior_data_cleanup): Remove.
(_initialize_break_catch_syscall): Update.
Diff:
---
gdb/ChangeLog | 8 ++++++++
gdb/break-catch-syscall.c | 25 +++++--------------------
2 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e461a06..0c5fe7c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2019-05-08 Tom Tromey <tom@tromey.com>
+ * break-catch-syscall.c (catch_syscall_inferior_data): Move.
+ Change type.
+ (get_catch_syscall_inferior_data): Update.
+ (catch_syscall_inferior_data_cleanup): Remove.
+ (_initialize_break_catch_syscall): Update.
+
+2019-05-08 Tom Tromey <tom@tromey.com>
+
* inflow.c (struct terminal_info): Add destructor and
initializers.
(inflow_inferior_data): Change type.
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 6a911fb..cd4870f 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -42,8 +42,6 @@ struct syscall_catchpoint : public breakpoint
std::vector<int> syscalls_to_be_caught;
};
-static const struct inferior_data *catch_syscall_inferior_data = NULL;
-
struct catch_syscall_inferior_data
{
/* We keep a count of the number of times the user has requested a
@@ -61,31 +59,21 @@ struct catch_syscall_inferior_data
int total_syscalls_count;
};
+static const struct inferior_key<struct catch_syscall_inferior_data>
+ catch_syscall_inferior_data;
+
static struct catch_syscall_inferior_data *
get_catch_syscall_inferior_data (struct inferior *inf)
{
struct catch_syscall_inferior_data *inf_data;
- inf_data = ((struct catch_syscall_inferior_data *)
- inferior_data (inf, catch_syscall_inferior_data));
+ inf_data = catch_syscall_inferior_data.get (inf);
if (inf_data == NULL)
- {
- inf_data = new struct catch_syscall_inferior_data ();
- set_inferior_data (inf, catch_syscall_inferior_data, inf_data);
- }
+ inf_data = catch_syscall_inferior_data.emplace (inf);
return inf_data;
}
-static void
-catch_syscall_inferior_data_cleanup (struct inferior *inf, void *arg)
-{
- struct catch_syscall_inferior_data *inf_data
- = (struct catch_syscall_inferior_data *) arg;
- delete inf_data;
-}
-
-
/* Implement the "insert" breakpoint_ops method for syscall
catchpoints. */
@@ -617,9 +605,6 @@ _initialize_break_catch_syscall (void)
initialize_syscall_catchpoint_ops ();
gdb::observers::inferior_exit.attach (clear_syscall_counts);
- catch_syscall_inferior_data
- = register_inferior_data_with_cleanup (NULL,
- catch_syscall_inferior_data_cleanup);
add_catch_command ("syscall", _("\
Catch system calls by their names, groups and/or numbers.\n\
^ 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 break-catch-syscall.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).