From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1456 invoked by alias); 12 Mar 2013 14:48:35 -0000 Received: (qmail 1446 invoked by uid 22791); 12 Mar 2013 14:48:34 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Mar 2013 14:48:16 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UFQUw-0000dX-8A from Hui_Zhu@mentor.com ; Tue, 12 Mar 2013 07:48:14 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 12 Mar 2013 07:48:13 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Tue, 12 Mar 2013 07:48:12 -0700 Message-ID: <513F4028.5090000@mentor.com> Date: Tue, 12 Mar 2013 14:48:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: Tom Tromey , Hui Zhu CC: Yao Qi , gdb-patches ml , Joel Brobecker Subject: Re: [PATCH] Fix agent code generate bug of ref References: <513DDE2C.9080109@codesourcery.com> <87r4jmngr5.fsf@fleche.redhat.com> <87k3penfy3.fsf@fleche.redhat.com> <87y5dsityl.fsf@fleche.redhat.com> In-Reply-To: <87y5dsityl.fsf@fleche.redhat.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed 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: 2013-03/txt/msg00517.txt.bz2 On 03/12/13 22:16, Tom Tromey wrote: >>>>>> "Hui" == Hui Zhu writes: > > Hui> Sorry for my misunderstand in your mail. Accord to discussion with > Hui> Yao in IRC. I merge 2 patches together. > Hui> And I found that gdb_assert of access_memory. It should use nbytes. > > Thanks for doing this. > > Hui> 2013-03-12 Yao Qi > Hui> Hui Zhu > Hui> * dwarf2loc.c (access_memory): Change nbits to nbytes in gdb_assert. > Hui> (dwarf2_compile_expr_to_ax): Call access_memory in DW_OP_deref and > Hui> DW_OP_deref_size. > > Hui> + gdb_assert (nbytes > 0 && nbytes <= sizeof (LONGEST)); > > Hui> - default: > Hui> - /* Note that get_DW_OP_name will never return > Hui> - NULL here. */ > Hui> - error (_("Unsupported size %d in %s"), > Hui> - size, get_DW_OP_name (op)); > Hui> - } > > I think we need a sanity check before calling access_memory. > Otherwise, bad DWARF will be able to crash gdb. > The patch is ok with that change. > > Tom > According to the discussion with Tom in IRC. I add a check before call access_memory. + if (size != 1 && size != 2 && size != 4 && size != 8) + error (_("Refn doesn't support size %d"), + size * TARGET_CHAR_BIT); Checked in http://sourceware.org/ml/gdb-cvs/2013-03/msg00102.html Thanks, Hui