From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14893 invoked by alias); 9 Nov 2006 21:36:44 -0000 Received: (qmail 14884 invoked by uid 22791); 9 Nov 2006 21:36:43 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-vbr17.xs4all.nl (HELO smtp-vbr17.xs4all.nl) (194.109.24.37) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 09 Nov 2006 21:36:32 +0000 Received: from webmail.xs4all.nl (dovemail4.xs4all.nl [194.109.26.6]) by smtp-vbr17.xs4all.nl (8.13.8/8.13.8) with ESMTP id kA9LaTWV041081 for ; Thu, 9 Nov 2006 22:36:29 +0100 (CET) (envelope-from mark.kettenis@xs4all.nl) Received: from 82.92.89.47 (SquirrelMail authenticated user sibelius) by webmail.xs4all.nl with HTTP; Thu, 9 Nov 2006 22:36:29 +0100 (CET) Message-ID: <20030.82.92.89.47.1163108189.squirrel@webmail.xs4all.nl> In-Reply-To: <20061109205755.GA18755@nevyn.them.org> References: <20061109205755.GA18755@nevyn.them.org> Date: Thu, 09 Nov 2006 21:36:00 -0000 Subject: Re: [rfc] Autoselect x86_64 or i386 based on the remote g packet size From: "Mark Kettenis" To: gdb-patches@sourceware.org User-Agent: SquirrelMail/1.4.8 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00062.txt.bz2 > The operating principle is that a target is free to send back a "short" > g packet, but some sizes are plausible and others are not. So I > enhanced the i386 backend to register the sizes of likely register > sets: core registers, core + i387, core + i387 + SSE. The Linux > backend adds the %orig_eax and %orig_rax pseudo-"registers" too > (which, if I were inventing them today, might be target objects like > the sparc WCOOKIE, but are currently in the g packet). > > So if you have a GDB which defaults to i386-linux, and it connects to > an amd64 target and gets exactly the right number of bytes to be > a 64-bit register set, it'll assume that's what it's got. > > There's deliberately no mechanism to say "more than X bytes must be > amd64", > because I feel that's unsafe. The current registered guesses are > high-confidence, since e.g the amd64 guesses would be quite odd sizes for > an i386 target to return. For instance, the amd64 non-FP registers cut > off between fioff and foseg if interpreted as a 32-bit register set: not > very likely. > > All comments welcome! Tested on x86_64-pc-linux-gnu, using gdbserver for > the testsuite and by hand. Hi Daniel, I can't say I'm very enthousiastic about this patch. It feels like a kludge to avoid adding proper support to the remote protocol that allows gdb to interrogate the target about this. A very clever kludge, but still a kludge. Mark