From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29455 invoked by alias); 28 Aug 2013 08:16:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 29440 invoked by uid 89); 28 Aug 2013 08:16:40 -0000 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Aug 2013 08:16:40 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RDNS_NONE,SPF_HELO_FAIL autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VEavb-0000lF-MJ from Muhammad_Bilal@mentor.com ; Wed, 28 Aug 2013 01:16:35 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 28 Aug 2013 01:16:35 -0700 Received: from [137.202.157.37] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.2.247.3; Wed, 28 Aug 2013 09:16:34 +0100 Message-ID: <521DB1E1.5040804@codesourcery.com> Date: Wed, 28 Aug 2013 08:16:00 -0000 From: Muhammad Bilal User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: Re: [patch] fix for checking the command ambiguousness. References: <521C6FDD.3090909@codesourcery.com> <521CEB86.7060106@redhat.com> In-Reply-To: <521CEB86.7060106@redhat.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-08/txt/msg00811.txt.bz2 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 "", line 1, in 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 * cli/cli-decode.c (lookup_cmd_composition): Check command ambiguousness with 'nfound' instead of CMD_LIST_AMBIGUOUS. ./testsuite/ 2013-08-28 Muhammad Bilal * 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" "" \