From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90332 invoked by alias); 5 Nov 2015 14:15:31 -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 90314 invoked by uid 89); 5 Nov 2015 14:15:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 05 Nov 2015 14:15:24 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 6CB9536AA35 for ; Thu, 5 Nov 2015 14:15:23 +0000 (UTC) Received: from bigtime.twiddle.net (ovpn-116-101.ams2.redhat.com [10.36.116.101]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA5EFDhP002763; Thu, 5 Nov 2015 09:15:15 -0500 Subject: Re: [PATCH 0/3] Support for x86 segments as address classes To: Pedro Alves , gdb-patches@gcc.gnu.org References: <1446558190-13482-1-git-send-email-rth@redhat.com> <563B3BA3.3070402@redhat.com> From: Richard Henderson Message-ID: <563B646D.7000805@redhat.com> Date: Thu, 05 Nov 2015 14:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <563B3BA3.3070402@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00182.txt.bz2 On 11/05/2015 12:21 PM, Pedro Alves wrote: > On 11/03/2015 01:43 PM, Richard Henderson wrote: >> Which begs the question of whether I've simply missed >> something in how to get hold of the current regcache? > > get_current_frame / get_current_regcache ? If you can pass it down > through a couple layers, it's of course better. Duh, get_current_regcache, of course. Thanks. Which makes for a relatively easy patch to finish the support. However, IMO the results aren't ideal. Consider: int test(void) { int __seg_fs *f = (int __seg_fs *)16; int __seg_gs *g = (int __seg_gs *)16; return *f + *g; } int main() { test(); return 0; } Now, this really isn't a proper executable testcase, because I haven't set up gs_base, but since libc.so set up fs_base for the thread pointer, it's good enough to step into test() and examine some variables. Breakpoint 2, test () at z.c:10 10 return *f + *g; (gdb) ptype f type = int * @__seg_fs (gdb) ptype g type = int * @__seg_gs (gdb) info loc f = 0x7ffff7fd9710 g = 0x10 It seems to me that the "real" value of both f and g are 0x10. Instead, we display the converted value, displaying f with a surprising value. It seems to me that it would be better to do the conversion when we want to dereference, such as "print *f", but not otherwise. However, I'm not really sure how that would interact with the other users of address classes throughout gdb. r~