From patchwork Tue May 14 14:22:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arash Bakhtiari X-Patchwork-Id: 32676 Received: (qmail 12504 invoked by alias); 14 May 2019 14:23:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 12494 invoked by uid 89); 14 May 2019 14:23:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=H*r:LOCAL, lds, sk:printf_ X-HELO: mga07.intel.com Received: from mga07.intel.com (HELO mga07.intel.com) (134.134.136.100) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 14:23:27 +0000 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2019 07:23:25 -0700 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga008.fm.intel.com with ESMTP; 14 May 2019 07:23:24 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x4EENN00022632; Tue, 14 May 2019 15:23:23 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id x4EENNri032688; Tue, 14 May 2019 16:23:23 +0200 Received: (from abakhtia@localhost) by ulvlx001.iul.intel.com with LOCAL id x4EENNCT032684; Tue, 14 May 2019 16:23:23 +0200 From: Arash Bakhtiari To: gdb-patches@sourceware.org Cc: markus.t.metzger@intel.com, "Bakhtiari, Arash" Subject: [PATCH] record: Fix the error message for (E)VEX encoded instructions. Date: Tue, 14 May 2019 16:22:48 +0200 Message-Id: <1557843768-32341-1-git-send-email-arash.bakhtiari@intel.com> X-IsSubscribed: yes From: "Bakhtiari, Arash" The procedure to indentify the instructions in GDB "record full" misidentifies the VEX and EVEX encoded instructions with BOUND, LDS and LES instructions. Excerpts from gdb.log of "gdb.reverse/*.exp" tests. before: Process record does not support instruction 0x62 at address 0x7ffff7ded757. Process record: failed to record execution log. after: Process record does not support EVEX encoded instructions. Process record does not support instruction 0x62 at address 0x7ffff7ded757. Process record: failed to record execution log. gdb/ChangeLog: 2018-04-03 Arash Bakhtiari * i386-tdep.c (i386_process_record): Fix the error message for {E}VEX encoded instructions in GDB record full. --- gdb/i386-tdep.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 54d9dd873b8..67f23f365c1 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -5013,6 +5013,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache, struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); uint8_t rex_w = -1; uint8_t rex_r = 0; + const bool is_64bit = gdbarch_addr_bit (gdbarch) == 64; memset (&ir, 0, sizeof (struct i386_record_s)); ir.regcache = regcache; @@ -5894,8 +5895,20 @@ Do you want to stop the program?"), case 0xc4: /* les Gv */ case 0xc5: /* lds Gv */ + { + gdb_byte next_byte; + record_read_memory (gdbarch, ir.addr, &next_byte, 1); + /* Check if it's a VEX encoded instruction in 32/64-bit mode. */ + if (is_64bit || (next_byte & 0xc0) == 0xc0) + { + printf_unfiltered (_("Process record does not support " + "VEX encoded instructions.\n")); + ir.addr -= 1; + goto no_support; + } + } if (ir.regmap[X86_RECORD_R8_REGNUM]) - { + { ir.addr -= 1; goto no_support; } @@ -6841,8 +6854,17 @@ Do you want to stop the program?"), break; case 0x62: /* bound */ - printf_unfiltered (_("Process record does not support " - "instruction bound.\n")); + { + gdb_byte next_byte; + record_read_memory (gdbarch, ir.addr, &next_byte, 1); + /* Check if it's a EVEX encoded instruction in 32/64-bit mode. */ + if (is_64bit || (next_byte & 0xc0) == 0xc0) + printf_unfiltered (_("Process record does not support " + "EVEX encoded instructions.\n")); + else + printf_unfiltered (_("Process record does not support " + "instruction bound.\n")); + } ir.addr -= 1; goto no_support; break;