diff options
author | ted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-01-24 19:59:09 +0000 |
---|---|---|
committer | ted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-01-24 19:59:09 +0000 |
commit | 281d52d944d63ddfbe933a7bbe8adbfba3523966 (patch) | |
tree | c0d1d840bbd1c26f8adecdf4a15e6c7e428b48d8 /src/processor/stackwalker_x86_unittest.cc | |
parent | b904343e14b3303f3dc61b0c1e039d33ac159843 (diff) | |
download | google-breakpad-281d52d944d63ddfbe933a7bbe8adbfba3523966.tar.gz |
Fix some apparently longstanding crash bugs in Stackwalker implementations when resolver is NULL.
R=mark at http://breakpad.appspot.com/257001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@761 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor/stackwalker_x86_unittest.cc')
-rw-r--r-- | src/processor/stackwalker_x86_unittest.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/processor/stackwalker_x86_unittest.cc b/src/processor/stackwalker_x86_unittest.cc index aece4891..aa6b6310 100644 --- a/src/processor/stackwalker_x86_unittest.cc +++ b/src/processor/stackwalker_x86_unittest.cc @@ -129,6 +129,26 @@ class StackwalkerX86Fixture { const vector<StackFrame *> *frames; }; +class SanityCheck: public StackwalkerX86Fixture, public Test { }; + +TEST_F(SanityCheck, NoResolver) { + stack_section.start() = 0x80000000; + stack_section.D32(0).D32(0); // end-of-stack marker + RegionFromSection(); + raw_context.eip = 0x40000200; + raw_context.ebp = 0x80000000; + + StackwalkerX86 walker(&system_info, &raw_context, &stack_region, &modules, + NULL, NULL); + // This should succeed, even without a resolver or supplier. + ASSERT_TRUE(walker.Walk(&call_stack)); + frames = call_stack.frames(); + StackFrameX86 *frame = static_cast<StackFrameX86 *>(frames->at(0)); + // Check that the values from the original raw context made it + // through to the context in the stack frame. + EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); +} + class GetContextFrame: public StackwalkerX86Fixture, public Test { }; TEST_F(GetContextFrame, Simple) { @@ -145,7 +165,7 @@ TEST_F(GetContextFrame, Simple) { StackFrameX86 *frame = static_cast<StackFrameX86 *>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. - EXPECT_TRUE(memcmp(&raw_context, &frame->context, sizeof(raw_context)) == 0); + EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); } class GetCallerFrame: public StackwalkerX86Fixture, public Test { }; |