From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6751 invoked by alias); 30 Jul 2014 11:44:09 -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 6732 invoked by uid 89); 30 Jul 2014 11:44:08 -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; Wed, 30 Jul 2014 11:44:07 +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 s6UBi2vp016677 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jul 2014 07:44:02 -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 s6UBi0Jv021130; Wed, 30 Jul 2014 07:44:01 -0400 Message-ID: <53D8DA80.8010603@redhat.com> Date: Wed, 30 Jul 2014 12:05: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 , "gdb-patches@sourceware.org" , "tromey@redhat.com" Subject: Re: [PATCH v2 2/2] mi-out: Implement mi redirection using a stack. References: <87ha26liw6.fsf@fleche.redhat.com> <1406288037-11470-1-git-send-email-adrian.sendroiu@freescale.com> <53D7B5BE.6020702@redhat.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-07/txt/msg00783.txt.bz2 On 07/30/2014 09:37 AM, Adrian Sendroiu wrote: >> -----Original Message----- >> From: Pedro Alves [mailto:palves@redhat.com] >> Sent: Tuesday, July 29, 2014 5:55 PM >> To: Sendroiu Adrian-B46904; gdb-patches@sourceware.org; >> tromey@redhat.com >> Subject: Re: [PATCH v2 2/2] mi-out: Implement mi redirection using a >> stack. >> >> I'm guessing we can trigger this by using "save breakpoints" while >> logging is enabled, like gdb.base/ui-redirect.exp ? >> I think it'd be very good if a test to the testsuite was added. >> Sounds like gdb.mi/mi-logging.exp would be a good place? >> >> -- >> Thanks, >> Pedro Alves > > This won't trigger the bug, because the logging code doesn't call ui_out_redirect if the interpreter is MI. The way I caught it was through some python script that executes commands and catches their output into a string. For example, if you have > > gdb.execute("break main", False, True) > > The call sequence will be something like: > execute_command_to_string > ui_out_redirect > execute_command > ... > mi_breakpoint_created > ui_out_redirect > > Then, after executing this, the mi_uiout->data->buffer will incorrectly point to a freed ui_file structure, and any subsequent command will overwrite the pointers inside this ui_file with random data, causing a crash. > > Do you have any suggestions on how to make a test case from this scenario? I'm not sure what specific suggestion you're looking after. :-) Sound like you'd add a test that does that exactly ? You'd either base on, or add to mi-logging.exp, and do something like: mi_gdb_test "python gdb.execute("break main", False, True)" ... mi_gdb_test ... (and skip the test if skip_python_tests is true) Thanks, Pedro Alves