From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 04/25] Transfer ownership of exception string to ada_catchpoint
Date: Wed, 24 May 2023 10:36:55 -0600 [thread overview]
Message-ID: <20230427-ada-catch-exception-v1-4-947caa9905e3@adacore.com> (raw)
In-Reply-To: <20230427-ada-catch-exception-v1-0-947caa9905e3@adacore.com>
This changes the ada_catchpoint to require an rvalue ref, so that
ownership of the exception string can be transferred to the catchpoint
object.
---
gdb/ada-lang.c | 16 +++++++++-------
gdb/ada-lang.h | 2 +-
gdb/mi/mi-cmd-catch.c | 4 ++--
3 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 50eea4860ba..374cec57090 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12139,8 +12139,10 @@ struct ada_catchpoint : public code_breakpoint
const char *addr_string_,
bool tempflag,
bool enabled,
- bool from_tty)
+ bool from_tty,
+ std::string &&excep_string_)
: code_breakpoint (gdbarch_, bp_catchpoint, tempflag),
+ excep_string (std::move (excep_string_)),
m_kind (kind)
{
add_location (sal);
@@ -12807,7 +12809,7 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex,
void
create_ada_exception_catchpoint (struct gdbarch *gdbarch,
enum ada_exception_catchpoint_kind ex_kind,
- const std::string &excep_string,
+ std::string &&excep_string,
const std::string &cond_string,
int tempflag,
int enabled,
@@ -12818,8 +12820,8 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
std::unique_ptr<ada_catchpoint> c
(new ada_catchpoint (gdbarch, ex_kind, sal, addr_string.c_str (),
- tempflag, enabled, from_tty));
- c->excep_string = excep_string;
+ tempflag, enabled, from_tty,
+ std::move (excep_string)));
create_excep_cond_exprs (c.get (), ex_kind);
if (!cond_string.empty ())
set_breakpoint_condition (c.get (), cond_string.c_str (), from_tty, false);
@@ -12846,7 +12848,7 @@ catch_ada_exception_command (const char *arg_entry, int from_tty,
catch_ada_exception_command_split (arg, false, &ex_kind, &excep_string,
&cond_string);
create_ada_exception_catchpoint (gdbarch, ex_kind,
- excep_string, cond_string,
+ std::move (excep_string), cond_string,
tempflag, 1 /* enabled */,
from_tty);
}
@@ -12871,7 +12873,7 @@ catch_ada_handlers_command (const char *arg_entry, int from_tty,
catch_ada_exception_command_split (arg, true, &ex_kind, &excep_string,
&cond_string);
create_ada_exception_catchpoint (gdbarch, ex_kind,
- excep_string, cond_string,
+ std::move (excep_string), cond_string,
tempflag, 1 /* enabled */,
from_tty);
}
@@ -12938,7 +12940,7 @@ catch_assert_command (const char *arg_entry, int from_tty,
arg = "";
catch_ada_assert_command_split (arg, cond_string);
create_ada_exception_catchpoint (gdbarch, ada_catch_assert,
- "", cond_string,
+ {}, cond_string,
tempflag, 1 /* enabled */,
from_tty);
}
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index f5bb54c7d36..08620d7ed7c 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -341,7 +341,7 @@ extern const char *ada_main_name ();
extern void create_ada_exception_catchpoint
(struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind,
- const std::string &excep_string, const std::string &cond_string, int tempflag,
+ std::string &&excep_string, const std::string &cond_string, int tempflag,
int enabled, int from_tty);
/* Return true if BP is an Ada catchpoint. */
diff --git a/gdb/mi/mi-cmd-catch.c b/gdb/mi/mi-cmd-catch.c
index 082703740af..dcd48a84a5d 100644
--- a/gdb/mi/mi-cmd-catch.c
+++ b/gdb/mi/mi-cmd-catch.c
@@ -153,7 +153,7 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
create_ada_exception_catchpoint (gdbarch, ex_kind,
- exception_name,
+ std::move (exception_name),
condition, temp, enabled, 0);
}
@@ -217,7 +217,7 @@ mi_cmd_catch_handlers (const char *cmd, char *argv[], int argc)
scoped_restore restore_breakpoint_reporting
= setup_breakpoint_reporting ();
create_ada_exception_catchpoint (gdbarch, ada_catch_handlers,
- exception_name,
+ std::move (exception_name),
condition, temp, enabled, 0);
}
--
2.40.0
next prev parent reply other threads:[~2023-05-24 16:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 16:36 [PATCH 00/25] Many updates to DAP implementation Tom Tromey
2023-05-24 16:36 ` [PATCH 01/25] Stop gdb in gnat_runtime_has_debug_info Tom Tromey
2023-05-24 16:36 ` [PATCH 02/25] Use gnat_runtime_has_debug_info in Ada catchpoint tests Tom Tromey
2023-06-13 20:10 ` Tom de Vries
2023-06-19 9:49 ` Tom de Vries
2023-06-20 13:56 ` Tom Tromey
2023-05-24 16:36 ` [PATCH 03/25] Pass tempflag to ada_catchpoint constructor Tom Tromey
2023-05-24 16:36 ` Tom Tromey [this message]
2023-05-24 16:36 ` [PATCH 05/25] Combine create_excep_cond_exprs and ada_catchpoint::re_set Tom Tromey
2023-05-24 16:36 ` [PATCH 06/25] Turn should_stop_exception into a method of ada_catchpoint Tom Tromey
2023-05-24 16:36 ` [PATCH 07/25] Mark members of ada_catchpoint "private" Tom Tromey
2023-05-24 16:36 ` [PATCH 08/25] Don't require inferior execution for Ada catchpoints Tom Tromey
2023-05-24 16:37 ` [PATCH 09/25] Implement DAP setExceptionBreakpoints request Tom Tromey
2023-05-24 16:37 ` [PATCH 10/25] Implement DAP attach request Tom Tromey
2023-05-24 16:53 ` Eli Zaretskii
2023-05-24 16:37 ` [PATCH 11/25] Implement DAP stepOut request Tom Tromey
2023-05-24 16:37 ` [PATCH 12/25] Add singleThread support to some DAP requests Tom Tromey
2023-05-24 16:37 ` [PATCH 13/25] Rename one DAP function Tom Tromey
2023-05-24 16:37 ` [PATCH 14/25] Add test for DAP pause request Tom Tromey
2023-05-24 16:37 ` [PATCH 15/25] Fix a latent bug in DAP request decorator Tom Tromey
2023-05-24 16:37 ` [PATCH 16/25] Use tuples for default arguments in DAP Tom Tromey
2023-05-24 16:37 ` [PATCH 17/25] Add type-checking to DAP requests Tom Tromey
2023-05-24 16:37 ` [PATCH 18/25] Add gdb.Value.assign method Tom Tromey
2023-05-24 16:54 ` Eli Zaretskii
2023-05-24 16:37 ` [PATCH 19/25] Implement DAP setExpression request Tom Tromey
2023-05-24 16:37 ` [PATCH 20/25] Handle DAP supportsVariableType capability Tom Tromey
2023-05-24 16:37 ` [PATCH 21/25] Add "target" parameter to DAP attach request Tom Tromey
2023-05-24 16:55 ` Eli Zaretskii
2023-05-24 16:37 ` [PATCH 22/25] Add "stop at main" extension to DAP launch request Tom Tromey
2023-05-24 16:56 ` Eli Zaretskii
2023-05-24 16:37 ` [PATCH 23/25] Implement DAP breakpointLocations request Tom Tromey
2023-05-24 16:37 ` [PATCH 24/25] Do not report totalFrames from DAP stackTrace request Tom Tromey
2023-05-24 16:37 ` [PATCH 25/25] Implement DAP conditional breakpoints Tom Tromey
2023-06-12 18:11 ` [PATCH 00/25] Many updates to DAP implementation Tom Tromey
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=20230427-ada-catch-exception-v1-4-947caa9905e3@adacore.com \
--to=tromey@adacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).