Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFA] Allow Windows UNWIND_INFO version 2.
Date: Tue, 03 Dec 2013 11:32:00 -0000	[thread overview]
Message-ID: <1386070345-8237-1-git-send-email-brobecker@adacore.com> (raw)

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  <gingold@adacore.com>)
	(from Joel Brobecker  <brobecker@adacore.com>)
	* 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


             reply	other threads:[~2013-12-03 11:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 11:32 Joel Brobecker [this message]
2013-12-03 18:47 ` Pedro Alves
2013-12-03 19:58   ` Corinna Vinschen
2013-12-03 20:04     ` Corinna Vinschen
2013-12-04  8:40     ` Tristan Gingold
2013-12-04  8:43   ` Tristan Gingold
2013-12-05  3:45   ` Joel Brobecker
2013-12-09 10:43     ` Corinna Vinschen
2013-12-09 11:47       ` Tristan Gingold
2013-12-09 12:11         ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386070345-8237-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox