Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Unified Diff: runtime/vm/debugger_api_impl_test.cc

Issue 335443002: Setup R10/EDX to be valid Oops before stub calls (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_arm.cc » ('j') | runtime/vm/flow_graph_compiler_mips.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_api_impl_test.cc
diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc
index 16f73f763c64bd53f727dcbfd711b44ad6418098..43865bc641bd21a53fec10f29fcf9749b28f64c6 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -974,6 +974,91 @@ TEST_CASE(Debug_ExprClosureBreakpoint) {
}
+void TestBreakpointHandlerWithVerify(Dart_IsolateId isolate_id,
+ Dart_Breakpoint bpt,
+ Dart_StackTrace trace) {
+ breakpoint_hit = true;
+ breakpoint_hit_counter++;
+
+ Dart_ActivationFrame frame;
+ Dart_Handle res = Dart_GetActivationFrame(trace, 0, &frame);
+ EXPECT_VALID(res);
+ Dart_Handle func_name;
+ intptr_t line_number;
+ res = Dart_ActivationFrameInfo(frame, &func_name, NULL, &line_number, NULL);
+ OS::Print("Hit line %" Pd "\n", line_number);
siva 2014/06/12 23:11:34 Is the print necessary? You could just do intptr_
rmacnak 2014/06/12 23:50:15 This was for debugging why I wasn't hitting the ex
+
+ VerifyPointersVisitor::VerifyPointers();
+}
+
+
+static void NoopNativeFunction(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ Dart_SetReturnValue(args, Dart_True());
+ Dart_ExitScope();
+}
+
+
+static Dart_NativeFunction NoopNativeResolver(Dart_Handle name,
+ int arg_count,
+ bool* auto_setup_scope) {
+ ASSERT(auto_setup_scope != NULL);
+ *auto_setup_scope = false;
+ return &NoopNativeFunction;
+}
+
+
+TEST_CASE(Debug_BreakpointStubPatching) {
siva 2014/06/12 23:11:34 Maybe you should add a comment here that if somebo
rmacnak 2014/06/12 23:50:15 Added.
+ const char* kScriptChars =
+ "bar(i) {} \n"
+ "nat() native 'a'; \n"
+ "foo(n) { \n"
+ " for(var i = 0; i < n; i++) { \n"
+ " bar(i); \n" // Static call.
+ " i++; \n" // Instance call.
+ " i == null; \n" // Equality.
+ " var x = i; \n" // Debug step check.
+ " i is int; \n" // Subtype test.
+ " y(z) => () => z + i; \n" // Allocate context.
+ " y(i)(); \n" // Closure call.
+ " nat(); \n" // Runtime call.
+ " return y; \n" // Return.
+ " } \n"
+ "} \n"
+ " \n"
+ "main() { \n"
+ " var i = 3; \n"
+ " foo(i); \n"
+ "} \n";
+
+ LoadScript(kScriptChars);
+ Dart_Handle result = Dart_SetNativeResolver(script_lib,
+ &NoopNativeResolver,
+ NULL);
+ EXPECT_VALID(result);
+ Dart_SetBreakpointHandler(&TestBreakpointHandlerWithVerify);
+
+ Dart_Handle script_url = NewString(TestCase::url());
+
+ const intptr_t num_breakpoints = 9;
+ intptr_t breakpoint_lines[num_breakpoints] =
+ {5, 6, 7, 8, 9, 10, 11, 12, 13};
+
+ for (intptr_t i = 0; i < num_breakpoints; i++) {
+ result = Dart_SetBreakpoint(script_url, breakpoint_lines[i]);
+ EXPECT_VALID(result);
+ EXPECT(Dart_IsInteger(result));
+ }
+
+ breakpoint_hit = false;
+ breakpoint_hit_counter = 0;
+ Dart_Handle retval = Invoke("main");
+ EXPECT_VALID(retval);
+ EXPECT(breakpoint_hit == true);
+ EXPECT_EQ(num_breakpoints, breakpoint_hit_counter);
+}
+
+
static intptr_t bp_id_to_be_deleted;
static void DeleteBreakpointHandler(Dart_IsolateId isolate_id,
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_arm.cc » ('j') | runtime/vm/flow_graph_compiler_mips.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698