From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/3] More cleanup elimination / gdb::unique_ptr
Date: Mon, 10 Oct 2016 16:46:00 -0000 [thread overview]
Message-ID: <1476117992-5689-1-git-send-email-palves@redhat.com> (raw)
This patch series aims at removing more cleanups.
It eliminates ~90 out of the ~1800 make_cleanup calls left in the
tree.
It also tries to answer the "which smart pointer?" question. Many
make_cleanup uses in the code base are best eliminated by using a
"owning" smart pointer to manage ownership of the resource
automatically.
We don't require C++11 yet, but OTOH, std::unique_ptr is quite nice.
C++03 has std::auto_ptr, but, that's best avoided. I'd also like to
have a smart pointer that manages malloc'ed objects, so std::auto_ptr
alone won't cut it.
The solution proposed by this series is a new gdb::unique_ptr smart
pointer that is mapped to std::unique_ptr when compiling with a C++11
compiler (really, just a template alias), and is a simple
std::unique_ptr emulation when compiled with a C++03 compiler.
The patch series first adds the smart pointer to the tree, and then
follows up with examples of C++fycation that use it, and more.
Series tested on:
- NetBSD 5.1 (gcc70 on the compile farm), w/ gcc 4.1.3
- x86-64 Fedora 23, gcc 5.3.1 (gnu++03) native/gdbserver
- x86-64 Fedora 23, and gcc 7.0 (gnu++14)
Note that while the series' diffstat is practically a wash
linecount-wise:
87 files changed, 1450 insertions(+), 1429 deletions(-)
if we don't count the first patch, i.e., the new smart pointer, then
we get:
84 files changed, 1017 insertions(+), 1429 deletions(-)
So while there's a lot of churn, there's a significant drop in number
of lines of code.
Pedro Alves (3):
Introduce gdb::unique_ptr
ui_file_xstrdup -> std::string
'struct parse_expression *' -> gdb::unique_ptr<expression>
gdb/ada-lang.c | 83 +++------
gdb/ada-lang.h | 2 +-
gdb/ada-valprint.c | 53 +++---
gdb/ada-varobj.c | 130 ++++++--------
gdb/arm-tdep.c | 6 +-
gdb/ax-gdb.c | 15 +-
gdb/break-catch-sig.c | 2 +-
gdb/break-catch-syscall.c | 2 +-
gdb/break-catch-throw.c | 26 +--
gdb/breakpoint.c | 144 +++++++---------
gdb/breakpoint.h | 8 +-
gdb/c-exp.y | 9 +-
gdb/c-lang.c | 9 +-
gdb/c-lang.h | 7 +-
gdb/c-typeprint.c | 5 +-
gdb/c-varobj.c | 142 ++++++++--------
gdb/cli/cli-script.c | 130 +++++---------
gdb/cli/cli-setshow.c | 7 +-
gdb/common/common-defs.h | 3 +
gdb/common/common-utils.c | 31 ++++
gdb/common/common-utils.h | 6 +
gdb/common/gdb_unique_ptr.h | 363 ++++++++++++++++++++++++++++++++++++++++
gdb/common/safe-bool.h | 67 ++++++++
gdb/compile/compile-c-support.c | 6 +-
gdb/compile/compile.c | 70 ++++----
gdb/cp-abi.c | 2 +-
gdb/cp-abi.h | 7 +-
gdb/cp-support.c | 60 +++----
gdb/cp-support.h | 10 +-
gdb/dbxread.c | 22 +--
gdb/dtrace-probe.c | 6 +-
gdb/dwarf2read.c | 25 ++-
gdb/eval.c | 43 ++---
gdb/expression.h | 12 +-
gdb/gdbarch.c | 8 +-
gdb/gdbarch.sh | 8 +-
gdb/gdbcmd.h | 2 +-
gdb/gdbtypes.c | 12 +-
gdb/gnu-v3-abi.c | 55 ++----
gdb/guile/guile.c | 18 +-
gdb/guile/scm-breakpoint.c | 6 +-
gdb/guile/scm-disasm.c | 6 +-
gdb/guile/scm-frame.c | 6 +-
gdb/guile/scm-type.c | 27 ++-
gdb/guile/scm-value.c | 18 +-
gdb/infcmd.c | 9 +-
gdb/infrun.c | 6 +-
gdb/language.c | 7 +-
gdb/language.h | 14 +-
gdb/linespec.c | 53 +++---
gdb/location.c | 11 +-
gdb/location.h | 6 -
gdb/mi/mi-cmd-var.c | 70 +++-----
gdb/mi/mi-main.c | 41 ++---
gdb/minsyms.c | 17 +-
gdb/objc-lang.c | 7 +-
gdb/parse.c | 50 +++---
gdb/printcmd.c | 65 +++----
gdb/python/py-arch.c | 10 +-
gdb/python/py-breakpoint.c | 8 +-
gdb/python/py-frame.c | 8 +-
gdb/python/py-type.c | 10 +-
gdb/python/py-unwind.c | 7 +-
gdb/python/py-value.c | 7 +-
gdb/python/py-varobj.c | 4 +-
gdb/python/python.c | 19 +--
gdb/remote.c | 56 ++-----
gdb/rust-exp.y | 11 +-
gdb/rust-lang.c | 50 ++----
gdb/stabsread.c | 21 ++-
gdb/stack.c | 6 +-
gdb/symtab.c | 61 +++----
gdb/symtab.h | 19 ++-
gdb/top.c | 13 +-
gdb/tracepoint.c | 143 +++++-----------
gdb/tracepoint.h | 18 +-
gdb/typeprint.c | 21 +--
gdb/ui-file.c | 24 ++-
gdb/ui-file.h | 9 +-
gdb/ui-out.c | 9 +-
gdb/utils.c | 5 +-
gdb/value.c | 8 +-
gdb/value.h | 2 +-
gdb/varobj-iter.h | 4 +-
gdb/varobj.c | 216 +++++++++++-------------
gdb/varobj.h | 66 ++++----
gdb/xtensa-tdep.c | 9 +-
87 files changed, 1450 insertions(+), 1429 deletions(-)
create mode 100644 gdb/common/gdb_unique_ptr.h
create mode 100644 gdb/common/safe-bool.h
--
2.5.5
next reply other threads:[~2016-10-10 16:46 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-10 16:46 Pedro Alves [this message]
2016-10-10 16:46 ` [PATCH 1/3] Introduce gdb::unique_ptr Pedro Alves
2016-10-10 17:49 ` Simon Marchi
2016-10-10 18:03 ` Pedro Alves
2016-10-11 6:48 ` Metzger, Markus T
2016-10-11 10:23 ` Pedro Alves
2016-10-11 10:53 ` Andreas Schwab
2016-10-11 11:17 ` Metzger, Markus T
2016-10-11 11:43 ` Pedro Alves
2016-10-11 13:58 ` Yao Qi
2016-10-11 14:05 ` Trevor Saunders
2016-10-11 12:16 ` Joel Brobecker
2016-10-11 13:46 ` Pedro Alves
2016-10-11 14:47 ` Joel Brobecker
2016-10-11 15:17 ` Eli Zaretskii
2016-10-11 16:24 ` Pedro Alves
2016-10-11 16:58 ` Eli Zaretskii
2016-10-11 17:41 ` Pedro Alves
2016-10-11 18:37 ` Eli Zaretskii
2016-10-11 19:19 ` Pedro Alves
2016-10-11 20:47 ` Eli Zaretskii
2016-10-11 21:32 ` Pedro Alves
2016-10-12 6:34 ` Eli Zaretskii
2016-10-12 8:11 ` Metzger, Markus T
2016-10-12 9:31 ` Eli Zaretskii
2016-10-12 10:12 ` Pedro Alves
2016-10-12 11:05 ` Eli Zaretskii
2016-10-12 11:25 ` Pedro Alves
2016-10-12 11:45 ` Eli Zaretskii
2016-10-13 12:12 ` Pedro Alves
2016-10-12 10:28 ` Pedro Alves
2016-10-12 11:07 ` Eli Zaretskii
2016-10-12 11:19 ` Pedro Alves
2016-10-12 11:41 ` Eli Zaretskii
2016-10-12 11:55 ` Pedro Alves
2016-10-13 0:38 ` [PATCH] Enable C++11 starting with gcc 4.8 (was: Re: [PATCH 1/3] Introduce gdb::unique_ptr) Pedro Alves
2016-10-13 0:45 ` [PATCH 2/2] gdb: Enable C++11 if available Pedro Alves
2016-10-13 0:45 ` [PATCH 1/2] gdb: Import AX_CXX_COMPILE_STDCXX from the GNU Autoconf Archive Pedro Alves
2016-10-12 9:37 ` [PATCH 1/3] Introduce gdb::unique_ptr Pedro Alves
2016-10-12 10:51 ` Eli Zaretskii
2016-10-12 11:15 ` Pedro Alves
2016-10-12 11:40 ` Eli Zaretskii
2016-10-12 11:45 ` Jan Kratochvil
2016-10-12 11:56 ` Luis Machado
2016-10-12 12:03 ` Eli Zaretskii
2016-10-13 9:07 ` Jan Kratochvil
2016-10-13 10:07 ` Eli Zaretskii
2016-10-13 10:27 ` Pedro Alves
2016-10-13 13:22 ` Eli Zaretskii
2016-10-13 13:36 ` Pedro Alves
2016-10-13 13:59 ` Eli Zaretskii
2016-10-13 14:04 ` Pedro Alves
2016-10-13 15:06 ` Joel Brobecker
2016-10-13 10:46 ` Jan Kratochvil
2016-10-13 11:15 ` Pedro Alves
2016-10-13 13:28 ` Eli Zaretskii
2016-10-13 13:42 ` Pedro Alves
2016-10-13 14:07 ` Eli Zaretskii
2016-10-11 19:23 ` Simon Marchi
2016-10-11 20:54 ` Eli Zaretskii
2016-10-11 21:28 ` Simon Marchi
2016-10-12 6:23 ` Eli Zaretskii
2016-10-11 21:16 ` Jan Kratochvil
2016-10-11 17:15 ` Luis Machado
2016-10-11 18:21 ` Pedro Alves
2016-10-10 16:46 ` [PATCH 3/3] 'struct parse_expression *' -> gdb::unique_ptr<expression> Pedro Alves
2016-10-10 16:58 ` [PATCH 0/3] More cleanup elimination / gdb::unique_ptr Pedro Alves
2016-10-16 7:05 ` Tom Tromey
2016-10-17 13:57 ` Pedro Alves
2016-10-17 14:07 ` Tom Tromey
2016-10-17 14:59 ` Pedro Alves
2016-10-20 13:46 ` Pedro Alves
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=1476117992-5689-1-git-send-email-palves@redhat.com \
--to=palves@redhat.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