From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 1CE8F3858CD1 for ; Tue, 19 Mar 2024 09:38:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1CE8F3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1CE8F3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710841082; cv=none; b=etp6J9+zUYMpC8PsnEAo5r/C0G8ft6bNmgiBxgGvT6rU6CXbGRDfkCOOTRSwF4XB0YiF9rSRFCjc2zy2SdjGy9ngRkclD/ZdGKu7N38J5WfOQYAPB8fmDt7K4ayNnerCoeKd898w5dDRx3a5qDDdQFmhRJ9nlaGTWOJZsvRarWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710841082; c=relaxed/simple; bh=hm/uTGq9bLOxhsM8IXR6xWM+s2rueKIBvLgZeOUFoJI=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:From:To; b=NSCn+n04LmGgCKJyjctc9y9q+fRVxbLkv067JsGcegtIDdeCaXUaX554XhruhJLp6PotwjmSQGG5VyAhelO2juAJhIc++eF2EIsGf9E0dr7FYzc1dCMBciUSE/e9bc57MCOjOPBOGT4kKSjxMI3xzLhU8IPd+zg11W4/vYGGD/k= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 021113760F; Tue, 19 Mar 2024 09:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1710841080; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dphdETKBHvF4J8A5o0Ko+qvUJUUcOPa5OL4No00BDvU=; b=JXxl80Vap7pKo/cZWtD2/uMURRt9sE8frf7RXK14rTgT2D6kaYZ561Ht3ZbniZNJ4rgInS lUZkjxiI98FyXntAeTCNg2XKHYb8cjqzsKm/Bmku5UZuZ2xk7hBcjkgKYuVGUKUsTL3rlG ILWYyeAiH5YfiLbtmJYwhgm3qXMkyOk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1710841080; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dphdETKBHvF4J8A5o0Ko+qvUJUUcOPa5OL4No00BDvU=; b=BsBg0P46DCozGw444vsC2/R1ZlyyngRov6JgwSCma8274NiITcakFIagLZL5Uwu7YE8m/u N7FZpUGBcuSgSWCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1710841080; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dphdETKBHvF4J8A5o0Ko+qvUJUUcOPa5OL4No00BDvU=; b=JXxl80Vap7pKo/cZWtD2/uMURRt9sE8frf7RXK14rTgT2D6kaYZ561Ht3ZbniZNJ4rgInS lUZkjxiI98FyXntAeTCNg2XKHYb8cjqzsKm/Bmku5UZuZ2xk7hBcjkgKYuVGUKUsTL3rlG ILWYyeAiH5YfiLbtmJYwhgm3qXMkyOk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1710841080; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dphdETKBHvF4J8A5o0Ko+qvUJUUcOPa5OL4No00BDvU=; b=BsBg0P46DCozGw444vsC2/R1ZlyyngRov6JgwSCma8274NiITcakFIagLZL5Uwu7YE8m/u N7FZpUGBcuSgSWCA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D3AA1136A5; Tue, 19 Mar 2024 09:37:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +jlLMvdc+WXfFwAAD6G6ig (envelope-from ); Tue, 19 Mar 2024 09:37:59 +0000 Message-ID: <912349ca-7daf-4a6b-88d9-a2908227e32f@suse.de> Date: Tue, 19 Mar 2024 10:39:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/symtab] Workaround PR gas/31115 Content-Language: en-US From: Tom de Vries To: Tom Tromey Cc: gdb-patches@sourceware.org, Thiago Jung Bauermann , Luis Machado References: <20240306155315.22240-1-tdevries@suse.de> <87r0glsvwz.fsf@tromey.com> <3c788bd8-df7d-418b-8042-167e3c3ae5d7@suse.de> In-Reply-To: <3c788bd8-df7d-418b-8042-167e3c3ae5d7@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.51 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-1.51 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; BAYES_HAM(-0.01)[50.97%]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from] X-Spam-Level: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=JXxl80Va; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BsBg0P46 X-Rspamd-Queue-Id: 021113760F X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 3/7/24 22:09, Tom de Vries wrote: > On 3/7/24 20:07, Tom Tromey wrote: >>>>>>> "Tom" == Tom de Vries writes: >> >> Tom> This is a regression due to PR gas/31115, which makes gas produce >> a low_pc >> Tom> with the thumb bit set (0x4d8 & 0x1): >> Tom> ... >> Tom>  <1><24>: Abbrev Number: 2 (DW_TAG_subprogram) >> Tom>     <25>   DW_AT_name        : main >> Tom>     <29>   DW_AT_external    : 1 >> Tom>     <29>   DW_AT_type        : <0x2f> >> Tom>     <2a>   DW_AT_low_pc      : 0x4d9 >> Tom>     <2e>   DW_AT_high_pc     : 12 >> Tom> ... >> >> Tom> The regression was introduced in 2.39, and is also present in >> 2.40 and 2.41, >> Tom> and hasn't been fixed yet. >> >> Tom> Work around this in read_func_scope, by using >> gdbarch_addr_bits_remove on >> Tom> low_pc and high_pc. >> >> Are there ever cases where this bit ought to be set here? >> > > I don't know.  The only information I have is that it never should be > the case for arm, which is info I got out of the PR. > > The target hook is present for other archs though (hppa, mips, rl78, > s390, sparc64), and I don't know what the requirements for those are. > > Which is why I limited the scope of the fix to the arm architecture. > > I also limited the scope of the fix to the known wrong producer, that > might not be necessary, it's just defensive programming. > >> Tom>    lowpc = per_objfile->relocate (unrel_low); >> Tom>    highpc = per_objfile->relocate (unrel_high); >> Tom> +  if (gdbarch_bfd_arch_info (gdbarch)->arch == bfd_arch_arm >> Tom> +      && producer_is_gas_ge_2_39 (cu)) >> Tom> +    { >> Tom> +      /* Gas version 2.39 produces DWARF for a Thumb subprogram >> with a low_pc >> Tom> +     attribute with the thumb bit set (PR gas/31115).  Work >> around this.  */ >> Tom> +      lowpc = gdbarch_addr_bits_remove (gdbarch, lowpc); >> Tom> +      highpc = gdbarch_addr_bits_remove (gdbarch, highpc); >> >> 'relocate' calls gdbarch_adjust_dwarf2_addr.  I wonder if that's a >> better approach. >> > > The only arch implementing that is mips, and looking at the > implementation, it filters out the ISA bit (bit 0) and then sets back it > if appropriate. > > Which is not the thing we want to be doing here for arm. > >> Right now there are a few gdbarch methods here and it's never been clear >> to me why they are different or when one should be used or not.  That >> is, there's also adjust_dwarf2_line, which is used in several other >> spots -- except dwarf_record_line_1 which for some reason calls >> gdbarch_addr_bits_remove. > > As for adjust_dwarf2_line, well, the mips implementation (its only > implementor) is a thin wrapper around adjust_dwarf2_addr that is > stateful.  To me this looks like a candidate for removal. > I'm planning to commit this tomorrow, any objects? Thanks, - Tom