This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] use of dont_repeat
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Tue, 02 Dec 2008 17:58:46 -0700
- Subject: [python] use of dont_repeat
- Reply-to: tromey at redhat dot com
It doesn't make sense to auto-repeat a couple of the new commands
written in python. This fixes these cases.
This also fixes a bug in the "alias" command. Now it matches its
documentation if the user does not provide an "=".
Tom
2008-12-02 Tom Tromey <tromey@redhat.com>
* python/lib/gdb/command/alias.py (AliasCommand.invoke): Call
dont_repeat. Fix logic when no '='.
* python/lib/gdb/command/save_breakpoints.py
(SaveBreakpointsCommand.invoke): Call dont_repeat.
diff --git a/gdb/python/lib/gdb/command/alias.py b/gdb/python/lib/gdb/command/alias.py
index 8443d67..53f52e5 100644
--- a/gdb/python/lib/gdb/command/alias.py
+++ b/gdb/python/lib/gdb/command/alias.py
@@ -45,15 +45,18 @@ before the '=' are the name of the new command."""
gdb.COMPLETE_COMMAND)
def invoke (self, arg, from_tty):
+ self.dont_repeat ()
# Without some form of quoting we can't alias a multi-word
# command to another command.
args = arg.split()
try:
- i = args.index ('=')
+ start = args.index ('=')
+ end = start + 1
except ValueError:
- i = 0
- target = " ".join(args[(i+1):])
- AliasImplementation (" ".join (args[0:i]), target,
+ start = 1
+ end = 1
+ target = " ".join(args[end:])
+ AliasImplementation (" ".join (args[0:start]), target,
"This command is an alias for '%s'." % target)
AliasCommand()
diff --git a/gdb/python/lib/gdb/command/save_breakpoints.py b/gdb/python/lib/gdb/command/save_breakpoints.py
index ce0f2e5..eeeb5dd 100644
--- a/gdb/python/lib/gdb/command/save_breakpoints.py
+++ b/gdb/python/lib/gdb/command/save_breakpoints.py
@@ -37,6 +37,7 @@ The breakpoints can be restored using the 'source' command."""
gdb.COMPLETE_FILENAME)
def invoke (self, arg, from_tty):
+ self.dont_repeat ()
bps = gdb.get_breakpoints ()
if bps is None:
raise RuntimeError, 'No breakpoints to save'