From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102726 invoked by alias); 10 Feb 2016 14:12:18 -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 102700 invoked by uid 89); 10 Feb 2016 14:12:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=laid, doug, evans, Evans 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; Wed, 10 Feb 2016 14:12:16 +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 ED9EB3FEBC; Wed, 10 Feb 2016 15:13:03 +0100 (CET) Received: by hogfather.0x04.net (Postfix, from userid 1000) id 0CD3F580092; Wed, 10 Feb 2016 15:12:13 +0100 (CET) From: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= To: palves@redhat.com Cc: gdb-patches@sourceware.org, =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= Subject: [PATCH] gdb.trace: Use g packet order in tfile_fetch_registers. Date: Wed, 10 Feb 2016 14:12:00 -0000 Message-Id: <1455113532-24235-1-git-send-email-koriakin@0x04.net> In-Reply-To: <56BB4101.5050902@redhat.com> References: <56BB4101.5050902@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00289.txt.bz2 tfile_fetch_registers currently wrongly fetches registers using gdb order instead of g packet order. On x86_64 with AVX, this causes problems with ymm*h and orig_rax registers: gdb has ymm*h first, while g packet has orig_rax first. gdb/ChangeLog: * tracefile-tfile.c (tfile_fetch_registers): Use g packet order instead of gdb order. gdb/doc/ChangeLog: * gdb.texinfo (Trace File Format): Remove misleading information about register block ordering. --- Removed misleading documentation bit. OK to push now? gdb/ChangeLog | 5 +++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 3 +-- gdb/tracefile-tfile.c | 11 ++++++----- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0454696..fd7dd9d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2016-02-10 Marcin Kościelnicki + * tracefile-tfile.c (tfile_fetch_registers): Use g packet order + instead of gdb order. + +2016-02-10 Marcin Kościelnicki + * tracefile-tfile.c (trace_tdesc): New static variable. (trace_tdesc_alloc): New static variable. (trace_tdesc_len): New static variable. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 05d2694..75b24ef 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2016-02-10 Marcin Kościelnicki + + * gdb.texinfo (Trace File Format): Remove misleading information + about register block ordering. + 2016-02-01 Doug Evans * gdb.texinfo (Value Sizes): Fix typo. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 2d09d13..9db234e 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -41048,8 +41048,7 @@ endianness. @item R @var{bytes} Register block. The number and ordering of bytes matches that of a @code{g} packet in the remote protocol. Note that these are the -actual bytes, in target order and @value{GDBN} register order, not a -hexadecimal encoding. +actual bytes, in target order, not a hexadecimal encoding. @item M @var{address} @var{length} @var{bytes}... Memory block. This is a contiguous block of memory, at the 8-byte diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 139d90a..a6c3c9c 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -30,6 +30,7 @@ #include "filenames.h" #include "xml-tdesc.h" #include "target-descriptions.h" +#include "remote.h" #ifndef O_LARGEFILE #define O_LARGEFILE 0 @@ -857,7 +858,7 @@ tfile_fetch_registers (struct target_ops *ops, struct regcache *regcache, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); - int offset, regn, regsize; + int offset, regn, regsize, dummy; /* An uninitialized reg size says we're not going to be successful at getting register blocks. */ @@ -870,11 +871,12 @@ tfile_fetch_registers (struct target_ops *ops, tfile_read (regs, trace_regblock_size); - /* Assume the block is laid out in GDB register number order, - each register with the size that it has in GDB. */ - offset = 0; for (regn = 0; regn < gdbarch_num_regs (gdbarch); regn++) { + if (!remote_register_number_and_offset (get_regcache_arch (regcache), + regn, &dummy, &offset)) + continue; + regsize = register_size (gdbarch, regn); /* Make sure we stay within block bounds. */ if (offset + regsize > trace_regblock_size) @@ -891,7 +893,6 @@ tfile_fetch_registers (struct target_ops *ops, regcache_raw_supply (regcache, regn, regs + offset); } } - offset += regsize; } } else -- 2.7.0