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 8F6F93858C98 for ; Tue, 27 Feb 2024 23:15:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F6F93858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8F6F93858C98 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2610:1c1:1:606c::19:2 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709075725; cv=pass; b=FTcLjOaPmuTzbOolS1uK/aezFtlvcDcXWdYYcvye1CUvdMjQ3UxoAcqlGDhNCHCkHLguUn66cNmnjjHZpOMiV25PKGc/A7LrACkFO4z9GcN4Iya/PcquP5tYUbNaTkw40AP3Ch/wSgjrR7c3MJfWkW8IP4h4PxmChMASjzl+gfk= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709075725; c=relaxed/simple; bh=ES/t5Xl8//I5pT5xlLYTUy/JdRP70LJxbZ3x0db4AC4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=KuQMNUgCpBtLy5b8PEgJ1oXUD7tQ5vxk+JnGTnUr4ZhSQdEPenIJlL96S28FF+P3jy7gEpj8JCKMegSpz0lvrXDjoayGwQo4SWuvEEqcBJpBQFWIMbgHJN3IZYEVOP4QoeZmcuXqsizTl6zHlWih2do8Mg69+Ppdk7cPX5oDFao= ARC-Authentication-Results: i=2; server2.sourceware.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 4Tktcq2mQWz3nN0; Tue, 27 Feb 2024 23:15:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4Tktcq1dM1z4NxF; Tue, 27 Feb 2024 23:15:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709075723; h=from:from:reply-to:subject:subject: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=mlkaQ6QHZMaS8pClZoy6oAN4/m3CcT/zWqsF8eMCzHM=; b=ofV/GE80mNFL7+1BzCAp3lPTjswUnmw5fB2yFnXz5gaqUFpjtAUSuZkh3+pm7OTu0DeisD OCS7RUss9W7K9UwVXcMGTLCQZDFb8I6Syzk+zZx7JFkIPIsfuKpOXygyQ0eYLXbXCkRl/P UPsIaJ3Df4gfnWlKdl+rgHxlMsJW65LR+x7t+ublmglsGsMLhUmHFaqRQ7CB4fWa6mdkQS cIWcVxXGMBF7SIVPPDjuGstSmxKX5djEZsJvz9PpHXWYQlZF8hJWi0mm6ct5RIKmBzSOFR 6D0vFIfyqaXuo0NV5ELjf58Meh+RR4gM0t/2u7MY/ewUPUSUPuOz2TvoV46U7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709075723; a=rsa-sha256; cv=none; b=jfLVQcm4bQrs7UmlhjCzi9v5TrV3xiCgk0MaDEyS6PoNfa0EBK/RQexE92x8NFjI4TfHEn ICoZWRaiyLOKjMllGRmcvr2lGPJ3R+0SYDsJ6IBlZ183hWmU4FUXrJZHAdPP5Im9NbGC7X h/fXzaVEc2oYX1OEH6z9lHGWT9a/dX6X7BGRFtyMUbrL19RnWEnHOyuj5KV6uY6kDKZn9y Lvgt31nRykuN+IkGtbtlAZ8njlkVvRirdgN02JE6PhywZHoqiONVQhbF9G/b8oVIrROUUm WXjQQN7ic9Cv6Q+hYwj5f91rI4E4B3IfUtpf4MrNQj/eKouhjNzHwun+PQR3vw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709075723; h=from:from:reply-to:subject:subject: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=mlkaQ6QHZMaS8pClZoy6oAN4/m3CcT/zWqsF8eMCzHM=; b=SCn1n5OliDYLrUreohZ4cikrWiev3K0w/MSlivgFv5spLXZEE5rxfIGA/2B1vS7Fv8vF+J Wpo3ROI8822TiR7rkURTedd9fKt3tvAk4KtZris6o0saJC46RCcmvGhWlHd2CHBKH63/i9 dkdPuy2r5tk1Dh/eyKPWEQsvovAzslsk/9PkoqKlZ/h9hlCXekDbf920/b2VGDCwME2hNK fa3DAGmDDkK/1ecxS0RMJntM+znMnyHdw5+E9oo8WNDClNy0zcLetygsLr1VgmV6Ixsghr nKAR4XtKf6rkDdml/dcGG9C2CJE9mZWN/fQhpNHi+n+1kEifDPOb9xEysDtGoA== Received: from [128.232.109.25] (user-109-25.vpn.cl.cam.ac.uk [128.232.109.25]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Tktcn4ptpzc07; Tue, 27 Feb 2024 23:15:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Tue, 27 Feb 2024 15:15:18 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] Port GDB to Hurd x86_64. Content-Language: en-US To: Flavio Cruz , gdb-patches@sourceware.org Cc: bug-hurd@gnu.org, samuel.thibault@gnu.org, simark@simark.ca References: <5bba5e9a-2834-4cd1-9618-0c8805cfc692@FreeBSD.org> <20240224052832.3051313-1-flaviocruz@gmail.com> From: John Baldwin In-Reply-To: <20240224052832.3051313-1-flaviocruz@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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/23/24 9:28 PM, Flavio Cruz wrote: > This port extends the existing i686 port to support x86_64 by trying to > reuse existing code whenever it makes sense. > > * gdb/amd64-gnu-tdep.c: Adds logic for handling signal frames and > position of amd64 registers in the different Hurd structs. > The signal code is very similar to i686, except the trampoline code > is adapted. > * gdb/config/i386/nm-i386gnu.h: renamed to gdb/config/i386/nm-x86-gnu.h > and adapt it for x86_64. > * gdb/config/i386/i386gnu.mn: renamed to gdb/config/i386/nm-x86-gnu.mn > and reuse it for x86_64. > * gdb/configure.host: recognize gnu64 as a host. > * gdb/configure.nat: recognize gnu64 host and update existing i386gnu to > reuse the new shared files. > * gdb/configure.tgt: recognize x86_64-*-gnu* triplet and use > amd64-gnu-tdep.c. > * gdb/i386-gnu-tdep.c: added i386_gnu_thread_state_reg_offset that is > copied from i386-gnu-nat.c. This makes it similar to amd64. > * gdb/i386-gnu-nat.c: rename it to x86-gnu-nat.c since we reuse this for > i386 and amd64. Updated REG_ADDR to use one of the structures. Added > VALID_REGISTER to make sure it's a register we can provide at this time > (not all of them are available in amd64). FLAGS_REGISTER is either rfl > or efl depending on the arch. Renamed functions and class from i386 to x86 > whenever they can be reused. > > Tested on Hurd x86_64 and i686. > --- > > I addressed John's comments and moved amd64_gnu_thread_state_* and > i386_gnu_thread_state_* to x86-gnu-nat.c. The new patch also contains a few > changes that makes backtracing through shared libraries work. Thanks, this generally looks ok to me. One question I have is if you need nat/x86-xstate.o for the native Hurd x86_64 target? The i686 target doesn't use it and I didn't see any references in the patches to XSAVE support, so I suspect you don't need it. Were you getting a link error without it, or is it something you copied from Linux x86_64? If the latter, it is probably best to drop it for now until you add XSAVE support in the future (which would presumably apply to both i686 and x86_64). Reviewed-By: John Baldwin -- John Baldwin