From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id C3B503858414 for ; Fri, 10 Feb 2023 17:01:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3B503858414 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4PD0PQ0K74z3fLn; Fri, 10 Feb 2023 17:01:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PD0PP6hr1z4lFB; Fri, 10 Feb 2023 17:01:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676048473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ziRTJZrSxgjFA6mQBQCeNym8op2jioVIhUNwWCRG/EY=; b=nGhf2OtboVUzP7lC/tL80ihWr3rhNnxqoKaFSrt/6sWtPQKQHLf3V9dQvJ7UxPaZNQ+VFX skyKR/GSYdQMAYwC1lTmHG5AZ0BEmuu2PDYN1w/IUXvmkAvcZKgggGnimXw79CaYBgG0Gp ld4AEJ2DQNLXt8TuAQe2j2tRawTVuP+hUu5Lgr3+pAjrSmgkUR5fTol9UyHOEt+K6Z373j VUjIhHvq6EO8cS2hVA0Eg9SMYrJJRbeHKE/hGkfpUwnto1oyLeL6rYy3ONMcmOltD2oHnp x2vPKB/PFsKAQ1wfxVXtMFDccr83cO6diQ59XZ5unQGnClKZTNuv7saNJOEAUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676048473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ziRTJZrSxgjFA6mQBQCeNym8op2jioVIhUNwWCRG/EY=; b=yQDbLiTWCkhf5fXyLpUZHujcbT1dJtamisN1MqgfUfzXAg4DNxj3YN1HyedWRzOK1UzZQA kVlSwY7WPTBhfAXXOxNF1zO0EvmA74nX8CYYFDFl0BQYm7w1Ett9bU1zKwx/T+2zNTCUCT Tm0eH5rNEznkc/tS821JYoTyH5BLACpnUwAHEiUbaTC8SbAbh8GT+TvUHtdoHPzz7Cbe9e vN716mDc+Ath1rfrKbMrhQ+ddW7hO3uxoqbeBkYihRGGsfnI+lSqVdCPisI27/OWv9MVrq ToRqMIiFMiOGS5I40Z0I3mmLpovNeKyLpImnDivxPAQk0O/LyFlfW/X37cMB0Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676048473; a=rsa-sha256; cv=none; b=UDmM1gBdSZ08z50KP0uQBIBdcSl1riNkX7ArNjwUIg4ka1BhySHZ0+hUgMX6j8dYI9aPHX Gt51yVsifVPL4Ht1DU299nd7RlVHbrP9bcgiZSxxtyoCHkiltxfNaawSK8vsgl0cdoU1G0 D9vWBP6YNYVRMetcR4HKHJfmBYt0ynVdOQYy4ZWXga8oC4uqgfk49mdQJ5xMjWHE+GDmNv Jh2fH6AHu7pliGgvDlDI/6ehSEAqEXToZs+d1Br7TzL6hKVxREE92kAIXj3n4fziSVjLPS kAlzEwUFA7oqbKYckK49q+egxRHIGNRJZaRFTuD1CtA91DPsjEJOK/OGF4OEAQ== Received: from [IPV6:2601:642:4c00:42e2:18b0:6597:da2a:8958] (unknown [IPv6:2601:642:4c00:42e2:18b0:6597:da2a:8958]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PD0PP3mhjzvC1; Fri, 10 Feb 2023 17:01:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <6387593e-e17c-a951-8346-0ba0cd7817f9@FreeBSD.org> Date: Fri, 10 Feb 2023 09:01:12 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Content-Language: en-US To: Tom de Vries , gdb-patches@sourceware.org References: <20230210125602.20437-1-tdevries@suse.de> From: John Baldwin Subject: Re: [PATCH] [gdb/tdep] Don't use i386 unwinder for amd64 In-Reply-To: <20230210125602.20437-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham 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 2/10/23 4:56 AM, Tom de Vries via Gdb-patches wrote: > For i386 we have these unwinders: > ... > $ gdb -q -batch -ex "set arch i386" -ex "maint info frame-unwinders" > The target architecture is set to "i386". > dummy DUMMY_FRAME > dwarf2 tailcall TAILCALL_FRAME > inline INLINE_FRAME > i386 epilogue NORMAL_FRAME > dwarf2 NORMAL_FRAME > dwarf2 signal SIGTRAMP_FRAME > i386 stack tramp NORMAL_FRAME > i386 sigtramp SIGTRAMP_FRAME > i386 prologue NORMAL_FRAME > ... > and for amd64: > ... > $ gdb -q -batch -ex "set arch i386:x86-64" -ex "maint info frame-unwinders" > The target architecture is set to "i386:x86-64". > dummy DUMMY_FRAME > dwarf2 tailcall TAILCALL_FRAME > inline INLINE_FRAME > python NORMAL_FRAME > amd64 epilogue NORMAL_FRAME > i386 epilogue NORMAL_FRAME > dwarf2 NORMAL_FRAME > dwarf2 signal SIGTRAMP_FRAME > amd64 sigtramp SIGTRAMP_FRAME > amd64 prologue NORMAL_FRAME > i386 stack tramp NORMAL_FRAME > i386 sigtramp SIGTRAMP_FRAME > i386 prologue NORMAL_FRAME > ... > > ISTM me there's no reason for the i386 unwinders to be there for amd64. > > Furthermore, there's a generic need to play around with enabling and disabling > unwinders, see PR8434. Currently, that's only available for both the > dwarf2 unwinders at once using "maint set dwarf unwinders on/off". > > If I manually disable the "amd64 epilogue" unwinder, the "i386 epilogue" > unwinder becomes active and gives the wrong answer, while I'm actually > interested in the result of the dwarf2 unwinder. Of course I can also > manually disable the "i386 epilogue", but I take the fact that I have to do > that as evidence that on amd64, the "i386 epilogue" is not only unnecessary, > but in the way. > > Fix this by only adding the i386 unwinders only if > "info.bfd_arch_info->bits_per_word == 32". > > Note that for the x32 abi (x86_64/-mx32) the unwinder list is the same as for > amd64 (x86_64/-m64), without and with this commit. > > Tested on x86_64-linux, -m64 and -m32. Not tested with -mx32. I strongly suspect you don't want these unwinders for x32 either. I don't know what bits_per_word is for x32. If it is 32 then you at least aren't changing anything for x32. If it is 64 then I think your change is correct. You might consider checking 'tdep->num_dword_regs == 0' instead if you want to enable these for i386-only and exclude x32. (IIRC, x32 is encoded in ELF as EM_X86_64 but with ELFCLASS32 or the like which would mean x32 would have bits_per_word of 32 I think). LGTM as-is or if you decide to test num_dword_regs == 0 instead. -- John Baldwin