From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id CD12B3857C65 for ; Fri, 8 Mar 2024 02:52:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CD12B3857C65 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 CD12B3857C65 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709866337; cv=none; b=FZot70H6MQ2YD89TUcCJf3L65dMz8wh0j2smwJnimoO1RDNveVD/YqZ3jcEOEzuT1e4igEA0LtUgGg1/YrzN5YvmTUloiLDIF4HWfQm3QeF3AMGPYK7q5taaaZS+V6xEV9UWsStxeM/aatYZUUyySl6oGPoHDgMy4XGGmRiG5lA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709866337; c=relaxed/simple; bh=pvHtRNdIKqrRR5xFxASTyeGHIb0VUUfMu5NfRHFZOSs=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=RGW1Gp4GlJ0/N0cv631eKTn9ooJEhxT04Ady7PGC0Lj5b/c5ywDOfWYfEm37TIW0kCBmCwafT9S1eJeUVbQYShAvEUiN9rPyknB1p1EIIBxn7Z57b3PLKSeol2T4K0ZvoYF5JMPB7rsWRAIjqUS1OjgihlETXGvZUublUoVAg3g= 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-out2.suse.de (Postfix) with ESMTPS id 5AE492025B; Thu, 7 Mar 2024 21:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709845724; 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=W5J9aFZ16sy1LaRnvgwGDNAJv3BZlud88kEvNPRTMXM=; b=Z0eS6T382qwIMD1oJQ1R8hQ0IlogpWHekOQmTVlIljPd+MRgynJP2z+ZBuVEYQZnwye+MM /b+82TTykqI51+zLGMcAJy9wVWVs8rCGOM9BSOosRaZgC+cLGU93l10A1TGjpmV+37qvi/ 8ApMAOkrbOQH/Pc2Pqb4EcXO0OFtVds= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709845724; 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=W5J9aFZ16sy1LaRnvgwGDNAJv3BZlud88kEvNPRTMXM=; b=Dr+LJq42g+Yiw/pY2zbI1Pufb2utiGrY+HZ5DKC3+2epC1wkEE6EFiKP9Se3Yh44WnwSmA WgJU45biym5yu5Dg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709845724; 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=W5J9aFZ16sy1LaRnvgwGDNAJv3BZlud88kEvNPRTMXM=; b=Z0eS6T382qwIMD1oJQ1R8hQ0IlogpWHekOQmTVlIljPd+MRgynJP2z+ZBuVEYQZnwye+MM /b+82TTykqI51+zLGMcAJy9wVWVs8rCGOM9BSOosRaZgC+cLGU93l10A1TGjpmV+37qvi/ 8ApMAOkrbOQH/Pc2Pqb4EcXO0OFtVds= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709845724; 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=W5J9aFZ16sy1LaRnvgwGDNAJv3BZlud88kEvNPRTMXM=; b=Dr+LJq42g+Yiw/pY2zbI1Pufb2utiGrY+HZ5DKC3+2epC1wkEE6EFiKP9Se3Yh44WnwSmA WgJU45biym5yu5Dg== 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 3B7AA136C7; Thu, 7 Mar 2024 21:08:44 +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 C0jvDNws6mXMOAAAD6G6ig (envelope-from ); Thu, 07 Mar 2024 21:08:44 +0000 Message-ID: <3c788bd8-df7d-418b-8042-167e3c3ae5d7@suse.de> Date: Thu, 7 Mar 2024 22:09:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/symtab] Workaround PR gas/31115 Content-Language: en-US To: Tom Tromey Cc: gdb-patches@sourceware.org, Thiago Jung Bauermann References: <20240306155315.22240-1-tdevries@suse.de> <87r0glsvwz.fsf@tromey.com> From: Tom de Vries In-Reply-To: <87r0glsvwz.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Level: Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Z0eS6T38; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Dr+LJq42 X-Spamd-Result: default: False [-2.53 / 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)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; URIBL_BLOCKED(0.00)[suse.de:email,suse.de:dkim]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; BAYES_HAM(-0.23)[72.53%]; 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:email,suse.de:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Score: -2.53 X-Rspamd-Queue-Id: 5AE492025B X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,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 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. Thanks, - Tom