From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>,
Simon Marchi <simon.marchi@polymtl.ca>
Cc: GDB Patches <gdb-patches@sourceware.org>,
Jerome Guitton <guitton@adacore.com>
Subject: Re: [PATCH] PR cli/21688: Fix multi-line/inline command differentiation
Date: Fri, 30 Jun 2017 11:14:00 -0000 [thread overview]
Message-ID: <6c2f659c-fba1-dcdf-becd-0e05d3d08636@redhat.com> (raw)
In-Reply-To: <87fueil9jx.fsf@redhat.com>
On 06/29/2017 11:21 PM, Sergio Durigan Junior wrote:
> +/* Return true if NAME is the only command between COMMAND_START and
> + COMMAND_END. This is useful when we want to know whether the
> + command is inline (i.e., has arguments like 'python command1') or
> + is the start of a multi-line command block. */
> +
> +static bool
> +command_name_equals_not_inline (const char *command_start,
> + const char *command_end,
> + const char *name)
> +{
> + return (command_end - command_start == strlen (name)
> + && startswith (command_start, name));
> +}
...
> - else if (command_name_equals (cmd, "python"))
> + else if (command_name_equals_not_inline (p_start, p_end, "python"))
> {
Does this handle command aliases? It doesn't look like it.
> + set define_cmd_inline {
> + { "if 1" " >$" "inline if 1" }
> + { "python print ('hello')" " >$" "inline python command" }
For example, what if you write instead:
{ "py print ('hello')" " >$" "inline python command" }
and/or you do:
(gdb) alias foo=python
and then:
{ "foo print ('hello')" " >$" "inline python command" }
Thanks,
Pedro Alves
next prev parent reply other threads:[~2017-06-30 11:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 2:05 Sergio Durigan Junior
2017-06-29 12:51 ` Jerome Guitton
2017-06-29 19:08 ` Simon Marchi
2017-06-29 19:48 ` Sergio Durigan Junior
2017-06-29 21:06 ` Simon Marchi
2017-06-29 22:21 ` Sergio Durigan Junior
2017-06-30 7:01 ` Simon Marchi
2017-06-30 11:16 ` Sergio Durigan Junior
2017-06-30 11:14 ` Pedro Alves [this message]
2017-06-30 11:24 ` Sergio Durigan Junior
2017-06-30 11:30 ` Pedro Alves
2017-06-30 12:33 ` Sergio Durigan Junior
2017-06-30 12:34 ` [PATCH] PR cli/21688: Detect aliases when issuing python/compile/guile commands (and fix last commit) Sergio Durigan Junior
2017-06-30 13:02 ` Pedro Alves
2017-06-30 13:33 ` Sergio Durigan Junior
2017-06-30 13:49 ` Pedro Alves
2017-06-30 13:51 ` Sergio Durigan Junior
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=6c2f659c-fba1-dcdf-becd-0e05d3d08636@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=guitton@adacore.com \
--cc=sergiodj@redhat.com \
--cc=simon.marchi@polymtl.ca \
/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