From patchwork Sun Sep 29 20:54:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 34717 Received: (qmail 98525 invoked by alias); 29 Sep 2019 20:54:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 98423 invoked by uid 89); 29 Sep 2019 20:54:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=launched X-HELO: mailsec114.isp.belgacom.be Received: from mailsec114.isp.belgacom.be (HELO mailsec114.isp.belgacom.be) (195.238.20.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 29 Sep 2019 20:54:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1569790482; x=1601326482; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XlMJgNJdtm7qKRL+WgxwmpNy/xKqkks9fKGpAEN7Tc4=; b=WM+fW7skMhvSwVohZZ9YfvfRyzhLV18XjrJvIZdFRhEYHv6My/xjKWw/ i0muPTz5YZxYPFfOW8xPVtuf4lonxw==; Received: from 255.38-242-81.adsl-dyn.isp.belgacom.be (HELO md.home) ([81.242.38.255]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 29 Sep 2019 22:54:32 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFA 4/4] Document prefix-define command and the use of . in command names. Date: Sun, 29 Sep 2019 22:54:27 +0200 Message-Id: <20190929205427.1319-5-philippe.waroquiers@skynet.be> In-Reply-To: <20190929205427.1319-1-philippe.waroquiers@skynet.be> References: <20190929205427.1319-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes gdb/ChangeLog YYYY-MM-DD Philippe Waroquiers * NEWS: Mention prefix-define. Tell that command names can now contain a . character. gdb/doc/ChangeLog YYYY-MM-DD Philippe Waroquiers * gdb.texinfo (Define): Indicate that user-defined prefix can be used in 'define' command. Document 'prefix-define' command. --- gdb/NEWS | 6 ++++++ gdb/doc/gdb.texinfo | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 779fd91d3a..23772f41f6 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -27,6 +27,9 @@ provide the exitcode or exit status of the shell commands launched by GDB commands such as "shell", "pipe" and "make". +* User defined commands can now be defined using user defined prefix commands + Command names can now use the . character. + * The RX port now supports XML target descriptions. * GDB now shows the Ada task names at more places, e.g. in task switching @@ -69,6 +72,9 @@ pipe -d DELIM COMMAND DELIM SHELL_COMMAND With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. +prefix-define COMMAND + Define or mark a command as a user-defined prefix command. + with SETTING [VALUE] [-- COMMAND] w SETTING [VALUE] [-- COMMAND] Temporarily set SETTING, run COMMAND, and restore SETTING. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f2713c0396..25ac7a03d1 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -26347,8 +26347,9 @@ end Define a command named @var{commandname}. If there is already a command by that name, you are asked to confirm that you want to redefine it. The argument @var{commandname} may be a bare command name consisting of letters, -numbers, dashes, and underscores. It may also start with any predefined -prefix command. For example, @samp{define target my-target} creates +numbers, dashes, dots, and underscores. It may also start with any +predefined or user-defined prefix command. +For example, @samp{define target my-target} creates a user-defined @samp{target my-target} command. The definition of the command is made up of other @value{GDBN} command lines, @@ -26369,6 +26370,37 @@ You may use the @code{document} command again to change the documentation of a command. Redefining the command with @code{define} does not change the documentation. +@kindex prefix-define +@item prefix-define @var{commandname} +Define or mark the command @var{commandname} as a user-defined prefix +command. Once marked, @var{commandname} can be used as prefix command +by the @code{define} command. +Note that @code{prefix-define} can be used with a not yet defined +@var{commandname}. In such a case, @var{commandname} is defined as +an empty user-defined command. + +Example: +@example +(gdb) prefix-define abc +(gdb) prefix-define abc def +(gdb) define abc def ghi +Type commands for definition of "abc def ghi". +End with a line saying just "end". +>echo command ghi\n +>end +(gdb) define abc def +Redefine command "def"? (y or n) y +Type commands for definition of "abc def". +End with a line saying just "end". +>echo command def\n +>end +(gdb) abc def ghi +command ghi +(gdb) abc def +command def +(gdb) +@end example + @kindex dont-repeat @cindex don't repeat command @item dont-repeat