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 24a339aeea2f6a0fab5a93196bd5d8d7c386f90b..e0685b8833c0fd1d98df8555041fac767a3aa351 100644 |
--- a/runtime/vm/debugger_api_impl_test.cc |
+++ b/runtime/vm/debugger_api_impl_test.cc |
@@ -26,7 +26,6 @@ static void LoadScript(const char* source) { |
EXPECT_VALID(script_lib); |
} |
- |
static void SetBreakpointAtEntry(const char* cname, const char* fname) { |
ASSERT(script_lib != NULL); |
ASSERT(!Dart_IsError(script_lib)); |
@@ -36,7 +35,6 @@ static void SetBreakpointAtEntry(const char* cname, const char* fname) { |
EXPECT(Dart_IsInteger(res)); |
} |
- |
static void DisableDebuggabilityOfDartColonLibraries() { |
const char* dart_colon = "dart:"; |
const intptr_t dart_colon_length = strlen(dart_colon); |
@@ -59,7 +57,6 @@ static void DisableDebuggabilityOfDartColonLibraries() { |
} |
} |
- |
static Dart_Handle Invoke(const char* func_name) { |
ASSERT(script_lib != NULL); |
ASSERT(!Dart_IsError(script_lib)); |
@@ -67,7 +64,6 @@ static Dart_Handle Invoke(const char* func_name) { |
return Dart_Invoke(script_lib, NewString(func_name), 0, NULL); |
} |
- |
static char const* ToCString(Dart_Handle str) { |
EXPECT(Dart_IsString(str)); |
char const* c_str = NULL; |
@@ -75,7 +71,6 @@ static char const* ToCString(Dart_Handle str) { |
return c_str; |
} |
- |
static int64_t ToInt64(Dart_Handle h) { |
EXPECT(Dart_IsInteger(h)); |
int64_t i = 0; |
@@ -84,7 +79,6 @@ static int64_t ToInt64(Dart_Handle h) { |
return i; |
} |
- |
static double ToDouble(Dart_Handle h) { |
EXPECT(Dart_IsDouble(h)); |
double d = 0.0; |
@@ -93,7 +87,6 @@ static double ToDouble(Dart_Handle h) { |
return d; |
} |
- |
static char const* BreakpointInfo(Dart_StackTrace trace) { |
static char info_str[128]; |
Dart_ActivationFrame frame; |
@@ -111,10 +104,8 @@ static char const* BreakpointInfo(Dart_StackTrace trace) { |
return info_str; |
} |
- |
static void PrintValue(Dart_Handle value, bool expand); |
- |
static void PrintObjectList(Dart_Handle list, const char* prefix, bool expand) { |
intptr_t list_length = 0; |
Dart_Handle retval = Dart_ListLength(list, &list_length); |
@@ -129,7 +120,6 @@ static void PrintObjectList(Dart_Handle list, const char* prefix, bool expand) { |
} |
} |
- |
static void PrintObject(Dart_Handle obj, bool expand) { |
Dart_Handle obj_class = Dart_GetObjClass(obj); |
EXPECT_VALID(obj_class); |
@@ -149,7 +139,6 @@ static void PrintObject(Dart_Handle obj, bool expand) { |
PrintObjectList(statics, "static field", false); |
} |
- |
static void PrintValue(Dart_Handle value, bool expand) { |
if (Dart_IsNull(value)) { |
OS::Print("null"); |
@@ -168,7 +157,6 @@ static void PrintValue(Dart_Handle value, bool expand) { |
} |
} |
- |
static void PrintActivationFrame(Dart_ActivationFrame frame) { |
Dart_Handle func_name; |
Dart_Handle res; |
@@ -195,7 +183,6 @@ static void PrintActivationFrame(Dart_ActivationFrame frame) { |
} |
} |
- |
static Dart_Handle GetLocalVariable(Dart_ActivationFrame frame, |
const char* name) { |
Dart_Handle locals = Dart_GetLocalVariables(frame); |
@@ -217,7 +204,6 @@ static Dart_Handle GetLocalVariable(Dart_ActivationFrame frame, |
return Dart_Null(); |
} |
- |
static void PrintStackTrace(Dart_StackTrace trace) { |
intptr_t trace_len; |
Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); |
@@ -230,7 +216,6 @@ static void PrintStackTrace(Dart_StackTrace trace) { |
} |
} |
- |
static void VerifyListEquals(Dart_Handle expected, |
Dart_Handle got, |
bool skip_null_expects) { |
@@ -256,7 +241,6 @@ static void VerifyListEquals(Dart_Handle expected, |
} |
} |
- |
static void VerifyStackFrame(Dart_ActivationFrame frame, |
const char* expected_name, |
Dart_Handle expected_locals, |
@@ -285,7 +269,6 @@ static void VerifyStackFrame(Dart_ActivationFrame frame, |
} |
} |
- |
static void VerifyStackTrace(Dart_StackTrace trace, |
const char* func_names[], |
Dart_Handle local_vars[], |
@@ -321,7 +304,6 @@ static void VerifyStackTrace(Dart_StackTrace trace, |
} |
} |
- |
void TestBreakpointHandler(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -350,7 +332,6 @@ void TestBreakpointHandler(Dart_IsolateId isolate_id, |
} |
} |
- |
TEST_CASE(Debug_Breakpoint) { |
const char* kScriptChars = |
"void moo(s) { } \n" |
@@ -423,7 +404,6 @@ static void SaveStackTrace(Dart_StackTrace trace) { |
} |
} |
- |
static void InspectOptimizedStack_Breakpoint(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& loc) { |
@@ -432,7 +412,6 @@ static void InspectOptimizedStack_Breakpoint(Dart_IsolateId isolate_id, |
SaveStackTrace(trace); |
} |
- |
static void InspectStackTest(bool optimize) { |
const char* kScriptChars = |
"void breakpointNow() {\n" |
@@ -515,19 +494,16 @@ static void InspectStackTest(bool optimize) { |
isolate->set_use_osr(saved_use_osr); |
} |
- |
TEST_CASE(Debug_InspectStack_NotOptimized) { |
InspectStackTest(false); |
} |
- |
TEST_CASE(Debug_InspectStack_Optimized) { |
// Ensure code gets optimized. |
FLAG_background_compilation = false; |
InspectStackTest(true); |
} |
- |
static void InspectStackWithClosureTest(bool optimize) { |
const char* kScriptChars = |
"void breakpointNow() {\n" |
@@ -615,19 +591,16 @@ static void InspectStackWithClosureTest(bool optimize) { |
FLAG_use_osr = saved_osr; |
} |
- |
TEST_CASE(Debug_InspectStackWithClosure_NotOptimized) { |
InspectStackWithClosureTest(false); |
} |
- |
TEST_CASE(Debug_InspectStackWithClosure_Optimized) { |
// Ensure code gets optimized. |
FLAG_background_compilation = false; |
InspectStackWithClosureTest(true); |
} |
- |
void TestStepOutHandler(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -659,7 +632,6 @@ void TestStepOutHandler(Dart_IsolateId isolate_id, |
Dart_SetStepOut(); |
} |
- |
TEST_CASE(Debug_StepOut) { |
const char* kScriptChars = |
"f1() { return 1; } \n" |
@@ -741,7 +713,6 @@ void TestStepIntoHandler(Dart_IsolateId isolate_id, |
Dart_SetStepInto(); |
} |
- |
TEST_CASE(Debug_StepInto) { |
const char* kScriptChars = |
"f1() { return 1; } \n" |
@@ -780,7 +751,6 @@ TEST_CASE(Debug_StepInto) { |
EXPECT(breakpoint_hit_counter == ARRAY_SIZE(step_into_expected_bpts)); |
} |
- |
static void StepIntoHandler(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -796,7 +766,6 @@ static void StepIntoHandler(Dart_IsolateId isolate_id, |
Dart_SetStepInto(); |
} |
- |
TEST_CASE(Debug_IgnoreBP) { |
const char* kScriptChars = |
"class B { \n" |
@@ -826,7 +795,6 @@ TEST_CASE(Debug_IgnoreBP) { |
EXPECT(breakpoint_hit == true); |
} |
- |
TEST_CASE(Debug_DeoptimizeFunction) { |
const char* kScriptChars = |
"foo(x) => 2 * x; \n" |
@@ -844,7 +812,6 @@ TEST_CASE(Debug_DeoptimizeFunction) { |
LoadScript(kScriptChars); |
Dart_SetPausedEventHandler(&StepIntoHandler); |
- |
// Cause function foo to be optimized before we set a BP. |
Dart_Handle res = Invoke("warmup"); |
EXPECT_VALID(res); |
@@ -852,7 +819,6 @@ TEST_CASE(Debug_DeoptimizeFunction) { |
// Now set breakpoint in main and then step into optimized function foo. |
SetBreakpointAtEntry("", "main"); |
- |
breakpoint_hit = false; |
breakpoint_hit_counter = 0; |
Dart_Handle retval = Invoke("main"); |
@@ -863,7 +829,6 @@ TEST_CASE(Debug_DeoptimizeFunction) { |
EXPECT(breakpoint_hit == true); |
} |
- |
void TestSingleStepHandler(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -896,7 +861,6 @@ void TestSingleStepHandler(Dart_IsolateId isolate_id, |
Dart_SetStepOver(); |
} |
- |
TEST_CASE(Debug_SingleStep) { |
const char* kScriptChars = |
"moo(s) { return 1; } \n" |
@@ -923,7 +887,6 @@ TEST_CASE(Debug_SingleStep) { |
EXPECT(breakpoint_hit == true); |
} |
- |
static void ClosureBreakpointHandler(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -951,7 +914,6 @@ static void ClosureBreakpointHandler(Dart_IsolateId isolate_id, |
} |
} |
- |
TEST_CASE(Debug_ClosureBreakpoint) { |
const char* kScriptChars = |
"callback(s) { \n" |
@@ -978,7 +940,6 @@ TEST_CASE(Debug_ClosureBreakpoint) { |
EXPECT_EQ(2, breakpoint_hit_counter); |
} |
- |
static void ExprClosureBreakpointHandler(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -996,7 +957,6 @@ static void ExprClosureBreakpointHandler(Dart_IsolateId isolate_id, |
VerifyStackTrace(trace, expected_trace, expected_locals, 2, false); |
} |
- |
TEST_CASE(Debug_ExprClosureBreakpoint) { |
const char* kScriptChars = |
"var c; \n" |
@@ -1025,7 +985,6 @@ TEST_CASE(Debug_ExprClosureBreakpoint) { |
EXPECT_EQ(1, breakpoint_hit_counter); |
} |
- |
void TestBreakpointHandlerWithVerify(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -1045,14 +1004,12 @@ void TestBreakpointHandlerWithVerify(Dart_IsolateId isolate_id, |
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) { |
@@ -1061,7 +1018,6 @@ static Dart_NativeFunction NoopNativeResolver(Dart_Handle name, |
return &NoopNativeFunction; |
} |
- |
TEST_CASE(Debug_BreakpointStubPatching) { |
// Note changes to this script may require changes to the breakpoint line |
// numbers below. |
@@ -1112,7 +1068,6 @@ TEST_CASE(Debug_BreakpointStubPatching) { |
EXPECT_EQ(num_breakpoints, breakpoint_hit_counter); |
} |
- |
static intptr_t bp_id_to_be_deleted; |
static void DeleteBreakpointHandler(Dart_IsolateId isolate_id, |
@@ -1149,7 +1104,6 @@ static void DeleteBreakpointHandler(Dart_IsolateId isolate_id, |
} |
} |
- |
TEST_CASE(Debug_DeleteBreakpoint) { |
const char* kScriptChars = |
"moo(s) { } \n" |
@@ -1186,7 +1140,6 @@ TEST_CASE(Debug_DeleteBreakpoint) { |
EXPECT_EQ(2, breakpoint_hit_counter); |
} |
- |
static void InspectStaticFieldHandler(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -1243,7 +1196,6 @@ static void InspectStaticFieldHandler(Dart_IsolateId isolate_id, |
} |
} |
- |
TEST_CASE(Debug_InspectStaticField) { |
const char* kScriptChars = |
" class A { \n" |
@@ -1269,7 +1221,6 @@ TEST_CASE(Debug_InspectStaticField) { |
EXPECT_VALID(retval); |
} |
- |
TEST_CASE(Debug_InspectObject) { |
const char* kScriptChars = |
" class A { \n" |
@@ -1391,7 +1342,6 @@ TEST_CASE(Debug_InspectObject) { |
EXPECT(Dart_IsError(value_handle)); |
} |
- |
static Dart_IsolateId test_isolate_id = ILLEGAL_ISOLATE_ID; |
static int verify_callback = 0; |
static void TestIsolateID(Dart_IsolateId isolate_id, Dart_IsolateEvent kind) { |
@@ -1414,7 +1364,6 @@ static void TestIsolateID(Dart_IsolateId isolate_id, Dart_IsolateEvent kind) { |
} |
} |
- |
VM_UNIT_TEST_CASE(Debug_IsolateID) { |
const char* kScriptChars = |
"void moo(s) { } \n" |
@@ -1443,7 +1392,6 @@ VM_UNIT_TEST_CASE(Debug_IsolateID) { |
EXPECT(verify_callback == 0x5); // Only created and shutdown events. |
} |
- |
static Monitor* sync = NULL; |
static bool isolate_interrupted = false; |
static bool pause_event_handled = false; |
@@ -1451,7 +1399,6 @@ static bool interrupt_thread_stopped = false; |
static Dart_IsolateId interrupt_isolate_id = ILLEGAL_ISOLATE_ID; |
static volatile bool continue_isolate_loop = true; |
- |
static void InterruptIsolateHandler(Dart_IsolateId isolateId, |
intptr_t breakpointId, |
const Dart_CodeLocation& location) { |
@@ -1487,7 +1434,6 @@ static void TestInterruptIsolate(Dart_IsolateId isolate_id, |
} |
} |
- |
static void InterruptNativeFunction(Dart_NativeArguments args) { |
Dart_EnterScope(); |
Dart_Handle val = Dart_NewBoolean(continue_isolate_loop); |
@@ -1495,7 +1441,6 @@ static void InterruptNativeFunction(Dart_NativeArguments args) { |
Dart_ExitScope(); |
} |
- |
static Dart_NativeFunction InterruptNativeResolver(Dart_Handle name, |
int arg_count, |
bool* auto_setup_scope) { |
@@ -1504,7 +1449,6 @@ static Dart_NativeFunction InterruptNativeResolver(Dart_Handle name, |
return &InterruptNativeFunction; |
} |
- |
static void InterruptIsolateRun(uword unused) { |
const char* kScriptChars = |
"void moo(s) { } \n" |
@@ -1543,7 +1487,6 @@ static void InterruptIsolateRun(uword unused) { |
} |
} |
- |
TEST_CASE(Debug_InterruptIsolate) { |
bool saved_flag = FLAG_trace_shutdown; |
FLAG_trace_shutdown = true; |
@@ -1607,7 +1550,6 @@ TEST_CASE(Debug_InterruptIsolate) { |
FLAG_trace_shutdown = saved_flag; |
} |
- |
static void StackTraceDump1BreakpointHandler( |
Dart_IsolateId isolate_id, |
intptr_t bp_id, |
@@ -1694,7 +1636,6 @@ static void StackTraceDump1BreakpointHandler( |
true); |
} |
- |
TEST_CASE(Debug_StackTraceDump1) { |
const char* kScriptChars = |
"class Test {\n" |
@@ -1756,7 +1697,6 @@ TEST_CASE(Debug_StackTraceDump1) { |
EXPECT_EQ(1, breakpoint_hit_counter); |
} |
- |
static void StackTraceDump2ExceptionHandler(Dart_IsolateId isolate_id, |
Dart_Handle exception_object, |
Dart_StackTrace trace) { |
@@ -1852,7 +1792,6 @@ static void StackTraceDump2ExceptionHandler(Dart_IsolateId isolate_id, |
true); |
} |
- |
TEST_CASE(Debug_StackTraceDump2) { |
const char* kScriptChars = |
"class Test {\n" |
@@ -1905,7 +1844,6 @@ TEST_CASE(Debug_StackTraceDump2) { |
EXPECT_EQ(1, breakpoint_hit_counter); |
} |
- |
void TestEvaluateHandler(Dart_IsolateId isolate_id, |
intptr_t bp_id, |
const Dart_CodeLocation& location) { |
@@ -1947,7 +1885,6 @@ void TestEvaluateHandler(Dart_IsolateId isolate_id, |
breakpoint_hit_counter++; |
} |
- |
TEST_CASE(Debug_EvaluateExpr) { |
const char* kScriptChars = |
"import 'dart:math'; \n" |
@@ -1969,7 +1906,6 @@ TEST_CASE(Debug_EvaluateExpr) { |
LoadScript(kScriptChars); |
Dart_SetPausedEventHandler(&TestEvaluateHandler); |
- |
Dart_Handle script_url = NewString(TestCase::url()); |
intptr_t line_no = 4; |
Dart_Handle res = Dart_SetBreakpoint(script_url, line_no); |
@@ -2046,7 +1982,6 @@ TEST_CASE(Debug_EvaluateExpr) { |
EXPECT(Dart_IsError(error)); |
} |
- |
static void EvaluateInActivationOfEvaluateHandler(Dart_IsolateId isolate_id, |
Dart_Handle exception_object, |
Dart_StackTrace trace) { |
@@ -2060,7 +1995,6 @@ static void EvaluateInActivationOfEvaluateHandler(Dart_IsolateId isolate_id, |
EXPECT_EQ(5.0, ToDouble(result)); |
} |
- |
TEST_CASE(Debug_EvaluateInActivationOfEvaluate) { |
// This library deliberately declares no top-level variables or methods. This |
// exercises a path in eval where a library may have no top-level anonymous |
@@ -2085,14 +2019,12 @@ TEST_CASE(Debug_EvaluateInActivationOfEvaluate) { |
EXPECT_EQ(1, breakpoint_hit_counter); |
} |
- |
static void UnhandledExceptionHandler(Dart_IsolateId isolate_id, |
Dart_Handle exception_object, |
Dart_StackTrace trace) { |
breakpoint_hit_counter++; |
} |
- |
// Check that the debugger is not called when an exception is |
// caught by Dart code. |
TEST_CASE(Debug_BreakOnUnhandledException) { |
@@ -2130,7 +2062,6 @@ TEST_CASE(Debug_BreakOnUnhandledException) { |
EXPECT_EQ(1, breakpoint_hit_counter); |
} |
- |
TEST_CASE(Debug_GetClosureInfo) { |
const char* kScriptChars = |
"void foo() { return 43; } \n" |
@@ -2162,7 +2093,6 @@ TEST_CASE(Debug_GetClosureInfo) { |
EXPECT(loc.library_id > 0); |
} |
- |
TEST_CASE(Debug_GetSupertype) { |
const char* kScriptChars = |
"class Test {\n" |
@@ -2182,7 +2112,6 @@ TEST_CASE(Debug_GetSupertype) { |
"int main() {\n" |
"}\n"; |
- |
Zone* zone = thread->zone(); |
LoadScript(kScriptChars); |
ASSERT(script_lib != NULL); |
@@ -2269,7 +2198,6 @@ TEST_CASE(Debug_GetSupertype) { |
} |
} |
- |
TEST_CASE(Debug_ListSuperType) { |
const char* kScriptChars = |
"List testMain() {" |