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
This commit is contained in:
ted.mielczarek 2011-08-30 22:22:08 +00:00
parent 8ade75f955
commit 1a1890a52a
10 changed files with 658 additions and 42 deletions

View file

@ -170,6 +170,25 @@ Context::Context(const Dump &dump, const MDRawContextX86 &context)
assert(Size() == sizeof(MDRawContextX86));
}
Context::Context(const Dump &dump, const MDRawContextARM &context)
: Section(dump) {
// The caller should have properly set the CPU type flag.
assert((context.context_flags & MD_CONTEXT_ARM) ||
(context.context_flags & MD_CONTEXT_ARM_OLD));
// It doesn't make sense to store ARM registers in big-endian form.
assert(dump.endianness() == kLittleEndian);
D32(context.context_flags);
for (int i = 0; i < MD_CONTEXT_ARM_GPR_COUNT; ++i)
D32(context.iregs[i]);
D32(context.cpsr);
D64(context.float_save.fpscr);
for (int i = 0; i < MD_FLOATINGSAVEAREA_ARM_FPR_COUNT; ++i)
D64(context.float_save.regs[i]);
for (int i = 0; i < MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT; ++i)
D32(context.float_save.extra[i]);
assert(Size() == sizeof(MDRawContextARM));
}
Thread::Thread(const Dump &dump,
u_int32_t thread_id, const Memory &stack, const Context &context,
u_int32_t suspend_count, u_int32_t priority_class,
@ -231,7 +250,28 @@ const MDVSFixedFileInfo Module::stock_version_info = {
MD_VSFIXEDFILEINFO_FILE_SUBTYPE_UNKNOWN, // file_subtype
0, // file_date_hi
0 // file_date_lo
};
};
Exception::Exception(const Dump &dump,
const Context &context,
u_int32_t thread_id,
u_int32_t exception_code,
u_int32_t exception_flags,
u_int64_t exception_address)
: Stream(dump, MD_EXCEPTION_STREAM) {
D32(thread_id);
D32(0); // __align
D32(exception_code);
D32(exception_flags);
D64(0); // exception_record
D64(exception_address);
D32(0); // number_parameters
D32(0); // __align
for (int i = 0; i < MD_EXCEPTION_MAXIMUM_PARAMETERS; ++i)
D64(0); // exception_information
context.CiteLocationIn(this);
assert(Size() == sizeof(MDRawExceptionStream));
}
Dump::Dump(u_int64_t flags,
Endianness endianness,