From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8170 invoked by alias); 29 Aug 2014 13:32:21 -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 8089 invoked by uid 89); 29 Aug 2014 13:32:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com 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; Fri, 29 Aug 2014 13:32:18 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1XNMHm-0007EO-Qz from Yao_Qi@mentor.com ; Fri, 29 Aug 2014 06:32:14 -0700 Received: from GreenOnly (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Fri, 29 Aug 2014 06:32:14 -0700 From: Yao Qi To: Doug Evans CC: Subject: Re: [PATCH 2/3] Check data is GC'ed References: <53D8A264.1050103@codesourcery.com> <1408609338-17561-1-git-send-email-yao@codesourcery.com> <1408609338-17561-2-git-send-email-yao@codesourcery.com> <21495.34225.60705.175416@ruffy2.mtv.corp.google.com> Date: Fri, 29 Aug 2014 13:32:00 -0000 In-Reply-To: <21495.34225.60705.175416@ruffy2.mtv.corp.google.com> (Doug Evans's message of "Fri, 22 Aug 2014 11:02:25 -0700") Message-ID: <87oav3e87g.fsf@codesourcery.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00643.txt.bz2 Doug Evans writes: > > if (pdi->d.locdesc > > && addr =3D=3D 0 > > - && !dwarf2_per_objfile->has_section_at_zero) > > + /* When the address is 0, if the object file doesn't have > > + section at zero or the section at zero is executable, > > + we think address 0 means the corresponding variable is > > + removed by linker, instead of there is a data at address > > + 0. */ > > + && (dwarf2_per_objfile->section_at_zero =3D=3D NULL > > + || dwarf2_per_objfile->section_at_zero->flags & SEC_CODE)) > > Could there be a DW_TAG_variable in SEC_CODE? > Someone might put one there for a particular reason. I don't figure out a reason to do so, but it is possible via: __attribute__((section(".text"))) int foo =3D 1; I can't think of other heuristics, so if GDB has a section at address zero, GDB can't tell address zero in debug information means the corresponding variable is GC'ed by linker or the variable address is zero. How about open a PR about GDB is unable to know whether a variable is GC'ed by linker if there is a section at address zero? and kfail dw2-var-zero-addr.exp conditionally? Something like: if [is_address_zero_readable] { setup_kfail "gdb/PR" "*-*-*" } gdb_test "print &var" {No symbol "var" in current context\.} What do you think? --=20 Yao (=E9=BD=90=E5=B0=A7)