From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62207 invoked by alias); 12 Feb 2016 15:54:30 -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 62189 invoked by uid 89); 12 Feb 2016 15:54:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=wholesale, quantities, Hx-languages-length:3049, agent X-HELO: xyzzy.0x04.net Received: from xyzzy.0x04.net (HELO xyzzy.0x04.net) (109.74.193.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Feb 2016 15:54:27 +0000 Received: from hogfather.0x04.net (89-65-66-135.dynamic.chello.pl [89.65.66.135]) by xyzzy.0x04.net (Postfix) with ESMTPS id 91F393FE6A; Fri, 12 Feb 2016 16:55:15 +0100 (CET) Received: from [192.168.13.108] (89-65-66-135.dynamic.chello.pl [89.65.66.135]) by hogfather.0x04.net (Postfix) with ESMTPSA id 0D86358008C; Fri, 12 Feb 2016 16:54:25 +0100 (CET) Subject: Re: [PATCH 3/4] Enable tracing of pseudo-registers on ARM To: Yao Qi , Antoine Tremblay References: <1452188697-23870-1-git-send-email-antoine.tremblay@ericsson.com> <1452188697-23870-4-git-send-email-antoine.tremblay@ericsson.com> <86egcineq0.fsf@gmail.com> Cc: gdb-patches@sourceware.org From: =?UTF-8?Q?Marcin_Ko=c5=9bcielnicki?= Message-ID: <56BE002F.7050305@0x04.net> Date: Fri, 12 Feb 2016 15:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <86egcineq0.fsf@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00414.txt.bz2 On 12/02/16 16:13, Yao Qi wrote: > Antoine Tremblay writes: > >> +/* Map the pseudo register number REG to the proper register number. */ >> + >> +static int >> +arm_pseudo_register_to_register (struct gdbarch *gdbarch, int reg) >> +{ >> + int rawnum = 0; >> + int num_regs = gdbarch_num_regs (gdbarch); >> + >> + /* Single precision pseudo registers. s0-s31. */ >> + if (reg >= num_regs && reg < num_regs + 32) >> + { >> + rawnum = (reg - num_regs) / 2 + 26; > > We should get double register number via user_reg_map_name_to_regnum, > > xsnprintf (name_buf, sizeof (name_buf), "d%d", (reg - num_regs) / 2); > double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf, > strlen (name_buf)); > . >> + } >> + /* Quadruple precision pseudo regisers. q0-q15. */ >> + else if (reg >= num_regs + 32 && reg < num_regs + 32 + 16) >> + { >> + rawnum = (reg - num_regs - 32) * 2 + 26; > > Likewise, > > xsnprintf (name_buf, sizeof (name_buf), "d%d", (reg - num_regs) * 2); > double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf, > strlen (name_buf)); > > additionally, we need to check gdbarch_tdep (gdbarch)->have_neon_pseudos, > >> + } >> + /* Error bad register number. */ >> + else >> + return -1; >> + >> + return rawnum; >> +} > > We also need a test case, and you can extend gdb.trace/tfile-avx.exp. > Probably, it can be renamed to gdb.trace/tracefile-pseudo-reg.exp, and > put x86 and arm tests in it. > I'd like to point out that this testcase is near-useless for testing ax_pseudo_register_collect or pseudo_register_to_register at the moment - while gdb computes a mask of what registers need to be collected, gdbserver just ignores it and collects all registers if any register at all is to be collected. In turn, gdb allows you to display the state of all registers, even ones not included in the mask. In fact, the tfile-avx.exp test passes just fine if you change it to collect any unrelated register. My commit with ax_pseudo_register_collect only made it work because gdb needs to have that function return success, the actual returned mask could just as well be wrong... The other hook, pseudo_register_push_stack, is much easier to test - it's invoked when a pseudo is used in an actual agent expression, eg. if you use it in a tracepoint condition, or as part of the address of collected memory area. However, it cannot be used on SIMD registers (at least on x86, I don't know much about arm), as they don't fit in an ULONGEST... Matter of fact, our support for >64-bit quantities in tracepoints is very poor at the moment - they can only be collected wholesale when they're single registers or contig memory areas. Use in expressions is out (if you happen to have something interesting in low 32 bits of a vector reg, sorry). Likewise, stiching them together with DW_op_piece (or whatever that was called) also fails (see https://sourceware.org/bugzilla/show_bug.cgi?id=17015). We could definitely use some improvement there...