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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 RegionFromSection(); | 195 RegionFromSection(); |
196 raw_context.rsp = stack_section.start().Value(); | 196 raw_context.rsp = stack_section.start().Value(); |
197 | 197 |
198 StackwalkerAMD64 walker(&system_info, &raw_context, &stack_region, &modules, | 198 StackwalkerAMD64 walker(&system_info, &raw_context, &stack_region, &modules, |
199 &supplier, &resolver); | 199 &supplier, &resolver); |
200 ASSERT_TRUE(walker.Walk(&call_stack)); | 200 ASSERT_TRUE(walker.Walk(&call_stack)); |
201 frames = call_stack.frames(); | 201 frames = call_stack.frames(); |
202 ASSERT_EQ(2U, frames->size()); | 202 ASSERT_EQ(2U, frames->size()); |
203 | 203 |
204 StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); | 204 StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); |
| 205 EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); |
205 ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); | 206 ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); |
206 EXPECT_EQ("enchiridion", frame0->function_name); | 207 EXPECT_EQ("enchiridion", frame0->function_name); |
207 EXPECT_EQ(0x40000000c0004000ULL, frame0->function_base); | 208 EXPECT_EQ(0x40000000c0004000ULL, frame0->function_base); |
208 | 209 |
209 StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1)); | 210 StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1)); |
| 211 EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); |
210 ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | | 212 ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | |
211 StackFrameAMD64::CONTEXT_VALID_RSP | | 213 StackFrameAMD64::CONTEXT_VALID_RSP | |
212 StackFrameAMD64::CONTEXT_VALID_RBP | | 214 StackFrameAMD64::CONTEXT_VALID_RBP | |
213 StackFrameAMD64::CONTEXT_VALID_RBX | | 215 StackFrameAMD64::CONTEXT_VALID_RBX | |
214 StackFrameAMD64::CONTEXT_VALID_R12 | | 216 StackFrameAMD64::CONTEXT_VALID_R12 | |
215 StackFrameAMD64::CONTEXT_VALID_R13 | | 217 StackFrameAMD64::CONTEXT_VALID_R13 | |
216 StackFrameAMD64::CONTEXT_VALID_R14 | | 218 StackFrameAMD64::CONTEXT_VALID_R14 | |
217 StackFrameAMD64::CONTEXT_VALID_R15), | 219 StackFrameAMD64::CONTEXT_VALID_R15), |
218 frame1->context_validity); | 220 frame1->context_validity); |
219 EXPECT_EQ(expected.rip, frame1->context.rip); | 221 EXPECT_EQ(expected.rip, frame1->context.rip); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 .D64(0x5a5beeb38de23be8ULL) // saved %rbx | 327 .D64(0x5a5beeb38de23be8ULL) // saved %rbx |
326 .D64(0xf015ee516ad89eabULL) // garbage | 328 .D64(0xf015ee516ad89eabULL) // garbage |
327 .Mark(&frame1_rsp); // This effectively sets stack_section.start(). | 329 .Mark(&frame1_rsp); // This effectively sets stack_section.start(). |
328 raw_context.rip = 0x40000000c0004006ULL; | 330 raw_context.rip = 0x40000000c0004006ULL; |
329 raw_context.rbp = frame0_rbp.Value(); | 331 raw_context.rbp = frame0_rbp.Value(); |
330 raw_context.rbx = 0xed1b02e8cc0fc79cULL; // saved %r12 | 332 raw_context.rbx = 0xed1b02e8cc0fc79cULL; // saved %r12 |
331 raw_context.r12 = 0x26e007b341acfebdULL; // callee's %r12 | 333 raw_context.r12 = 0x26e007b341acfebdULL; // callee's %r12 |
332 raw_context.r13 = 0x40000000c0005510ULL; // return address | 334 raw_context.r13 = 0x40000000c0005510ULL; // return address |
333 CheckWalk(); | 335 CheckWalk(); |
334 } | 336 } |
OLD | NEW |