From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/9] Change mi_parse_argv to a method
Date: Tue, 04 Apr 2023 11:08:52 -0600 [thread overview]
Message-ID: <20230404-dap-loaded-sources-v1-4-75c796bd644b@adacore.com> (raw)
In-Reply-To: <20230404-dap-loaded-sources-v1-0-75c796bd644b@adacore.com>
This changes mi_parse_argv to be a method of mi_parse. This is just a
minor cleanup.
---
gdb/mi/mi-cmds.c | 2 +-
gdb/mi/mi-parse.c | 8 ++++----
gdb/mi/mi-parse.h | 7 +++----
gdb/python/py-micmd.c | 2 +-
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index ca8c633e218..f8cae4131d8 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -49,7 +49,7 @@ struct mi_command_mi : public mi_command
with arguments contained within PARSE. */
void invoke (struct mi_parse *parse) const override
{
- mi_parse_argv (parse->args (), parse);
+ parse->parse_argv ();
if (parse->argv == nullptr)
error (_("Problem parsing arguments: %s %s"), parse->command,
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index 41399fc619e..db3c4ae2368 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -107,9 +107,9 @@ mi_parse_escape (const char **string_ptr)
}
void
-mi_parse_argv (const char *args, struct mi_parse *parse)
+mi_parse::parse_argv ()
{
- const char *chp = args;
+ const char *chp = m_args.get ();
int argc = 0;
char **argv = XNEWVEC (char *, argc + 1);
@@ -124,8 +124,8 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
switch (*chp)
{
case '\0':
- parse->argv = argv;
- parse->argc = argc;
+ this->argv = argv;
+ this->argc = argc;
return;
case '"':
{
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index d4ac3f002e4..edb61547354 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -46,6 +46,9 @@ struct mi_parse
DISABLE_COPY_AND_ASSIGN (mi_parse);
+ /* Split the arguments into argc/argv and store the result. */
+ void parse_argv ();
+
/* Return the full argument string, as used by commands which are
implemented as CLI commands. */
const char *args () const
@@ -90,8 +93,4 @@ extern std::unique_ptr<struct mi_parse> mi_parse (const char *cmd,
enum print_values mi_parse_print_values (const char *name);
-/* Split ARGS into argc/argv and store the result in PARSE. */
-
-extern void mi_parse_argv (const char *args, struct mi_parse *parse);
-
#endif /* MI_MI_PARSE_H */
diff --git a/gdb/python/py-micmd.c b/gdb/python/py-micmd.c
index af89be693da..3c2555c7665 100644
--- a/gdb/python/py-micmd.c
+++ b/gdb/python/py-micmd.c
@@ -355,7 +355,7 @@ mi_command_py::invoke (struct mi_parse *parse) const
pymicmd_debug_printf ("this = %p, name = %s", this, name ());
- mi_parse_argv (parse->args (), parse);
+ parse->parse_argv ();
if (parse->argv == nullptr)
error (_("Problem parsing arguments: %s %s"), parse->command,
--
2.39.1
next prev parent reply other threads:[~2023-04-04 17:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 17:08 [PATCH 0/9] Implement the DAP "loadedSources" request Tom Tromey
2023-04-04 17:08 ` [PATCH 1/9] Use field_signed from Python MI commands Tom Tromey
2023-04-04 17:08 ` [PATCH 2/9] Use member initializers in mi_parse Tom Tromey
2023-04-04 17:08 ` [PATCH 3/9] Use accessor for mi_parse::args Tom Tromey
2023-04-04 17:08 ` Tom Tromey [this message]
2023-04-04 17:08 ` [PATCH 5/9] Introduce "static constructor" for mi_parse Tom Tromey
2023-04-04 17:08 ` [PATCH 6/9] Introduce mi_parse helper methods Tom Tromey
2023-04-04 17:08 ` [PATCH 7/9] Add second mi_parse constructor Tom Tromey
2023-04-04 17:08 ` [PATCH 8/9] Implement gdb.execute_mi Tom Tromey
2023-04-04 19:08 ` Eli Zaretskii
2023-05-18 17:57 ` Tom Tromey
2023-05-18 18:31 ` Eli Zaretskii
2023-05-18 20:15 ` Tom Tromey
2023-05-18 20:34 ` Matt Rice
2023-05-19 15:57 ` Tom Tromey
2023-04-04 17:08 ` [PATCH 9/9] Implement DAP loadedSources request Tom Tromey
2023-04-10 23:43 ` [PATCH 0/9] Implement the DAP "loadedSources" request Matt Rice
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=20230404-dap-loaded-sources-v1-4-75c796bd644b@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).