From: Marco Barisione <mbarisione@undo.io>
To: gdb-patches@sourceware.org
Subject: Add a way to invoke redefined (overridden) GDB commands
Date: Mon, 14 Sep 2020 09:39:23 +0000 [thread overview]
Message-ID: <20200914093925.5442-1-mbarisione@undo.io> (raw)
Currently, when a GDB command is redefined, the original implementation is not
available any more. This makes it difficult to build features on top of
existing commands.
Last year I submitted a patch to fix this but I ran out of time to address the
review comments (the original patch was sent on the 28th of October 2019).
These patches restart that work and should address all the comments I got last
time. As the patchea are very different and a long time passed, I'm
submitting as a new series.
My patches add a new "uplevel" command and a new gdb.Command.invoke_uplevel
method inspired by TCL (as initially suggested by Andrew Burgess) so you can
do this:
(gdb) define run
echo Will run!\n
uplevel 0 run
end
(gdb) run
Will run!
[... normal output of run ...]
There are a couple of other things which could be added to make the "uplevel"
command more helpful, but I think they are out of scope and my patches are
already useful as they are.
The first thing is adding a way of accessing the untokenised arguments to a
command via something like "$arg@" (Andrew Burgess suggested "$argv", but
Pedro Alves pointed out that would look like an argument vector).
Another thing which could be added is the ability to do "uplevel -1 ..." to
access the directly redefined command.
This is implemented in Python but I couldn't find an obvious way of doing that
for the "uplevel" command as there's no way of knowing which command you are
currently executing (at least from what I could see).
Maybe it could be implemented in a similar way to how command arguments are
kept around with scoped_user_args_level, so we could keep a stack of all (user
and non-user) commands which are being executed. By checking the latest one
you can know what "uplevel -1" would apply to.
next reply other threads:[~2020-09-14 9:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-14 9:39 Marco Barisione [this message]
2020-09-14 9:39 ` [PATCH 1/2] Move the code to execute a cmd_list_element out from execute_command Marco Barisione
2020-10-05 9:08 ` Andrew Burgess
2020-10-05 9:40 ` Marco Barisione
2020-10-05 17:49 ` Andrew Burgess
2020-09-14 9:39 ` [PATCH 2/2] Add a way to preserve redefined GDB commands for later invocation Marco Barisione
2020-09-14 16:18 ` Eli Zaretskii
2020-09-14 16:51 ` Marco Barisione
2020-10-05 10:24 ` Andrew Burgess
2020-10-05 11:44 ` Marco Barisione
2020-10-05 18:11 ` Andrew Burgess
2020-10-06 7:18 ` Marco Barisione
2020-09-28 7:54 ` [PING] Add a way to invoke redefined (overridden) GDB commands Marco Barisione
2020-10-05 7:42 ` Marco Barisione
2020-10-12 11:50 ` Pedro Alves
2020-10-19 17:41 ` Marco Barisione
2020-10-19 18:05 ` Pedro Alves
2020-10-19 18:47 ` Philippe Waroquiers via Gdb-patches
2020-10-19 19:28 ` Marco Barisione
2020-10-20 15:06 ` Pedro Alves
2020-10-20 18:19 ` Marco Barisione
2020-10-20 18:32 ` Pedro Alves
2020-10-20 15:15 ` Pedro Alves
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=20200914093925.5442-1-mbarisione@undo.io \
--to=mbarisione@undo.io \
--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