OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 | 265 |
266 static void VerifyStackTrace(Dart_StackTrace trace, | 266 static void VerifyStackTrace(Dart_StackTrace trace, |
267 const char* func_names[], | 267 const char* func_names[], |
268 Dart_Handle local_vars[], | 268 Dart_Handle local_vars[], |
269 int expected_frames, | 269 int expected_frames, |
270 bool skip_null_expects) { | 270 bool skip_null_expects) { |
271 intptr_t trace_len; | 271 intptr_t trace_len; |
272 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); | 272 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); |
273 EXPECT_TRUE(res); | 273 EXPECT_TRUE(res); |
| 274 uintptr_t last_frame_pointer = 0; |
| 275 uintptr_t frame_pointer; |
274 for (int i = 0; i < trace_len; i++) { | 276 for (int i = 0; i < trace_len; i++) { |
275 Dart_ActivationFrame frame; | 277 Dart_ActivationFrame frame; |
276 res = Dart_GetActivationFrame(trace, i, &frame); | 278 res = Dart_GetActivationFrame(trace, i, &frame); |
277 EXPECT_TRUE(res); | 279 EXPECT_TRUE(res); |
| 280 |
| 281 res = Dart_ActivationFrameGetFramePointer(frame, &frame_pointer); |
| 282 EXPECT_TRUE(res); |
| 283 if (i > 0) { |
| 284 // We expect the stack to grow from high to low addresses. |
| 285 EXPECT_GT(frame_pointer, last_frame_pointer); |
| 286 } |
| 287 last_frame_pointer = frame_pointer; |
278 if (i < expected_frames) { | 288 if (i < expected_frames) { |
279 VerifyStackFrame(frame, func_names[i], local_vars[i], skip_null_expects); | 289 VerifyStackFrame(frame, func_names[i], local_vars[i], skip_null_expects); |
280 } else { | 290 } else { |
281 VerifyStackFrame(frame, NULL, Dart_Null(), skip_null_expects); | 291 VerifyStackFrame(frame, NULL, Dart_Null(), skip_null_expects); |
282 } | 292 } |
283 } | 293 } |
284 } | 294 } |
285 | 295 |
286 | 296 |
287 // TODO(hausner): Convert this one remaining use of the legacy | 297 // TODO(hausner): Convert this one remaining use of the legacy |
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," | 2315 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," |
2306 " null, 4, 13, 3, 14, 10," | 2316 " null, 4, 13, 3, 14, 10," |
2307 " null, 5, 17, 5, 18, 9, 19, 12," | 2317 " null, 5, 17, 5, 18, 9, 19, 12," |
2308 " null, 6, 21, 1," | 2318 " null, 6, 21, 1," |
2309 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," | 2319 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," |
2310 " null, 9, 29, 1]", | 2320 " null, 9, 29, 1]", |
2311 tokens_cstr); | 2321 tokens_cstr); |
2312 } | 2322 } |
2313 | 2323 |
2314 } // namespace dart | 2324 } // namespace dart |
OLD | NEW |