From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1948 invoked by alias); 31 Jul 2014 16:23:24 -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 1937 invoked by uid 89); 31 Jul 2014 16:23:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 31 Jul 2014 16:23:21 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6VGNHBd030244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Jul 2014 12:23:17 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6VGNFct020408; Thu, 31 Jul 2014 12:23:16 -0400 Message-ID: <53DA6D73.5050906@redhat.com> Date: Thu, 31 Jul 2014 17:11:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Adrian Sendroiu , tromey@redhat.com, gdb-patches@sourceware.org Subject: Re: [PATCH v2 2/2] mi-out: Implement mi redirection using a stack. References: <53D8DA80.8010603@redhat.com> <1406819332-24242-1-git-send-email-adrian.sendroiu@freescale.com> In-Reply-To: <1406819332-24242-1-git-send-email-adrian.sendroiu@freescale.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-07/txt/msg00824.txt.bz2 Awesome! Thanks for doing this. This is close. Some notes on the technicalities below. On 07/31/2014 04:08 PM, Adrian Sendroiu wrote: > +# This triggers a nested mi_ui_out redirection, by disabling a breakpoint > +# inside a python command that has to_string = True. > +if ![mi_skip_python_tests] { > + mi_gdb_test "-break-insert do_nothing" ".*" > + mi_gdb_test "-break-commands 2 \"python gdb.execute('disable 2', True, True)\"" ".*" It's better to use $bpnum instead of hardcoding 2, as otherwise if someone adds a test that adds another breakpoint before this, this test stops being effective, silently. > + > + mi_gdb_test "-exec-continue" ".*" This should use mi_send_resuming_command/mi_expect_stop or mi_execute_to, so that the test works when the whole MI testsuite is run in async mode. > + > + set s [string repeat "A" 100] > + > + # This will crash gdb if redirection is not done properly. > + mi_gdb_test "echo $s" ".*\\^done" "mi nested redirect" In addition to that, it'd be good to confirm the breakpoint did end up disabled, which likewise confirms the breakpoint command was set on the breakpoint we wanted. (might not need the "echo" if that itself already causes a crash.) > +proc mi_skip_python_tests {} { > + global mi_gdb_prompt > + global gdb_py_is_py3k > + global gdb_py_is_py24 > + > + gdb_test_multiple "python print ('test')" "verify python support" { > + -re "not supported.*$mi_gdb_prompt$" { > + unsupported "Python support is disabled." > + return 1 > + } > + -re "$mi_gdb_prompt$" {} > + } > + > + set gdb_py_is_py24 0 > + gdb_test_multiple "python print (sys.version_info\[0\])" "check if python 3" { > + -re "3.*$mi_gdb_prompt$" { > + set gdb_py_is_py3k 1 > + } > + -re ".*$mi_gdb_prompt$" { > + set gdb_py_is_py3k 0 > + } > + > + } > + if { $gdb_py_is_py3k == 0 } { > + gdb_test_multiple "python print (sys.version_info\[1\])" "check if python 2.4" { > + -re "\[45\].*$mi_gdb_prompt$" { > + set gdb_py_is_py24 1 > + } > + -re ".*$mi_gdb_prompt$" { > + set gdb_py_is_py24 0 > + } > + } > + } > + > + return 0 > +} I think that we can avoid this duplication by renaming skip_python_tests, adding it a prompt_re parameter, and using that instead of $gdb_prompt. Something like: proc skip_python_tests {} { skip_python_tests_prompt "$gdb_prompt $" } proc mi_skip_python_tests { skip_python_tests_prompt "$mi_gdb_prompt$" } Did you try that? Thanks, Pedro Alves