| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013, Google Inc. | 1 // Copyright (c) 2013, Google Inc. | 
| 2 // All rights reserved. | 2 // All rights reserved. | 
| 3 // | 3 // | 
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without | 
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are | 
| 6 // met: | 6 // met: | 
| 7 // | 7 // | 
| 8 //     * Redistributions of source code must retain the above copyright | 8 //     * Redistributions of source code must retain the above copyright | 
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. | 
| 10 //     * Redistributions in binary form must reproduce the above | 10 //     * Redistributions in binary form must reproduce the above | 
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 138   MockCodeModules modules; | 138   MockCodeModules modules; | 
| 139   MockSymbolSupplier supplier; | 139   MockSymbolSupplier supplier; | 
| 140   BasicSourceLineResolver resolver; | 140   BasicSourceLineResolver resolver; | 
| 141   CallStack call_stack; | 141   CallStack call_stack; | 
| 142   const vector<StackFrame*>* frames; | 142   const vector<StackFrame*>* frames; | 
| 143 }; | 143 }; | 
| 144 | 144 | 
| 145 class SanityCheck: public StackwalkerMIPSFixture, public Test { }; | 145 class SanityCheck: public StackwalkerMIPSFixture, public Test { }; | 
| 146 | 146 | 
| 147 TEST_F(SanityCheck, NoResolver) { | 147 TEST_F(SanityCheck, NoResolver) { | 
|  | 148   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 148   stack_section.start() = 0x80000000; | 149   stack_section.start() = 0x80000000; | 
| 149   stack_section.D32(0).D32(0x0); | 150   stack_section.D32(0).D32(0x0); | 
| 150   RegionFromSection(); | 151   RegionFromSection(); | 
| 151   raw_context.epc = 0x00400020; | 152   raw_context.epc = 0x00400020; | 
| 152   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 153   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 
| 153 | 154 | 
| 154   StackFrameSymbolizer frame_symbolizer(NULL, NULL); | 155   StackFrameSymbolizer frame_symbolizer(NULL, NULL); | 
| 155   StackwalkerMIPS walker(&system_info, &raw_context, &stack_region, &modules, | 156   StackwalkerMIPS walker(&system_info, &raw_context, &stack_region, &modules, | 
| 156                         &frame_symbolizer); | 157                         &frame_symbolizer); | 
| 157   // This should succeed, even without a resolver or supplier. | 158   // This should succeed, even without a resolver or supplier. | 
| 158   vector<const CodeModule*> modules_without_symbols; | 159   vector<const CodeModule*> modules_without_symbols; | 
| 159   vector<const CodeModule*> modules_with_corrupt_symbols; | 160   vector<const CodeModule*> modules_with_corrupt_symbols; | 
| 160   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 161   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 
| 161                           &modules_with_corrupt_symbols)); | 162                           &modules_with_corrupt_symbols)); | 
| 162   ASSERT_EQ(1U, modules_without_symbols.size()); | 163   ASSERT_EQ(1U, modules_without_symbols.size()); | 
| 163   ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); | 164   ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); | 
| 164   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 165   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 
| 165   frames = call_stack.frames(); | 166   frames = call_stack.frames(); | 
| 166   ASSERT_EQ(1U, frames->size()); | 167   ASSERT_EQ(1U, frames->size()); | 
| 167   StackFrameMIPS* frame = static_cast<StackFrameMIPS*>(frames->at(0)); | 168   StackFrameMIPS* frame = static_cast<StackFrameMIPS*>(frames->at(0)); | 
| 168   // Check that the values from the original raw context made it | 169   // Check that the values from the original raw context made it | 
| 169   // through to the context in the stack frame. | 170   // through to the context in the stack frame. | 
| 170   EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); | 171   EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); | 
| 171 } | 172 } | 
| 172 | 173 | 
| 173 class GetContextFrame: public StackwalkerMIPSFixture, public Test { }; | 174 class GetContextFrame: public StackwalkerMIPSFixture, public Test { }; | 
| 174 | 175 | 
| 175 TEST_F(GetContextFrame, Simple) { | 176 TEST_F(GetContextFrame, Simple) { | 
|  | 177   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 176   stack_section.start() = 0x80000000; | 178   stack_section.start() = 0x80000000; | 
| 177   stack_section.D32(0).D32(0x0); | 179   stack_section.D32(0).D32(0x0); | 
| 178   RegionFromSection(); | 180   RegionFromSection(); | 
| 179   raw_context.epc = 0x00400020; | 181   raw_context.epc = 0x00400020; | 
| 180   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 182   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 
| 181 | 183 | 
| 182   StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); | 184   StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); | 
| 183   StackwalkerMIPS walker(&system_info, &raw_context, &stack_region, &modules, | 185   StackwalkerMIPS walker(&system_info, &raw_context, &stack_region, &modules, | 
| 184                          &frame_symbolizer); | 186                          &frame_symbolizer); | 
| 185   vector<const CodeModule*> modules_without_symbols; | 187   vector<const CodeModule*> modules_without_symbols; | 
| 186   vector<const CodeModule*> modules_with_corrupt_symbols; | 188   vector<const CodeModule*> modules_with_corrupt_symbols; | 
| 187   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 189   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 
| 188                           &modules_with_corrupt_symbols)); | 190                           &modules_with_corrupt_symbols)); | 
| 189   ASSERT_EQ(1U, modules_without_symbols.size()); | 191   ASSERT_EQ(1U, modules_without_symbols.size()); | 
| 190   ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); | 192   ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); | 
| 191   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 193   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 
| 192   frames = call_stack.frames(); | 194   frames = call_stack.frames(); | 
| 193   StackFrameMIPS* frame = static_cast<StackFrameMIPS*>(frames->at(0)); | 195   StackFrameMIPS* frame = static_cast<StackFrameMIPS*>(frames->at(0)); | 
| 194   // Check that the values from the original raw context made it | 196   // Check that the values from the original raw context made it | 
| 195   // through to the context in the stack frame. | 197   // through to the context in the stack frame. | 
| 196   EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); | 198   EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); | 
| 197 } | 199 } | 
| 198 | 200 | 
| 199 // The stackwalker should be able to produce the context frame even | 201 // The stackwalker should be able to produce the context frame even | 
| 200 // without stack memory present. | 202 // without stack memory present. | 
| 201 TEST_F(GetContextFrame, NoStackMemory) { | 203 TEST_F(GetContextFrame, NoStackMemory) { | 
|  | 204   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 202   raw_context.epc = 0x00400020; | 205   raw_context.epc = 0x00400020; | 
| 203   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 206   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 
| 204 | 207 | 
| 205   StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); | 208   StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); | 
| 206   StackwalkerMIPS walker(&system_info, &raw_context, NULL, &modules, | 209   StackwalkerMIPS walker(&system_info, &raw_context, NULL, &modules, | 
| 207                          &frame_symbolizer); | 210                          &frame_symbolizer); | 
| 208   vector<const CodeModule*> modules_without_symbols; | 211   vector<const CodeModule*> modules_without_symbols; | 
| 209   vector<const CodeModule*> modules_with_corrupt_symbols; | 212   vector<const CodeModule*> modules_with_corrupt_symbols; | 
| 210   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 213   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 
| 211                           &modules_with_corrupt_symbols)); | 214                           &modules_with_corrupt_symbols)); | 
| 212   ASSERT_EQ(1U, modules_without_symbols.size()); | 215   ASSERT_EQ(1U, modules_without_symbols.size()); | 
| 213   ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); | 216   ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); | 
| 214   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 217   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 
| 215   frames = call_stack.frames(); | 218   frames = call_stack.frames(); | 
| 216   StackFrameMIPS* frame = static_cast<StackFrameMIPS*>(frames->at(0)); | 219   StackFrameMIPS* frame = static_cast<StackFrameMIPS*>(frames->at(0)); | 
| 217   // Check that the values from the original raw context made it | 220   // Check that the values from the original raw context made it | 
| 218   // through to the context in the stack frame. | 221   // through to the context in the stack frame. | 
| 219   EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); | 222   EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); | 
| 220 } | 223 } | 
| 221 | 224 | 
| 222 class GetCallerFrame: public StackwalkerMIPSFixture, public Test { }; | 225 class GetCallerFrame: public StackwalkerMIPSFixture, public Test { }; | 
| 223 | 226 | 
| 224 TEST_F(GetCallerFrame, ScanWithoutSymbols) { | 227 TEST_F(GetCallerFrame, ScanWithoutSymbols) { | 
|  | 228   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 225   // When the stack walker resorts to scanning the stack, | 229   // When the stack walker resorts to scanning the stack, | 
| 226   // only addresses located within loaded modules are | 230   // only addresses located within loaded modules are | 
| 227   // considered valid return addresses. | 231   // considered valid return addresses. | 
| 228   // Force scanning through three frames to ensure that the | 232   // Force scanning through three frames to ensure that the | 
| 229   // stack pointer is set properly in scan-recovered frames. | 233   // stack pointer is set properly in scan-recovered frames. | 
| 230   stack_section.start() = 0x80000000; | 234   stack_section.start() = 0x80000000; | 
| 231   uint32_t return_address1 = 0x00400100; | 235   uint32_t return_address1 = 0x00400100; | 
| 232   uint32_t return_address2 = 0x00400900; | 236   uint32_t return_address2 = 0x00400900; | 
| 233   Label frame1_sp, frame2_sp; | 237   Label frame1_sp, frame2_sp; | 
| 234   stack_section | 238   stack_section | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 291   ASSERT_EQ((StackFrameMIPS::CONTEXT_VALID_PC | | 295   ASSERT_EQ((StackFrameMIPS::CONTEXT_VALID_PC | | 
| 292              StackFrameMIPS::CONTEXT_VALID_SP | | 296              StackFrameMIPS::CONTEXT_VALID_SP | | 
| 293              StackFrameMIPS::CONTEXT_VALID_FP | | 297              StackFrameMIPS::CONTEXT_VALID_FP | | 
| 294              StackFrameMIPS::CONTEXT_VALID_RA), | 298              StackFrameMIPS::CONTEXT_VALID_RA), | 
| 295             frame2->context_validity); | 299             frame2->context_validity); | 
| 296   EXPECT_EQ(return_address2 - 2 * sizeof(return_address2), frame2->context.epc); | 300   EXPECT_EQ(return_address2 - 2 * sizeof(return_address2), frame2->context.epc); | 
| 297   EXPECT_EQ(frame2_sp.Value(), frame2->context.iregs[MD_CONTEXT_MIPS_REG_SP]); | 301   EXPECT_EQ(frame2_sp.Value(), frame2->context.iregs[MD_CONTEXT_MIPS_REG_SP]); | 
| 298 } | 302 } | 
| 299 | 303 | 
| 300 TEST_F(GetCallerFrame, ScanWithFunctionSymbols) { | 304 TEST_F(GetCallerFrame, ScanWithFunctionSymbols) { | 
|  | 305   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 301   // During stack scanning, if a potential return address | 306   // During stack scanning, if a potential return address | 
| 302   // is located within a loaded module that has symbols, | 307   // is located within a loaded module that has symbols, | 
| 303   // it is only considered a valid return address if it | 308   // it is only considered a valid return address if it | 
| 304   // lies within a function's bounds. | 309   // lies within a function's bounds. | 
| 305   stack_section.start() = 0x80000000; | 310   stack_section.start() = 0x80000000; | 
| 306   uint32_t return_address = 0x00500200; | 311   uint32_t return_address = 0x00500200; | 
| 307   Label frame1_sp; | 312   Label frame1_sp; | 
| 308   stack_section | 313   stack_section | 
| 309     // frame 0 | 314     // frame 0 | 
| 310     .Append(16, 0)                      // space | 315     .Append(16, 0)                      // space | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 359              StackFrameMIPS::CONTEXT_VALID_FP | | 364              StackFrameMIPS::CONTEXT_VALID_FP | | 
| 360              StackFrameMIPS::CONTEXT_VALID_RA), | 365              StackFrameMIPS::CONTEXT_VALID_RA), | 
| 361             frame1->context_validity); | 366             frame1->context_validity); | 
| 362   EXPECT_EQ(return_address - 2 * sizeof(return_address), frame1->context.epc); | 367   EXPECT_EQ(return_address - 2 * sizeof(return_address), frame1->context.epc); | 
| 363   EXPECT_EQ(frame1_sp.Value(), frame1->context.iregs[MD_CONTEXT_MIPS_REG_SP]); | 368   EXPECT_EQ(frame1_sp.Value(), frame1->context.iregs[MD_CONTEXT_MIPS_REG_SP]); | 
| 364   EXPECT_EQ("marsupial", frame1->function_name); | 369   EXPECT_EQ("marsupial", frame1->function_name); | 
| 365   EXPECT_EQ(0x00500100U, frame1->function_base); | 370   EXPECT_EQ(0x00500100U, frame1->function_base); | 
| 366 } | 371 } | 
| 367 | 372 | 
| 368 TEST_F(GetCallerFrame, CheckStackFrameSizeLimit) { | 373 TEST_F(GetCallerFrame, CheckStackFrameSizeLimit) { | 
|  | 374   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 369   // If the stackwalker resorts to stack scanning, it will scan only | 375   // If the stackwalker resorts to stack scanning, it will scan only | 
| 370   // 1024 bytes of stack which correspondes to maximum size of stack frame. | 376   // 1024 bytes of stack which correspondes to maximum size of stack frame. | 
| 371   stack_section.start() = 0x80000000; | 377   stack_section.start() = 0x80000000; | 
| 372   uint32_t return_address1 = 0x00500100; | 378   uint32_t return_address1 = 0x00500100; | 
| 373   uint32_t return_address2 = 0x00500900; | 379   uint32_t return_address2 = 0x00500900; | 
| 374   Label frame1_sp, frame2_sp; | 380   Label frame1_sp, frame2_sp; | 
| 375   stack_section | 381   stack_section | 
| 376     // frame 0 | 382     // frame 0 | 
| 377     .Append(32, 0)                      // space | 383     .Append(32, 0)                      // space | 
| 378 | 384 | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 430              StackFrameMIPS::CONTEXT_VALID_FP | | 436              StackFrameMIPS::CONTEXT_VALID_FP | | 
| 431              StackFrameMIPS::CONTEXT_VALID_RA), | 437              StackFrameMIPS::CONTEXT_VALID_RA), | 
| 432             frame1->context_validity); | 438             frame1->context_validity); | 
| 433   EXPECT_EQ(return_address1 - 2 * sizeof(return_address1), frame1->context.epc); | 439   EXPECT_EQ(return_address1 - 2 * sizeof(return_address1), frame1->context.epc); | 
| 434   EXPECT_EQ(frame1_sp.Value(), frame1->context.iregs[MD_CONTEXT_MIPS_REG_SP]); | 440   EXPECT_EQ(frame1_sp.Value(), frame1->context.iregs[MD_CONTEXT_MIPS_REG_SP]); | 
| 435 } | 441 } | 
| 436 | 442 | 
| 437 // Test that set_max_frames_scanned prevents using stack scanning | 443 // Test that set_max_frames_scanned prevents using stack scanning | 
| 438 // to find caller frames. | 444 // to find caller frames. | 
| 439 TEST_F(GetCallerFrame, ScanningNotAllowed) { | 445 TEST_F(GetCallerFrame, ScanningNotAllowed) { | 
|  | 446   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 440   // When the stack walker resorts to scanning the stack, | 447   // When the stack walker resorts to scanning the stack, | 
| 441   // only fixed number of frames are allowed to be scanned out from stack | 448   // only fixed number of frames are allowed to be scanned out from stack | 
| 442   stack_section.start() = 0x80000000; | 449   stack_section.start() = 0x80000000; | 
| 443   uint32_t return_address1 = 0x00500100; | 450   uint32_t return_address1 = 0x00500100; | 
| 444   uint32_t return_address2 = 0x00500900; | 451   uint32_t return_address2 = 0x00500900; | 
| 445   Label frame1_sp, frame2_sp; | 452   Label frame1_sp, frame2_sp; | 
| 446   stack_section | 453   stack_section | 
| 447     // frame 0 | 454     // frame 0 | 
| 448     .Append(32, 0)                      // space | 455     .Append(32, 0)                      // space | 
| 449 | 456 | 
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 639 | 646 | 
| 640   // The validity mask to impose on the context frame. | 647   // The validity mask to impose on the context frame. | 
| 641   int context_frame_validity; | 648   int context_frame_validity; | 
| 642 }; | 649 }; | 
| 643 | 650 | 
| 644 class CFI: public CFIFixture, public Test { }; | 651 class CFI: public CFIFixture, public Test { }; | 
| 645 | 652 | 
| 646 // TODO(gordanac): add CFI tests | 653 // TODO(gordanac): add CFI tests | 
| 647 | 654 | 
| 648 TEST_F(CFI, At4004) { | 655 TEST_F(CFI, At4004) { | 
|  | 656   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 649   Label frame1_sp = expected.iregs[MD_CONTEXT_MIPS_REG_SP]; | 657   Label frame1_sp = expected.iregs[MD_CONTEXT_MIPS_REG_SP]; | 
| 650   stack_section | 658   stack_section | 
| 651     // frame0 | 659     // frame0 | 
| 652     .Append(24, 0)               // space | 660     .Append(24, 0)               // space | 
| 653     .D32(frame1_sp)              // stack pointer | 661     .D32(frame1_sp)              // stack pointer | 
| 654     .D32(0x00405510)             // return address | 662     .D32(0x00405510)             // return address | 
| 655     .Mark(&frame1_sp);           // This effectively sets stack_section.start(). | 663     .Mark(&frame1_sp);           // This effectively sets stack_section.start(). | 
| 656   raw_context.epc = 0x00404004; | 664   raw_context.epc = 0x00404004; | 
| 657   CheckWalk(); | 665   CheckWalk(); | 
| 658 } | 666 } | 
| 659 | 667 | 
| 660 // Check that we reject rules that would cause the stack pointer to | 668 // Check that we reject rules that would cause the stack pointer to | 
| 661 // move in the wrong direction. | 669 // move in the wrong direction. | 
| 662 TEST_F(CFI, RejectBackwards) { | 670 TEST_F(CFI, RejectBackwards) { | 
|  | 671   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 663   raw_context.epc = 0x40005000; | 672   raw_context.epc = 0x40005000; | 
| 664   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 673   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 
| 665   raw_context.iregs[MD_CONTEXT_MIPS_REG_RA] = 0x00405510; | 674   raw_context.iregs[MD_CONTEXT_MIPS_REG_RA] = 0x00405510; | 
| 666 | 675 | 
| 667   StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); | 676   StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); | 
| 668   StackwalkerMIPS walker(&system_info, &raw_context, &stack_region, &modules, | 677   StackwalkerMIPS walker(&system_info, &raw_context, &stack_region, &modules, | 
| 669                          &frame_symbolizer); | 678                          &frame_symbolizer); | 
| 670   vector<const CodeModule*> modules_without_symbols; | 679   vector<const CodeModule*> modules_without_symbols; | 
| 671   vector<const CodeModule*> modules_with_corrupt_symbols; | 680   vector<const CodeModule*> modules_with_corrupt_symbols; | 
| 672   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 681   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 
| 673                           &modules_with_corrupt_symbols)); | 682                           &modules_with_corrupt_symbols)); | 
| 674   ASSERT_EQ(0U, modules_without_symbols.size()); | 683   ASSERT_EQ(0U, modules_without_symbols.size()); | 
| 675   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 684   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 
| 676   frames = call_stack.frames(); | 685   frames = call_stack.frames(); | 
| 677   ASSERT_EQ(1U, frames->size()); | 686   ASSERT_EQ(1U, frames->size()); | 
| 678 } | 687 } | 
| 679 | 688 | 
| 680 // Check that we reject rules whose expressions' evaluation fails. | 689 // Check that we reject rules whose expressions' evaluation fails. | 
| 681 TEST_F(CFI, RejectBadExpressions) { | 690 TEST_F(CFI, RejectBadExpressions) { | 
|  | 691   raw_context.context_flags = raw_context.context_flags | MD_CONTEXT_MIPS_FULL; | 
| 682   raw_context.epc = 0x00407000; | 692   raw_context.epc = 0x00407000; | 
| 683   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 693   raw_context.iregs[MD_CONTEXT_MIPS_REG_SP] = 0x80000000; | 
| 684   raw_context.iregs[MD_CONTEXT_MIPS_REG_RA] = 0x00405510; | 694   raw_context.iregs[MD_CONTEXT_MIPS_REG_RA] = 0x00405510; | 
| 685 | 695 | 
| 686   StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); | 696   StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); | 
| 687   StackwalkerMIPS walker(&system_info, &raw_context, &stack_region, &modules, | 697   StackwalkerMIPS walker(&system_info, &raw_context, &stack_region, &modules, | 
| 688                          &frame_symbolizer); | 698                          &frame_symbolizer); | 
| 689   vector<const CodeModule*> modules_without_symbols; | 699   vector<const CodeModule*> modules_without_symbols; | 
| 690   vector<const CodeModule*> modules_with_corrupt_symbols; | 700   vector<const CodeModule*> modules_with_corrupt_symbols; | 
| 691   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 701   ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, | 
| 692                           &modules_with_corrupt_symbols)); | 702                           &modules_with_corrupt_symbols)); | 
| 693   ASSERT_EQ(0U, modules_without_symbols.size()); | 703   ASSERT_EQ(0U, modules_without_symbols.size()); | 
| 694   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 704   ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); | 
| 695   frames = call_stack.frames(); | 705   frames = call_stack.frames(); | 
| 696   ASSERT_EQ(1U, frames->size()); | 706   ASSERT_EQ(1U, frames->size()); | 
| 697 } | 707 } | 
| OLD | NEW | 
|---|