From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32008 invoked by alias); 3 Dec 2013 11:32:39 -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 31999 invoked by uid 89); 3 Dec 2013 11:32:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from Unknown (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 03 Dec 2013 11:32:38 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 41D81116646 for ; Tue, 3 Dec 2013 06:33:08 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id T0VVPRQ4JKrs for ; Tue, 3 Dec 2013 06:33:08 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id CAFBF1165BA for ; Tue, 3 Dec 2013 06:33:07 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 2FCE9E081D; Tue, 3 Dec 2013 15:32:27 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA] Allow Windows UNWIND_INFO version 2. Date: Tue, 03 Dec 2013 11:32:00 -0000 Message-Id: <1386070345-8237-1-git-send-email-brobecker@adacore.com> X-SW-Source: 2013-12/txt/msg00074.txt.bz2 We've observed in Windows 2012 that ntdll.dll contains some unwind records with the version field set to 2. This patch adjusts the decoder to accept records flagged with this version as well. Version 2 appears to still be largely undocumented at this stage. However, appart from a mysterious opcode 6, everything else still seems to remain the same. So this patch also changes the decoder to ignore those opcodes; before this change, the debugger would silently stop the decoding, and let the frame unwinder make do with what it the decoder managed to decode up to that point. It's unclear at this point what we're losing by not being able to decode that opcode. But the information does not appear to be critical, at least as far as call unwinding is concerned. gdb/ChangeLog: (from Tristan Gingold ) (from Joel Brobecker ) * amd64-windows-tdep.c (amd64_windows_frame_decode_insns): Accept version 2. Ignore operations using opcode 6. Tested on all x64 versions of Windows available at AdaCore (from XP to 2012). OK to commit? Thank you, -- Joel --- gdb/amd64-windows-tdep.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index 359173a..6891e16 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -649,7 +649,8 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame, ex_ui.CountOfCodes, ex_ui.FrameRegisterOffset); /* Check version. */ - if (PEX64_UWI_VERSION (ex_ui.Version_Flags) != 1) + if (PEX64_UWI_VERSION (ex_ui.Version_Flags) != 1 + && PEX64_UWI_VERSION (ex_ui.Version_Flags) != 2) return; if (j == 0 @@ -696,7 +697,17 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame, return; end_insns = &insns[codes_count * 2]; - for (p = insns; p < end_insns; p += 2) + p = insns; + + /* Skip opcodes 6 of version 2. This opcode is not documented. */ + if (PEX64_UWI_VERSION (ex_ui.Version_Flags) == 2) + { + for (; p < end_insns; p += 2) + if (PEX64_UNWCODE_CODE (p[1]) != 6) + break; + } + + for (; p < end_insns; p += 2) { int reg; -- 1.8.1.2