From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113229 invoked by alias); 10 May 2017 16:19:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 113186 invoked by uid 89); 10 May 2017 16:19:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=H*Ad:U*macro, dsp, cheri, rozycki X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 May 2017 16:19:46 +0000 Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id D4ACB10A82D; Wed, 10 May 2017 12:19:47 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org Cc: "Maciej W. Rozycki" , Yao Qi Subject: Re: [PATCH] Move initialize_tdesc_mips* calls from mips-linux-nat.c to mips-linux-tdep.c Date: Wed, 10 May 2017 16:19:00 -0000 Message-ID: <3174656.5xSoUNdgyV@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <1494324439-15918-1-git-send-email-yao.qi@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00281.txt.bz2 On Wednesday, May 10, 2017 12:51:59 PM Maciej W. Rozycki wrote: > On Tue, 9 May 2017, Yao Qi wrote: > > > Target description initialization should be called in -tdep.c, instead of > > -nat.c. Rebuild mips-linux native GDB. Regression test is not run. > > Why? These descriptions are only used in the native case, otherwise > gdbserver supplies its own. The current arrangement has worked for some > 12 years now. Target descriptions (in general) might be determined purely by a core dump's contents. For example, in my out-of-tree patches for CHERI MIPS I added target descriptions for the CHERI capability registers and then use those target descriptions instead of the default for FreeBSD/mips core dumps that contain a special "capregs" note (this is implemented via a gdbarch "core_read_description" method). For native binaries I depend on a working ptrace op to determine if the native CPU supports the registers via the "read_description" target method. If core dumps of Linux binaries on processors with DSP registers included those registers in process cores then you would need a similar method for the Linux MIPS gdbarch that worked similar to mips_linux_read_description to select the appropriate target description for process cores. Another example of target descriptions used this way is on i386/amd64 for both Linux and FreeBSD which use the register note with XSAVE registers (and it's embedded value of %xcr0) to decide which target description to use for plain SSE vs AVX vs MPX, etc. Again, these checks are performed both in the native target "read_description" method for live processes and in the gdbarch "core_read_description" method for cores. My guess is that Yao is just fixing this to follow the general rule that target descriptions belong to the 'tdep' layer so that they can be used by gdbarch "core_read_description" methods. -- John Baldwin