From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27505 invoked by alias); 2 May 2012 20:45:02 -0000 Received: (qmail 27436 invoked by uid 22791); 2 May 2012 20:45:00 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 May 2012 20:44:47 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id q42KiTR7008948; Wed, 2 May 2012 22:44:29 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id q42KiQLc021611; Wed, 2 May 2012 22:44:26 +0200 (CEST) Date: Wed, 02 May 2012 20:45:00 -0000 Message-Id: <201205022044.q42KiQLc021611@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: brobecker@adacore.com CC: gdb-patches@sourceware.org In-reply-to: <20120502175724.GW10958@adacore.com> (message from Joel Brobecker on Wed, 2 May 2012 10:57:24 -0700) Subject: Re: Invalid segment resister value on x86_64-windows References: <1335913461-1628-1-git-send-email-brobecker@adacore.com> <201205021009.q42A9G4s021744@glazunov.sibelius.xs4all.nl> <20120502175724.GW10958@adacore.com> 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 X-SW-Source: 2012-05/txt/msg00031.txt.bz2 > Date: Wed, 2 May 2012 10:57:24 -0700 > From: Joel Brobecker > > > I'm not sure we can make those changes. The default layout for the > > registers in the target description is chosen such that it is > > compatible with the "old" register cache layout used for stubs that > > didn't provide a target description. That layout is still extensively > > used by kernel stubs such as the ones in the Linux and NetBSD kernels. > > I don't think breaking those would be acceptable, as kernel debugging > > is where the segment registers actually matter! > > That's something I was concerned about. Here is another approach, which > adds special handling for those registers for Windows. The issue was > that the same code was used for both 32bit and 64bit Windows, so > I needed to extend the tdep structure to be able to determine whether > register N was a segment register or not. > > Does the attached patch look good to you? Hmm, it should be possible to do this without changing any of the -tdep.c code, but if you prefer to do it this way, can you rename the new field into cs_regnum, change the comment into "Register number for %cs", and move it somewhere around the other _regnum variables that are already part of the struct? That makes things a bit more consistent. > gdb/ChangeLog: > > * i386-tdep.h (struct gdbarch_tdep): New field > `first_segment_regnum'. > * amd64-tdep.c (amd64_init_abi): Set tdep->first_segment_regnum. > * i386-tdep.c (i386_gdbarch_init): Likewise. > * windows-nat.c (do_windows_fetch_inferior_registers): Only > read the first 16 bits of segment register values.