public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add support for command renaming
@ 2021-01-08 10:07 Marco Barisione
  2021-01-08 10:07 ` [PATCH 1/4] gdb: add lookup_cmd_exact to simplify a common pattern Marco Barisione
                   ` (4 more replies)
  0 siblings, 5 replies; 38+ messages in thread
From: Marco Barisione @ 2021-01-08 10:07 UTC (permalink / raw)
  To: gdb-patches

This patch series adds support for command renaming to GDB.  The main
use case is to extend existing commands:
* The original command gets renamed.
* A new command with the same original name gets defined and then calls
  the renamed one.

This feature is accessible via GDB commands ("rename" and
"define -rename-existing-to") and in Python via a new rename_existing_to
argument argument to gdb.Command.__init__.

This is the third attempt at achieving this, the first patch series (see
https://sourceware.org/legacy-ml/gdb-patches/2019-10/msg00985.html) used
a completely different approach where a command, once overwritten, was
preserved by the new command (via a new field in cmd_list_element).
Overwriting commands could access the original implementation via a
Python method on gdb.Command.

The second attempt (see
https://sourceware.org/pipermail/gdb-patches/2020-September/171829.html)
was a revised version of the previous one which worked in a similar way,
but using a slightly different terminology.  It also added a way to
access this feature via a GDB command, not only via Python.

In response to my patches, Pedro Alves recommended a different approach
involving command renaming, which is what I implemented here.

Note that I didn't use "v3" in these patches are the approach is
completely different from previous attempts, so it's not really a new
version of already proposed patches (even if the end goal of this
feature is the same).

Marco Barisione (4):
  gdb: add lookup_cmd_exact to simplify a common pattern
  gdb: prevent prefix commands from being hooks
  gdb: update the docs for add_cmd and do_add_cmd to match reality
  gdb: Add support for renaming commands

 gdb/NEWS                                      |  26 +
 gdb/cli/cli-decode.c                          | 708 +++++++++++++++---
 gdb/cli/cli-decode.h                          |   3 +
 gdb/cli/cli-script.c                          | 368 +++++++--
 gdb/command.h                                 | 103 ++-
 gdb/doc/gdb.texinfo                           |  55 +-
 gdb/doc/python.texi                           |  38 +-
 gdb/python/py-cmd.c                           | 172 ++++-
 gdb/testsuite/gdb.base/command-renaming.exp   | 571 ++++++++++++++
 gdb/testsuite/gdb.base/define-prefix.exp      |  24 +
 .../gdb.python/py-rename-existing.exp         | 364 +++++++++
 .../gdb.python/py-rename-existing.py          |  46 ++
 12 files changed, 2238 insertions(+), 240 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/command-renaming.exp
 create mode 100644 gdb/testsuite/gdb.python/py-rename-existing.exp
 create mode 100644 gdb/testsuite/gdb.python/py-rename-existing.py

-- 
2.28.0


^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2021-05-14 20:41 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 10:07 [PATCH 0/4] Add support for command renaming Marco Barisione
2021-01-08 10:07 ` [PATCH 1/4] gdb: add lookup_cmd_exact to simplify a common pattern Marco Barisione
2021-01-10  0:06   ` Lancelot SIX
2021-01-17 10:47     ` Marco Barisione
2021-01-17 19:02       ` Lancelot SIX
2021-01-25 11:33         ` Luis Machado
2021-01-08 10:07 ` [PATCH 2/4] gdb: prevent prefix commands from being hooks Marco Barisione
2021-01-08 10:07 ` [PATCH 3/4] gdb: update the docs for add_cmd and do_add_cmd to match reality Marco Barisione
2021-01-08 10:07 ` [PATCH 4/4] gdb: Add support for renaming commands Marco Barisione
2021-01-08 10:30   ` Eli Zaretskii
2021-01-25 11:26 ` [PATCH v2 0/5] Add support for command renaming Marco Barisione
2021-01-25 11:26   ` [PATCH v2 1/5] gdb: add lookup_cmd_exact to simplify a common pattern Marco Barisione
2021-03-08 18:58     ` Simon Marchi
2021-05-07 14:47       ` Marco Barisione
2021-01-25 11:26   ` [PATCH v2 2/5] gdb: prevent prefix commands from being hooks Marco Barisione
2021-03-08 21:32     ` Simon Marchi
2021-03-09  9:42       ` Marco Barisione
2021-03-16  3:17         ` Simon Marchi
2021-05-07 14:59           ` Marco Barisione
2021-05-07 19:30             ` Simon Marchi
2021-05-07 20:11               ` Marco Barisione
2021-05-14 20:38       ` [PATCH v3 " Marco Barisione
2021-01-25 11:26   ` [PATCH v2 3/5] gdb: update the docs for add_cmd and do_add_cmd to match reality Marco Barisione
2021-03-08 22:52     ` Simon Marchi
2021-03-08 23:10       ` Simon Marchi
2021-05-14 20:39       ` [PATCH v3 3/5] gdb: move declarations and docs for cli-decode.c to cli-decode.h Marco Barisione
2021-01-25 11:26   ` [PATCH v2 4/5] gdb: generate the prefix name for prefix commands on demand Marco Barisione
2021-03-08 23:25     ` Simon Marchi
2021-03-16 17:00       ` Simon Marchi
2021-05-12 11:10       ` Marco Barisione
2021-01-25 11:26   ` [PATCH v2 5/5] gdb: Add support for renaming commands Marco Barisione
2021-03-23 18:45     ` Simon Marchi
2021-05-14 20:41       ` [PATCH v3 5/5] gdb: add " Marco Barisione
2021-02-08 17:53   ` [PING] [PATCH v2 0/5] Add support for command renaming Marco Barisione
2021-02-15  8:27     ` [PING2] " Marco Barisione
2021-02-22  8:28       ` [PING 3] " Marco Barisione
2021-03-01  8:32         ` [PING 4] " Marco Barisione
2021-03-08  9:23           ` [PING 5] " Marco Barisione

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).