OLD | NEW |
1 // Copyright (c) 2010, Google Inc. | 1 // Copyright (c) 2010, 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 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 frame1->windows_frame_info->type_); | 1221 frame1->windows_frame_info->type_); |
1222 EXPECT_EQ("$T0 $ebp = $eip $T0 4 + ^ = $ebp $T0 ^ = $esp $T0 8 + = $L " | 1222 EXPECT_EQ("$T0 $ebp = $eip $T0 4 + ^ = $ebp $T0 ^ = $esp $T0 8 + = $L " |
1223 "$T0 .cbSavedRegs - = $P $T0 8 + .cbParams + =", | 1223 "$T0 .cbSavedRegs - = $P $T0 8 + .cbParams + =", |
1224 frame1->windows_frame_info->program_string); | 1224 frame1->windows_frame_info->program_string); |
1225 EXPECT_FALSE(frame1->windows_frame_info->allocates_base_pointer); | 1225 EXPECT_FALSE(frame1->windows_frame_info->allocates_base_pointer); |
1226 } | 1226 } |
1227 } | 1227 } |
1228 | 1228 |
1229 // Scan the stack for a better return address and potentially skip frames | 1229 // Scan the stack for a better return address and potentially skip frames |
1230 // when the calculated return address is not in a known module. Note, that | 1230 // when the calculated return address is not in a known module. Note, that |
1231 // the span of this scan is somewhat arbitrarily limited to 120 search words | 1231 // the span of this scan is somewhat arbitrarily limited to 160 search words |
1232 // for the context frame and 30 search words (pointers) for the other frames: | 1232 // for the context frame and 40 search words (pointers) for the other frames: |
1233 // const int kRASearchWords = 30; | 1233 // const int kRASearchWords = 40; |
1234 // This means that frames can be skipped only when their size is relatively | 1234 // This means that frames can be skipped only when their size is relatively |
1235 // small: smaller than 4 * kRASearchWords * sizeof(InstructionType) | 1235 // small: smaller than 4 * kRASearchWords * sizeof(InstructionType) |
1236 TEST_F(GetCallerFrame, ReturnAddressIsNotInKnownModule) { | 1236 TEST_F(GetCallerFrame, ReturnAddressIsNotInKnownModule) { |
1237 MockCodeModule msvcrt_dll(0x77be0000, 0x58000, "msvcrt.dll", "version1"); | 1237 MockCodeModule msvcrt_dll(0x77be0000, 0x58000, "msvcrt.dll", "version1"); |
1238 SetModuleSymbols(&msvcrt_dll, // msvcrt.dll | 1238 SetModuleSymbols(&msvcrt_dll, // msvcrt.dll |
1239 "PUBLIC 38180 0 wcsstr\n" | 1239 "PUBLIC 38180 0 wcsstr\n" |
1240 "STACK WIN 4 38180 61 10 0 8 0 0 0 1 $T0 $ebp = $eip $T0 " | 1240 "STACK WIN 4 38180 61 10 0 8 0 0 0 1 $T0 $ebp = $eip $T0 " |
1241 "4 + ^ = $ebp $T0 ^ = $esp $T0 8 + = $L $T0 .cbSavedRegs " | 1241 "4 + ^ = $ebp $T0 ^ = $esp $T0 8 + = $L $T0 .cbSavedRegs " |
1242 "- = $P $T0 4 + .cbParams + =\n"); | 1242 "- = $P $T0 4 + .cbParams + =\n"); |
1243 | 1243 |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 .D32(0x8036cc02) // garbage | 2119 .D32(0x8036cc02) // garbage |
2120 .Mark(&frame1_esp); // This effectively sets stack_section.start(). | 2120 .Mark(&frame1_esp); // This effectively sets stack_section.start(). |
2121 raw_context.eip = 0x40004006; | 2121 raw_context.eip = 0x40004006; |
2122 raw_context.ebp = frame0_ebp.Value(); | 2122 raw_context.ebp = frame0_ebp.Value(); |
2123 raw_context.ebx = 0x53d1379d; // saved %esi | 2123 raw_context.ebx = 0x53d1379d; // saved %esi |
2124 raw_context.esi = 0x743833c9; // callee's %esi | 2124 raw_context.esi = 0x743833c9; // callee's %esi |
2125 raw_context.edi = 0x40005510; // return address | 2125 raw_context.edi = 0x40005510; // return address |
2126 CheckWalk(); | 2126 CheckWalk(); |
2127 } | 2127 } |
2128 | 2128 |
OLD | NEW |