public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: add gdbarch_up
@ 2023-02-02 15:08 Simon Marchi
0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2023-02-02 15:08 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d246d904adf3e338c731c123219a8246281002e2
commit d246d904adf3e338c731c123219a8246281002e2
Author: Simon Marchi <simon.marchi@efficios.com>
Date: Mon Oct 3 12:56:30 2022 -0400
gdb: add gdbarch_up
Add a gdbarch_up unique pointer type, that calls gdbarch_free on
deletion. This is used in the ROCm support patch at the end of this
series.
Change-Id: I4b808892d35d69a590ce83180f41afd91705b2c8
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diff:
---
gdb/gdbarch.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f4efd8c0bc7..f0399c2fa88 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -306,6 +306,14 @@ extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info,
extern void gdbarch_free (struct gdbarch *);
+struct gdbarch_deleter
+{
+ void operator() (gdbarch *arch) const
+ { gdbarch_free (arch); }
+};
+
+using gdbarch_up = std::unique_ptr<gdbarch, gdbarch_deleter>;
+
/* Get the obstack owned by ARCH. */
extern obstack *gdbarch_obstack (gdbarch *arch);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-02 15:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 15:08 [binutils-gdb] gdb: add gdbarch_up Simon Marchi
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).