From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15417 invoked by alias); 27 Jul 2012 08:21:19 -0000 Received: (qmail 15407 invoked by uid 22791); 27 Jul 2012 08:21:17 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mms3.broadcom.com (HELO mms3.broadcom.com) (216.31.210.19) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Jul 2012 08:20:32 +0000 Received: from [10.9.200.131] by mms3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Fri, 27 Jul 2012 01:18:50 -0700 X-Server-Uuid: B86B6450-0931-4310-942E-F00ED04CA7AF Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB01.corp.ad.broadcom.com (10.9.200.131) with Microsoft SMTP Server id 8.2.247.2; Fri, 27 Jul 2012 01:20:19 -0700 Received: from [10.177.73.70] (unknown [10.177.73.70]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 188399F9F5; Fri, 27 Jul 2012 01:20:18 -0700 (PDT) Message-ID: <50124F42.5060404@broadcom.com> Date: Fri, 27 Jul 2012 08:21:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: "Jan Kratochvil" cc: "gdb-patches@sourceware.org" , "Tom Tromey" Subject: Re: Re-evaluate floating varobj as part of varobj_invalidate. References: <501025E0.30708@broadcom.com> <87vchbhgo9.fsf@fleche.redhat.com> <20120726083511.GA16614@host2.jankratochvil.net> In-Reply-To: <20120726083511.GA16614@host2.jankratochvil.net> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2012-07/txt/msg00669.txt.bz2 On 26/07/2012 9:35 AM, Jan Kratochvil wrote: > On Wed, 25 Jul 2012 19:52:22 +0200, Tom Tromey wrote: >>>>>>> "Andrew" == Andrew Burgess writes: >> >> Andrew> I have a bug & patch, but no great way to reproduce the issue as >> Andrew> it's a use of pointer after free issue, >> >> I suspect the recent-ish change to use -lmcheck by default will cause us >> to catch this bug in the test suite, at least on glibc-using systems. > > Yes, FSF GDB HEAD crashes for me with the posted reproducer. Could you write > this simple testcase? There's a patch below that tests this issue, it does indeed fail for me running on x86-linux before my fix patch, and works afterwards. If this test is ok I'll commit the fix and the test patches together. Thanks Andrew gdb/testsuite/ChangeLog 2012-07-27 Andrew Burgess * gdb.mi/mi-var-invalidate.exp: Create a floating variable and change its format immediately after reloading the binary. diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp index 3ecbbdf..98dd3f1 100644 --- a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp +++ b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp @@ -61,6 +61,9 @@ mi_runto do_locals_tests # Desc: create local variables mi_create_varobj linteger linteger "create local variable linteger" +# Desc: create floating variable +mi_create_floating_varobj float_simple array "create floating variable" + # # Reload the same binary. # Global variable should remain, local should be invalidated. @@ -69,6 +72,12 @@ mi_delete_breakpoints mi_gdb_load ${binfile_bis} mi_runto main +# Change format of floating variable immediately after reload reveals a +# bug where gdb still uses a free'd pointer. +mi_gdb_test "-var-set-format float_simple hexadecimal" \ + "\\^done,format=\"hexadecimal\",value=\"\\\[-1\\\]\"" \ + "set format variable float_simple" + # Check local variable is "invalid". mi_gdb_test "-var-update linteger" \ "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"invalid\",has_more=\"0\"\}\\\]" \