From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 7BD6E386F40B for ; Mon, 14 Sep 2020 16:18:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7BD6E386F40B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eliz@gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]:55336) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHrBL-0004aB-NG; Mon, 14 Sep 2020 12:18:19 -0400 Received: from [176.228.60.248] (port=3169 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kHrBL-0007HD-0G; Mon, 14 Sep 2020 12:18:19 -0400 Date: Mon, 14 Sep 2020 19:18:23 +0300 Message-Id: <83lfhc9vsg.fsf@gnu.org> From: Eli Zaretskii To: Marco Barisione Cc: gdb-patches@sourceware.org In-Reply-To: <20200914093925.5442-3-mbarisione@undo.io> (message from Marco Barisione on Mon, 14 Sep 2020 09:39:25 +0000) Subject: Re: [PATCH 2/2] Add a way to preserve redefined GDB commands for later invocation References: <20200914093925.5442-1-mbarisione@undo.io> <20200914093925.5442-3-mbarisione@undo.io> X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2020 16:18:21 -0000 > From: Marco Barisione > Date: Mon, 14 Sep 2020 09:39:25 +0000 > > When a command was redefined, the functionality of the original command > used to be lost, making it difficult to extend existing commands. > > This patch adds an uplevel command (inspired by the TCL command with the > same name) which allows access to previous implementations of commands > and a gdb.Command.invoke_uplevel Python method to do the same. > > gdb/ChangeLog: > > * NEWS: Document the addition of the uplevel command and the > gdb.Command.invoke_uplevel Python method. > * cli/cli-decode.c (delete_cmd): Rename to remove_cmd. > (do_add_cmd): Keep the removed command and and update the chain > of inmplementations of the same command. > (add_alias_cmd): Update to reflect the changes to delete_cmd. > (remove_cmd): Rename from delete_cmd. Preserve removed commands, > but not aliases, and return them. > (lookup_uplevel_cmd): Lookup an implementation of a command based > on a cmd_list_element of the same name and a level. > * cli/cli-decode.h (struct cmd_list_element): Add uplevel_cmd and > downlevel_cmd to keep track of redefined commands and commands > which redefined them. > * cli/cli-script.c (uplevel_command): Implementation of the > uplevel command. > * command.h: Add declaration of lookup_uplevel_cmd. > * python/py-cmd.c (cmdpy_invoke_uplevel): Implementation of the > gdb.Command.invoke_uplevel method. > > gdb/doc/ChangeLog: > > * gdb/doc/gdb.texinfo: Document the uplevel command. > * python.texi: Document the gdb.Command.invoke_uplevel method. > > gdb/testsuite/ChangeLog: > > * gdb.base/uplevel.exp: New file to test the uplevel command. > * gdb.python/py-invoke-uplevel.exp: New file to test the > gdb.Command.invoke_uplevel method. > * gdb.python/py-invoke-uplevel.py: New test. Thanks, the documentation parts are okay. Though I wonder whether 'uplevel' is really the best name for this. (No, I don't write Python.)