From 1a1890a52aaf8bfbea34a8d918423e6c81f3ea80 Mon Sep 17 00:00:00 2001 From: "ted.mielczarek" Date: Tue, 30 Aug 2011 22:22:08 +0000 Subject: Adjust MD_CONTEXT_CPU_MASK to reflect reality, fix some code so it can handle dumps using the old value for MD_CONTEXT_ARM The value of MD_CONTEXT_CPU_MASK in use assumes that only the lower 6 bits are used for flags, and the upper 26 bits are for the CPU type. However, as of Windows 7 SP1, the 7th bit is being used as a flag (per http://msdn.microsoft.com/en-us/library/hh134238%28v=vs.85%29.aspx and the Windows SDK headers). Adjusting MD_CONTEXT_CPU_MASK works, but unfortunately that masks off the existing value of MD_CONTEXT_ARM. This patch also changes the value of MD_CONTEXT_ARM and adjusts the minidump context reading machinery to gracefully handle minidumps with the old value. R=mark at http://breakpad.appspot.com/302001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@831 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/google_breakpad/common/minidump_cpu_amd64.h | 8 ++++++-- src/google_breakpad/common/minidump_cpu_arm.h | 10 ++++++++++ src/google_breakpad/common/minidump_cpu_x86.h | 6 ++++-- src/google_breakpad/common/minidump_format.h | 9 +++++---- 4 files changed, 25 insertions(+), 8 deletions(-) (limited to 'src/google_breakpad/common') diff --git a/src/google_breakpad/common/minidump_cpu_amd64.h b/src/google_breakpad/common/minidump_cpu_amd64.h index 75dae7dd..fa6a9961 100644 --- a/src/google_breakpad/common/minidump_cpu_amd64.h +++ b/src/google_breakpad/common/minidump_cpu_amd64.h @@ -201,8 +201,9 @@ typedef struct { } MDRawContextAMD64; /* CONTEXT */ /* For (MDRawContextAMD64).context_flags. These values indicate the type of - * context stored in the structure. The high 26 bits identify the CPU, the - * low 6 bits identify the type of context saved. */ + * context stored in the structure. The high 24 bits identify the CPU, the + * low 8 bits identify the type of context saved. */ +#define MD_CONTEXT_AMD64 0x00100000 /* CONTEXT_AMD64 */ #define MD_CONTEXT_AMD64_CONTROL (MD_CONTEXT_AMD64 | 0x00000001) /* CONTEXT_CONTROL */ #define MD_CONTEXT_AMD64_INTEGER (MD_CONTEXT_AMD64 | 0x00000002) @@ -213,6 +214,9 @@ typedef struct { /* CONTEXT_FLOATING_POINT */ #define MD_CONTEXT_AMD64_DEBUG_REGISTERS (MD_CONTEXT_AMD64 | 0x00000010) /* CONTEXT_DEBUG_REGISTERS */ +#define MD_CONTEXT_AMD64_XSTATE (MD_CONTEXT_AMD64 | 0x00000040) + /* CONTEXT_XSTATE */ + /* WinNT.h refers to CONTEXT_MMX_REGISTERS but doesn't appear to define it * I think it really means CONTEXT_FLOATING_POINT. */ diff --git a/src/google_breakpad/common/minidump_cpu_arm.h b/src/google_breakpad/common/minidump_cpu_arm.h index 14d81460..aa1c88f5 100644 --- a/src/google_breakpad/common/minidump_cpu_arm.h +++ b/src/google_breakpad/common/minidump_cpu_arm.h @@ -128,6 +128,16 @@ enum MDARMRegisterNumbers { /* For (MDRawContextARM).context_flags. These values indicate the type of * context stored in the structure. */ +/* CONTEXT_ARM from the Windows CE 5.0 SDK. This value isn't correct + * because this bit can be used for flags. Presumably this value was + * never actually used in minidumps, but only in "CEDumps" which + * are a whole parallel minidump file format for Windows CE. + * Therefore, Breakpad defines its own value for ARM CPUs. + */ +#define MD_CONTEXT_ARM_OLD 0x00000040 +/* This value was chosen to avoid likely conflicts with MD_CONTEXT_* + * for other CPUs. */ +#define MD_CONTEXT_ARM 0x40000000 #define MD_CONTEXT_ARM_INTEGER (MD_CONTEXT_ARM | 0x00000002) #define MD_CONTEXT_ARM_FLOATING_POINT (MD_CONTEXT_ARM | 0x00000004) diff --git a/src/google_breakpad/common/minidump_cpu_x86.h b/src/google_breakpad/common/minidump_cpu_x86.h index 4dbc0e9a..32aff8a7 100644 --- a/src/google_breakpad/common/minidump_cpu_x86.h +++ b/src/google_breakpad/common/minidump_cpu_x86.h @@ -141,8 +141,8 @@ typedef struct { } MDRawContextX86; /* CONTEXT */ /* For (MDRawContextX86).context_flags. These values indicate the type of - * context stored in the structure. The high 26 bits identify the CPU, the - * low 6 bits identify the type of context saved. */ + * context stored in the structure. The high 24 bits identify the CPU, the + * low 8 bits identify the type of context saved. */ #define MD_CONTEXT_X86 0x00010000 /* CONTEXT_i386, CONTEXT_i486: identifies CPU */ #define MD_CONTEXT_X86_CONTROL (MD_CONTEXT_X86 | 0x00000001) @@ -157,6 +157,8 @@ typedef struct { /* CONTEXT_DEBUG_REGISTERS */ #define MD_CONTEXT_X86_EXTENDED_REGISTERS (MD_CONTEXT_X86 | 0x00000020) /* CONTEXT_EXTENDED_REGISTERS */ +#define MD_CONTEXT_X86_XSTATE (MD_CONTEXT_X86 | 0x00000040) + /* CONTEXT_XSTATE */ #define MD_CONTEXT_X86_FULL (MD_CONTEXT_X86_CONTROL | \ MD_CONTEXT_X86_INTEGER | \ diff --git a/src/google_breakpad/common/minidump_format.h b/src/google_breakpad/common/minidump_format.h index 77f28ca7..6c051305 100644 --- a/src/google_breakpad/common/minidump_format.h +++ b/src/google_breakpad/common/minidump_format.h @@ -90,19 +90,20 @@ typedef struct { * WinNT.h */ -/* Non-x86 CPU identifiers found in the high 26 bits of +/* Non-x86 CPU identifiers found in the high 24 bits of * (MDRawContext*).context_flags. These aren't used by Breakpad, but are * defined here for reference, to avoid assigning values that conflict * (although some values already conflict). */ #define MD_CONTEXT_IA64 0x00080000 /* CONTEXT_IA64 */ -#define MD_CONTEXT_AMD64 0x00100000 /* CONTEXT_AMD64 */ /* Additional values from winnt.h in the Windows CE 5.0 SDK: */ #define MD_CONTEXT_SHX 0x000000c0 /* CONTEXT_SH4 (Super-H, includes SH3) */ -#define MD_CONTEXT_ARM 0x00000040 /* CONTEXT_ARM (0x40 bit set in SHx?) */ #define MD_CONTEXT_MIPS 0x00010000 /* CONTEXT_R4000 (same value as x86?) */ #define MD_CONTEXT_ALPHA 0x00020000 /* CONTEXT_ALPHA */ -#define MD_CONTEXT_CPU_MASK 0xffffffc0 +/* As of Windows 7 SP1, the number of flag bits has increased to + * include 0x40 (CONTEXT_XSTATE): + * http://msdn.microsoft.com/en-us/library/hh134238%28v=vs.85%29.aspx */ +#define MD_CONTEXT_CPU_MASK 0xffffff00 /* This is a base type for MDRawContextX86 and MDRawContextPPC. This -- cgit v1.2.1