public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Add constructor to solib_catchpoint
Date: Fri, 6 May 2022 18:10:52 +0000 (GMT) [thread overview]
Message-ID: <20220506181052.0100B3857373@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4874f776caf053b708d7f76d6b72a8846f2ca219
commit 4874f776caf053b708d7f76d6b72a8846f2ca219
Author: Tom Tromey <tom@tromey.com>
Date: Sat Apr 30 14:19:44 2022 -0600
Add constructor to solib_catchpoint
This adds a constructor to solib_catchpoint and simplifies the caller.
Diff:
---
gdb/break-catch-load.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c
index 99aa185ad85..3e3bed2f861 100644
--- a/gdb/break-catch-load.c
+++ b/gdb/break-catch-load.c
@@ -35,6 +35,15 @@
struct solib_catchpoint : public breakpoint
{
+ solib_catchpoint (bool is_load_, const char *arg)
+ : is_load (is_load_),
+ regex (arg == nullptr ? nullptr : make_unique_xstrdup (arg)),
+ compiled (arg == nullptr
+ ? nullptr
+ : new compiled_regex (arg, REG_NOSUB, _("Invalid regexp")))
+ {
+ }
+
int insert_location (struct bp_location *) override;
int remove_location (struct bp_location *,
enum remove_bp_reason reason) override;
@@ -216,17 +225,11 @@ add_solib_catchpoint (const char *arg, bool is_load, bool is_temp, bool enabled)
if (!arg)
arg = "";
arg = skip_spaces (arg);
+ if (*arg == '\0')
+ arg = nullptr;
- std::unique_ptr<solib_catchpoint> c (new solib_catchpoint ());
-
- if (*arg != '\0')
- {
- c->compiled.reset (new compiled_regex (arg, REG_NOSUB,
- _("Invalid regexp")));
- c->regex = make_unique_xstrdup (arg);
- }
+ std::unique_ptr<solib_catchpoint> c (new solib_catchpoint (is_load, arg));
- c->is_load = is_load;
init_catchpoint (c.get (), gdbarch, is_temp, NULL);
c->enable_state = enabled ? bp_enabled : bp_disabled;
reply other threads:[~2022-05-06 18:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220506181052.0100B3857373@sourceware.org \
--to=tromey@sourceware.org \
--cc=gdb-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).