From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id hK1aL/KxUWFtPwAAWB0awg (envelope-from ) for ; Mon, 27 Sep 2021 07:58:42 -0400 Received: by simark.ca (Postfix, from userid 112) id B1F101EE25; Mon, 27 Sep 2021 07:58:42 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id CE4051EDDB for ; Mon, 27 Sep 2021 07:58:41 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 546713858426 for ; Mon, 27 Sep 2021 11:58:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 546713858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632743921; bh=Ke3iAyJLnmqV46kE9uqpxOw+oJCvf/RhPfNE+HIKo7o=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=sbTr+oPHVjiw8VZuCXDy92exVITtjZbIo9UFp5FnVLbP2DfJp5jKG7kgRifehaue6 nL9g74IRAWmAmn5BkubdRfkrAVYqaCOMkhERh8IvKmg5wMHS4VHB19WwSE0bM29e69 5YXXtFo7z2B+UGELPOBq2tr1WIN/BqpdqcreNgkA= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 75C893858C27 for ; Mon, 27 Sep 2021 11:58:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75C893858C27 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 18RBwGM6022431 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Sep 2021 07:58:20 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 18RBwGM6022431 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B46661EDDB; Mon, 27 Sep 2021 07:58:15 -0400 (EDT) Message-ID: Date: Mon, 27 Sep 2021 07:58:14 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH][gdb/build] Fix build with g++-4.8 Content-Language: en-US To: Tom de Vries , gdb-patches@sourceware.org References: <20210926091521.GA31054@delia> <4c635f63-2e4d-559e-0d8d-85e77524201e@polymtl.ca> <95dadb7a-10fe-9373-a076-26cef9c48777@suse.de> In-Reply-To: <95dadb7a-10fe-9373-a076-26cef9c48777@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 27 Sep 2021 11:58:16 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-09-27 05:29, Tom de Vries wrote: > On 9/26/21 9:33 PM, Simon Marchi wrote: >>> [ I considered just removing the initialization, with the idea that access >>> should be guarded by has_pc_info, but I ran into one failure in the testsuite, >>> for gdb.base/check-psymtab.exp due to add_partial_symbol using lowpc without >>> checking has_pc_info. ] >> >> Does that mean you've found a bug in add_partial_symbol? > > Good question, I'm not sure. > > Basically, we're processing this DIE: > ... > <1><134>: Abbrev Number: 5 (DW_TAG_subprogram) > <135> DW_AT_name : foo > <139> DW_AT_decl_file : 1 > <13a> DW_AT_decl_line : 19 > <13b> DW_AT_prototyped : 1 > <13b> DW_AT_type : <0x12d> > <13f> DW_AT_inline : 3 (declared as inline and inlined) > ... > which indeed does not have low_pc/high_pc or ranges, so has_pc_info > remains false, and lowpc remains set to the initialization value of 0, > end we end up with foo at addresss 0: > ... > (gdb) maint print psymbols^M > ... > Global partial symbols:^M > `main', function, 0x4004a7^M > Static partial symbols:^M > `int', type, 0x0^M > `foo', function, 0x0^M > ... That looks a little odd to pretend this function has code at address 0. But if that doesn't have direct unwanted consequences, ok. > There actually is an entry: > ... > <2><115>: Abbrev Number: 3 (DW_TAG_inlined_subroutine) > <116> DW_AT_abstract_origin: <0x134> > <11a> DW_AT_low_pc : 0x4004ab > <122> DW_AT_high_pc : 0x5 > <12a> DW_AT_call_file : 1 > <12b> DW_AT_call_line : 27 > ... > with low_pc/high_pc, but that one is ignored because of being a child of > DW_TAG_subprogram main rather than a top-level DIE. > > So, does foo having address 0 cause problems? I suspect not. It's > inlined into main, so the address range is covered there. > > Then, is it a bug to access pdi->low_pc without has_pc_info == true? If > so, it's fixed by doing: > ... > case DW_TAG_subprogram: > - addr = ... pdi->lowpc ... ; > + if (pdi->has_pc_info) > + addr = ... pdi->lowpc ... ; > ... > with as only effect that the initialization could be removed. > > I think addressing this in a more consistent way is to add accessor > functions that can assert when used incorrectly, and perhaps adding an > enum { none, high_low, high_low_non_contiguous, range_offset } to more > precisely encode what kind of information we have. Yes, that would make sense. Simon