From: Muhammad Bilal <mbilal@codesourcery.com>
To: Pedro Alves <palves@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [patch] fix for checking the command ambiguousness.
Date: Wed, 28 Aug 2013 08:16:00 -0000 [thread overview]
Message-ID: <521DB1E1.5040804@codesourcery.com> (raw)
In-Reply-To: <521CEB86.7060106@redhat.com>
On 08/27/2013 11:10 PM, Pedro Alves wrote:
> Is it possible to construct a testcase that triggers this?
>
yes, I found a test case to triggers this.
Before apply the patch, GDB does not recognize the command ambiguity as.
(gdb) python gdb.parameter("print symbo on")
(gdb) show print symbo
Ambiguous show print command "symbo": symbol, symbol-filename.
(gdb)
And after applied my patch GBD shows.
(gdb) python gdb.parameter("print symbo on")
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: Could not find parameter `print symbo on'.
Error while executing Python code.
(gdb) set print symbo
Ambiguous set print command "symbo": symbol, symbol-filename.
(gdb)
Now
Find below updated patch with test suite also.
./
2013-07-27 Muhammad Bilal <mbilal@codesourcery.com>
* cli/cli-decode.c (lookup_cmd_composition): Check command
ambiguousness
with 'nfound' instead of CMD_LIST_AMBIGUOUS.
./testsuite/
2013-08-28 Muhammad Bilal <mbilal@codesourcery.com>
* gdb.python/py-parameter.exp: Test command ambiguousness.
Index: ../src/gdb/cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.119
diff -u -p -r1.119 cli-decode.c
--- ../src/gdb/cli/cli-decode.c 24 Apr 2013 14:29:17 -0000 1.119
+++ ../src/gdb/cli/cli-decode.c 28 Aug 2013 08:11:19 -0000
@@ -1729,7 +1729,7 @@ lookup_cmd_composition (const char *text
*cmd = find_cmd (command, len, cur_list, 1, &nfound);
}
- if (*cmd == CMD_LIST_AMBIGUOUS)
+ if (nfound > 1)
{
return 0; /* ambiguous */
}
Index: ../src/gdb/testsuite/gdb.python/py-parameter.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-parameter.exp,v
retrieving revision 1.8
diff -u -p -r1.8 py-parameter.exp
--- ../src/gdb/testsuite/gdb.python/py-parameter.exp 1 Jan 2013
06:41:26 -0000 1.8
+++ ../src/gdb/testsuite/gdb.python/py-parameter.exp 28 Aug 2013
08:12:42 -0000
@@ -29,6 +29,13 @@ if { [skip_python_tests] } { continue }
# We use "." here instead of ":" so that this works on win32 too.
gdb_test "python print (gdb.parameter ('directories'))"
"$srcdir/$subdir.\\\$cdir.\\\$cwd"
+#Test command ambiguousness
+gdb_test "python gdb.parameter('print symbo on')" \
+"Traceback.*File.*line 1.*RuntimeError.*Could not find parameter.*print
symbo on.*Error while executing Python code.*" \
+"set print symbo on"
+gdb_test "show print symbo" "Ambiguous show print command \"symbo\".*" \
+"show print symbo"
+
# Test a simple boolean parameter.
gdb_py_test_multiple "Simple gdb booleanparameter" \
"python" "" \
next prev parent reply other threads:[~2013-08-28 8:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-27 9:22 Muhammad Bilal
2013-08-27 18:10 ` Pedro Alves
2013-08-28 8:16 ` Muhammad Bilal [this message]
[not found] ` <521DE287.2010208@redhat.com>
2013-08-28 14:17 ` Muhammad Bilal
2013-09-04 12:34 ` Muhammad Bilal
2013-09-10 10:33 ` Muhammad Bilal
2013-09-17 16:28 ` Muhammad Bilal
2013-09-17 16:31 ` Pedro Alves
2013-11-07 15:04 ` Tom Tromey
2013-11-07 14:53 ` Tom Tromey
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=521DB1E1.5040804@codesourcery.com \
--to=mbilal@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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