| 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_tools_api.h" | 5 #include "include/dart_tools_api.h" |
| 6 | 6 |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 return I->debugger()->CacheObject(obj); | 70 return I->debugger()->CacheObject(obj); |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) { | 74 DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) { |
| 75 DARTSCOPE(Thread::Current()); | 75 DARTSCOPE(Thread::Current()); |
| 76 Isolate* I = T->isolate(); | 76 Isolate* I = T->isolate(); |
| 77 CHECK_DEBUGGER(I); | 77 CHECK_DEBUGGER(I); |
| 78 if (!I->debugger()->IsValidObjectId(obj_id)) { | 78 if (!I->debugger()->IsValidObjectId(obj_id)) { |
| 79 return Api::NewError("%s: object id %" Pd " is invalid", | 79 return Api::NewError("%s: object id %" Pd " is invalid", CURRENT_FUNC, |
| 80 CURRENT_FUNC, obj_id); | 80 obj_id); |
| 81 } | 81 } |
| 82 return Api::NewHandle(T, I->debugger()->GetCachedObject(obj_id)); | 82 return Api::NewHandle(T, I->debugger()->GetCachedObject(obj_id)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 DART_EXPORT Dart_Handle Dart_StackTraceLength( | 86 DART_EXPORT Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace, |
| 87 Dart_StackTrace trace, | 87 intptr_t* length) { |
| 88 intptr_t* length) { | |
| 89 DARTSCOPE(Thread::Current()); | 88 DARTSCOPE(Thread::Current()); |
| 90 CHECK_NOT_NULL(length); | 89 CHECK_NOT_NULL(length); |
| 91 CHECK_AND_CAST(DebuggerStackTrace, stack_trace, trace); | 90 CHECK_AND_CAST(DebuggerStackTrace, stack_trace, trace); |
| 92 *length = stack_trace->Length(); | 91 *length = stack_trace->Length(); |
| 93 return Api::Success(); | 92 return Api::Success(); |
| 94 } | 93 } |
| 95 | 94 |
| 96 | 95 |
| 97 DART_EXPORT Dart_Handle Dart_GetActivationFrame( | 96 DART_EXPORT Dart_Handle Dart_GetActivationFrame(Dart_StackTrace trace, |
| 98 Dart_StackTrace trace, | 97 int frame_index, |
| 99 int frame_index, | 98 Dart_ActivationFrame* frame) { |
| 100 Dart_ActivationFrame* frame) { | |
| 101 DARTSCOPE(Thread::Current()); | 99 DARTSCOPE(Thread::Current()); |
| 102 CHECK_NOT_NULL(frame); | 100 CHECK_NOT_NULL(frame); |
| 103 CHECK_AND_CAST(DebuggerStackTrace, stack_trace, trace); | 101 CHECK_AND_CAST(DebuggerStackTrace, stack_trace, trace); |
| 104 if ((frame_index < 0) || (frame_index >= stack_trace->Length())) { | 102 if ((frame_index < 0) || (frame_index >= stack_trace->Length())) { |
| 105 return Api::NewError("argument 'frame_index' is out of range for %s", | 103 return Api::NewError("argument 'frame_index' is out of range for %s", |
| 106 CURRENT_FUNC); | 104 CURRENT_FUNC); |
| 107 } | 105 } |
| 108 *frame = reinterpret_cast<Dart_ActivationFrame>( | 106 *frame = |
| 109 stack_trace->FrameAt(frame_index)); | 107 reinterpret_cast<Dart_ActivationFrame>(stack_trace->FrameAt(frame_index)); |
| 110 return Api::Success(); | 108 return Api::Success(); |
| 111 } | 109 } |
| 112 | 110 |
| 113 static Dart_PausedEventHandler* paused_event_handler = NULL; | 111 static Dart_PausedEventHandler* paused_event_handler = NULL; |
| 114 static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL; | 112 static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL; |
| 115 static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL; | 113 static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL; |
| 116 static Dart_IsolateEventHandler* isolate_event_handler = NULL; | 114 static Dart_IsolateEventHandler* isolate_event_handler = NULL; |
| 117 | 115 |
| 118 | 116 |
| 119 static void DebuggerEventHandler(ServiceEvent* event) { | 117 static void DebuggerEventHandler(ServiceEvent* event) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 134 if (event->breakpoint() != NULL) { | 132 if (event->breakpoint() != NULL) { |
| 135 ASSERT(event->breakpoint()->id() != ILLEGAL_BREAKPOINT_ID); | 133 ASSERT(event->breakpoint()->id() != ILLEGAL_BREAKPOINT_ID); |
| 136 bp_id = event->breakpoint()->id(); | 134 bp_id = event->breakpoint()->id(); |
| 137 } | 135 } |
| 138 (*paused_event_handler)(isolate_id, bp_id, location); | 136 (*paused_event_handler)(isolate_id, bp_id, location); |
| 139 } | 137 } |
| 140 } else if (event->kind() == ServiceEvent::kBreakpointAdded || | 138 } else if (event->kind() == ServiceEvent::kBreakpointAdded || |
| 141 event->kind() == ServiceEvent::kBreakpointResolved) { | 139 event->kind() == ServiceEvent::kBreakpointResolved) { |
| 142 Breakpoint* bpt = event->breakpoint(); | 140 Breakpoint* bpt = event->breakpoint(); |
| 143 ASSERT(bpt != NULL); | 141 ASSERT(bpt != NULL); |
| 144 if (bp_resolved_handler != NULL && | 142 if (bp_resolved_handler != NULL && bpt->bpt_location()->IsResolved() && |
| 145 bpt->bpt_location()->IsResolved() && | |
| 146 !bpt->IsSingleShot()) { | 143 !bpt->IsSingleShot()) { |
| 147 Dart_CodeLocation location; | 144 Dart_CodeLocation location; |
| 148 Zone* zone = thread->zone(); | 145 Zone* zone = thread->zone(); |
| 149 Library& library = Library::Handle(zone); | 146 Library& library = Library::Handle(zone); |
| 150 Script& script = Script::Handle(zone); | 147 Script& script = Script::Handle(zone); |
| 151 TokenPosition token_pos; | 148 TokenPosition token_pos; |
| 152 bpt->bpt_location()->GetCodeLocation(&library, &script, &token_pos); | 149 bpt->bpt_location()->GetCodeLocation(&library, &script, &token_pos); |
| 153 location.script_url = Api::NewHandle(thread, script.url()); | 150 location.script_url = Api::NewHandle(thread, script.url()); |
| 154 location.library_id = library.index(); | 151 location.library_id = library.index(); |
| 155 location.token_pos = token_pos.Pos(); | 152 location.token_pos = token_pos.Pos(); |
| 156 (*bp_resolved_handler)(isolate_id, bpt->id(), location); | 153 (*bp_resolved_handler)(isolate_id, bpt->id(), location); |
| 157 } | 154 } |
| 158 } else if (event->kind() == ServiceEvent::kBreakpointRemoved) { | 155 } else if (event->kind() == ServiceEvent::kBreakpointRemoved) { |
| 159 // Ignore. | 156 // Ignore. |
| 160 } else if (event->kind() == ServiceEvent::kPauseException) { | 157 } else if (event->kind() == ServiceEvent::kPauseException) { |
| 161 if (exc_thrown_handler != NULL) { | 158 if (exc_thrown_handler != NULL) { |
| 162 Dart_Handle exception = | 159 Dart_Handle exception = Api::NewHandle(thread, event->exception()->raw()); |
| 163 Api::NewHandle(thread, event->exception()->raw()); | |
| 164 Dart_StackTrace trace = | 160 Dart_StackTrace trace = |
| 165 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); | 161 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); |
| 166 (*exc_thrown_handler)(isolate_id, exception, trace); | 162 (*exc_thrown_handler)(isolate_id, exception, trace); |
| 167 } | 163 } |
| 168 } else if (event->kind() == ServiceEvent::kIsolateStart) { | 164 } else if (event->kind() == ServiceEvent::kIsolateStart) { |
| 169 if (isolate_event_handler != NULL) { | 165 if (isolate_event_handler != NULL) { |
| 170 (*isolate_event_handler)(event->isolate_id(), kCreated); | 166 (*isolate_event_handler)(event->isolate_id(), kCreated); |
| 171 } | 167 } |
| 172 } else if (event->kind() == ServiceEvent::kPauseInterrupted) { | 168 } else if (event->kind() == ServiceEvent::kPauseInterrupted) { |
| 173 if (isolate_event_handler != NULL) { | 169 if (isolate_event_handler != NULL) { |
| 174 (*isolate_event_handler)(event->isolate_id(), kInterrupted); | 170 (*isolate_event_handler)(event->isolate_id(), kInterrupted); |
| 175 } | 171 } |
| 176 } else if (event->kind() == ServiceEvent::kIsolateExit) { | 172 } else if (event->kind() == ServiceEvent::kIsolateExit) { |
| 177 if (isolate_event_handler != NULL) { | 173 if (isolate_event_handler != NULL) { |
| 178 (*isolate_event_handler)(event->isolate_id(), kShutdown); | 174 (*isolate_event_handler)(event->isolate_id(), kShutdown); |
| 179 } | 175 } |
| 180 } else { | 176 } else { |
| 181 UNIMPLEMENTED(); | 177 UNIMPLEMENTED(); |
| 182 } | 178 } |
| 183 Dart_ExitScope(); | 179 Dart_ExitScope(); |
| 184 } | 180 } |
| 185 | 181 |
| 186 | 182 |
| 187 DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) { | 183 DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) { |
| 188 paused_event_handler = handler; | 184 paused_event_handler = handler; |
| 189 Debugger::SetEventHandler(DebuggerEventHandler); | 185 Debugger::SetEventHandler(DebuggerEventHandler); |
| 190 } | 186 } |
| 191 | 187 |
| 192 | 188 |
| 193 DART_EXPORT void Dart_SetBreakpointResolvedHandler( | 189 DART_EXPORT void Dart_SetBreakpointResolvedHandler( |
| 194 Dart_BreakpointResolvedHandler handler) { | 190 Dart_BreakpointResolvedHandler handler) { |
| 195 bp_resolved_handler = handler; | 191 bp_resolved_handler = handler; |
| 196 Debugger::SetEventHandler(DebuggerEventHandler); | 192 Debugger::SetEventHandler(DebuggerEventHandler); |
| 197 } | 193 } |
| 198 | 194 |
| 199 | 195 |
| 200 DART_EXPORT void Dart_SetExceptionThrownHandler( | 196 DART_EXPORT void Dart_SetExceptionThrownHandler( |
| 201 Dart_ExceptionThrownHandler handler) { | 197 Dart_ExceptionThrownHandler handler) { |
| 202 exc_thrown_handler = handler; | 198 exc_thrown_handler = handler; |
| 203 Debugger::SetEventHandler(DebuggerEventHandler); | 199 Debugger::SetEventHandler(DebuggerEventHandler); |
| 204 } | 200 } |
| 205 | 201 |
| 206 | 202 |
| 207 DART_EXPORT void Dart_SetIsolateEventHandler(Dart_IsolateEventHandler handler) { | 203 DART_EXPORT void Dart_SetIsolateEventHandler(Dart_IsolateEventHandler handler) { |
| 208 isolate_event_handler = handler; | 204 isolate_event_handler = handler; |
| 209 Debugger::SetEventHandler(DebuggerEventHandler); | 205 Debugger::SetEventHandler(DebuggerEventHandler); |
| 210 } | 206 } |
| 211 | 207 |
| 212 | 208 |
| 213 DART_EXPORT Dart_Handle Dart_SetExceptionPauseInfo( | 209 DART_EXPORT Dart_Handle |
| 214 Dart_ExceptionPauseInfo pause_info) { | 210 Dart_SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { |
| 215 DARTSCOPE(Thread::Current()); | 211 DARTSCOPE(Thread::Current()); |
| 216 Isolate* I = T->isolate(); | 212 Isolate* I = T->isolate(); |
| 217 CHECK_DEBUGGER(I); | 213 CHECK_DEBUGGER(I); |
| 218 I->debugger()->SetExceptionPauseInfo(pause_info); | 214 I->debugger()->SetExceptionPauseInfo(pause_info); |
| 219 return Api::Success(); | 215 return Api::Success(); |
| 220 } | 216 } |
| 221 | 217 |
| 222 | 218 |
| 223 DART_EXPORT Dart_ExceptionPauseInfo Dart_GetExceptionPauseInfo() { | 219 DART_EXPORT Dart_ExceptionPauseInfo Dart_GetExceptionPauseInfo() { |
| 224 DARTSCOPE(Thread::Current()); | 220 DARTSCOPE(Thread::Current()); |
| 225 Isolate* I = T->isolate(); | 221 Isolate* I = T->isolate(); |
| 226 if (I->debugger() == NULL) { | 222 if (I->debugger() == NULL) { |
| 227 return kNoPauseOnExceptions; | 223 return kNoPauseOnExceptions; |
| 228 } | 224 } |
| 229 return I->debugger()->GetExceptionPauseInfo(); | 225 return I->debugger()->GetExceptionPauseInfo(); |
| 230 } | 226 } |
| 231 | 227 |
| 232 | 228 |
| 233 DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) { | 229 DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) { |
| 234 DARTSCOPE(Thread::Current()); | 230 DARTSCOPE(Thread::Current()); |
| 235 Isolate* I = T->isolate(); | 231 Isolate* I = T->isolate(); |
| 236 CHECK_DEBUGGER(I); | 232 CHECK_DEBUGGER(I); |
| 237 CHECK_NOT_NULL(trace); | 233 CHECK_NOT_NULL(trace); |
| 238 *trace = reinterpret_cast<Dart_StackTrace>( | 234 *trace = |
| 239 I->debugger()->CurrentStackTrace()); | 235 reinterpret_cast<Dart_StackTrace>(I->debugger()->CurrentStackTrace()); |
| 240 return Api::Success(); | 236 return Api::Success(); |
| 241 } | 237 } |
| 242 | 238 |
| 243 | 239 |
| 244 DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle, | 240 DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle, |
| 245 Dart_StackTrace* trace) { | 241 Dart_StackTrace* trace) { |
| 246 DARTSCOPE(Thread::Current()); | 242 DARTSCOPE(Thread::Current()); |
| 247 CHECK_DEBUGGER(T->isolate()); | 243 CHECK_DEBUGGER(T->isolate()); |
| 248 CHECK_NOT_NULL(trace); | 244 CHECK_NOT_NULL(trace); |
| 249 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle)); | 245 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle)); |
| 250 if (obj.IsUnhandledException()) { | 246 if (obj.IsUnhandledException()) { |
| 251 const UnhandledException& error = UnhandledException::Cast(obj); | 247 const UnhandledException& error = UnhandledException::Cast(obj); |
| 252 Stacktrace& dart_stacktrace = Stacktrace::Handle(Z); | 248 Stacktrace& dart_stacktrace = Stacktrace::Handle(Z); |
| 253 dart_stacktrace ^= error.stacktrace(); | 249 dart_stacktrace ^= error.stacktrace(); |
| 254 if (dart_stacktrace.IsNull()) { | 250 if (dart_stacktrace.IsNull()) { |
| 255 *trace = NULL; | 251 *trace = NULL; |
| 256 } else { | 252 } else { |
| 257 Isolate* I = T->isolate(); | 253 Isolate* I = T->isolate(); |
| 258 *trace = reinterpret_cast<Dart_StackTrace>( | 254 *trace = reinterpret_cast<Dart_StackTrace>( |
| 259 I->debugger()->StackTraceFrom(dart_stacktrace)); | 255 I->debugger()->StackTraceFrom(dart_stacktrace)); |
| 260 } | 256 } |
| 261 return Api::Success(); | 257 return Api::Success(); |
| 262 } else { | 258 } else { |
| 263 return Api::NewError("Can only get stacktraces from error handles or " | 259 return Api::NewError( |
| 264 "instances of Error."); | 260 "Can only get stacktraces from error handles or " |
| 261 "instances of Error."); |
| 265 } | 262 } |
| 266 } | 263 } |
| 267 | 264 |
| 268 | 265 |
| 269 DART_EXPORT Dart_Handle Dart_ActivationFrameInfo( | 266 DART_EXPORT Dart_Handle |
| 270 Dart_ActivationFrame activation_frame, | 267 Dart_ActivationFrameInfo(Dart_ActivationFrame activation_frame, |
| 271 Dart_Handle* function_name, | 268 Dart_Handle* function_name, |
| 272 Dart_Handle* script_url, | 269 Dart_Handle* script_url, |
| 273 intptr_t* line_number, | 270 intptr_t* line_number, |
| 274 intptr_t* column_number) { | 271 intptr_t* column_number) { |
| 275 DARTSCOPE(Thread::Current()); | 272 DARTSCOPE(Thread::Current()); |
| 276 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); | 273 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
| 277 if (function_name != NULL) { | 274 if (function_name != NULL) { |
| 278 *function_name = Api::NewHandle(T, frame->QualifiedFunctionName()); | 275 *function_name = Api::NewHandle(T, frame->QualifiedFunctionName()); |
| 279 } | 276 } |
| 280 if (script_url != NULL) { | 277 if (script_url != NULL) { |
| 281 *script_url = Api::NewHandle(T, frame->SourceUrl()); | 278 *script_url = Api::NewHandle(T, frame->SourceUrl()); |
| 282 } | 279 } |
| 283 if (line_number != NULL) { | 280 if (line_number != NULL) { |
| 284 *line_number = frame->LineNumber(); | 281 *line_number = frame->LineNumber(); |
| 285 } | 282 } |
| 286 if (column_number != NULL) { | 283 if (column_number != NULL) { |
| 287 *column_number = frame->ColumnNumber(); | 284 *column_number = frame->ColumnNumber(); |
| 288 } | 285 } |
| 289 return Api::Success(); | 286 return Api::Success(); |
| 290 } | 287 } |
| 291 | 288 |
| 292 | 289 |
| 293 DART_EXPORT Dart_Handle Dart_ActivationFrameGetLocation( | 290 DART_EXPORT Dart_Handle |
| 294 Dart_ActivationFrame activation_frame, | 291 Dart_ActivationFrameGetLocation(Dart_ActivationFrame activation_frame, |
| 295 Dart_Handle* function_name, | 292 Dart_Handle* function_name, |
| 296 Dart_Handle* function, | 293 Dart_Handle* function, |
| 297 Dart_CodeLocation* location) { | 294 Dart_CodeLocation* location) { |
| 298 // TODO(hausner): Implement a way to recognize when there | 295 // TODO(hausner): Implement a way to recognize when there |
| 299 // is no source code for the code in the frame. | 296 // is no source code for the code in the frame. |
| 300 DARTSCOPE(Thread::Current()); | 297 DARTSCOPE(Thread::Current()); |
| 301 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); | 298 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
| 302 if (function_name != NULL) { | 299 if (function_name != NULL) { |
| 303 *function_name = Api::NewHandle(T, frame->QualifiedFunctionName()); | 300 *function_name = Api::NewHandle(T, frame->QualifiedFunctionName()); |
| 304 } | 301 } |
| 305 if (function != NULL) { | 302 if (function != NULL) { |
| 306 *function = Api::NewHandle(T, frame->function().raw()); | 303 *function = Api::NewHandle(T, frame->function().raw()); |
| 307 } | 304 } |
| 308 | 305 |
| 309 if (location != NULL) { | 306 if (location != NULL) { |
| 310 location->script_url = Api::NewHandle(T, frame->SourceUrl()); | 307 location->script_url = Api::NewHandle(T, frame->SourceUrl()); |
| 311 const Library& lib = Library::Handle(Z, frame->Library()); | 308 const Library& lib = Library::Handle(Z, frame->Library()); |
| 312 location->library_id = lib.index(); | 309 location->library_id = lib.index(); |
| 313 location->token_pos = frame->TokenPos().Pos(); | 310 location->token_pos = frame->TokenPos().Pos(); |
| 314 } | 311 } |
| 315 return Api::Success(); | 312 return Api::Success(); |
| 316 } | 313 } |
| 317 | 314 |
| 318 DART_EXPORT Dart_Handle Dart_ActivationFrameGetFramePointer( | 315 DART_EXPORT Dart_Handle |
| 319 Dart_ActivationFrame activation_frame, | 316 Dart_ActivationFrameGetFramePointer(Dart_ActivationFrame activation_frame, |
| 320 uintptr_t* frame_pointer) { | 317 uintptr_t* frame_pointer) { |
| 321 DARTSCOPE(Thread::Current()); | 318 DARTSCOPE(Thread::Current()); |
| 322 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); | 319 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
| 323 | 320 |
| 324 if (frame_pointer != NULL) { | 321 if (frame_pointer != NULL) { |
| 325 *frame_pointer = static_cast<uintptr_t>(frame->fp()); | 322 *frame_pointer = static_cast<uintptr_t>(frame->fp()); |
| 326 } | 323 } |
| 327 return Api::Success(); | 324 return Api::Success(); |
| 328 } | 325 } |
| 329 | 326 |
| 330 | 327 |
| 331 DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) { | 328 DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) { |
| 332 DARTSCOPE(Thread::Current()); | 329 DARTSCOPE(Thread::Current()); |
| 333 UNWRAP_AND_CHECK_PARAM(Function, function, function_in); | 330 UNWRAP_AND_CHECK_PARAM(Function, function, function_in); |
| 334 | 331 |
| 335 const Class& cls = Class::Handle(Z, function.origin()); | 332 const Class& cls = Class::Handle(Z, function.origin()); |
| 336 if (!cls.IsTopLevel()) { | 333 if (!cls.IsTopLevel()) { |
| 337 return Dart_NewInteger(cls.id()); | 334 return Dart_NewInteger(cls.id()); |
| 338 } | 335 } |
| 339 return Api::Null(); | 336 return Api::Null(); |
| 340 } | 337 } |
| 341 | 338 |
| 342 | 339 |
| 343 DART_EXPORT Dart_Handle Dart_GetLocalVariables( | 340 DART_EXPORT Dart_Handle |
| 344 Dart_ActivationFrame activation_frame) { | 341 Dart_GetLocalVariables(Dart_ActivationFrame activation_frame) { |
| 345 DARTSCOPE(Thread::Current()); | 342 DARTSCOPE(Thread::Current()); |
| 346 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); | 343 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
| 347 return Api::NewHandle(T, frame->GetLocalVariables()); | 344 return Api::NewHandle(T, frame->GetLocalVariables()); |
| 348 } | 345 } |
| 349 | 346 |
| 350 | 347 |
| 351 DART_EXPORT Dart_Handle Dart_SetBreakpoint( | 348 DART_EXPORT Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url_in, |
| 352 Dart_Handle script_url_in, | 349 intptr_t line_number) { |
| 353 intptr_t line_number) { | |
| 354 DARTSCOPE(Thread::Current()); | 350 DARTSCOPE(Thread::Current()); |
| 355 Isolate* I = T->isolate(); | 351 Isolate* I = T->isolate(); |
| 356 CHECK_DEBUGGER(I); | 352 CHECK_DEBUGGER(I); |
| 357 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 353 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 358 | 354 |
| 359 Debugger* debugger = I->debugger(); | 355 Debugger* debugger = I->debugger(); |
| 360 Breakpoint* bpt = | 356 Breakpoint* bpt = debugger->SetBreakpointAtLine(script_url, line_number); |
| 361 debugger->SetBreakpointAtLine(script_url, line_number); | |
| 362 if (bpt == NULL) { | 357 if (bpt == NULL) { |
| 363 return Api::NewError("%s: could not set breakpoint at line %" Pd " in '%s'", | 358 return Api::NewError("%s: could not set breakpoint at line %" Pd " in '%s'", |
| 364 CURRENT_FUNC, line_number, script_url.ToCString()); | 359 CURRENT_FUNC, line_number, script_url.ToCString()); |
| 365 } | 360 } |
| 366 return Dart_NewInteger(bpt->id()); | 361 return Dart_NewInteger(bpt->id()); |
| 367 } | 362 } |
| 368 | 363 |
| 369 | 364 |
| 370 DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) { | 365 DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) { |
| 371 DARTSCOPE(Thread::Current()); | 366 DARTSCOPE(Thread::Current()); |
| 372 Isolate* I = T->isolate(); | 367 Isolate* I = T->isolate(); |
| 373 CHECK_DEBUGGER(I); | 368 CHECK_DEBUGGER(I); |
| 374 Debugger* debugger = I->debugger(); | 369 Debugger* debugger = I->debugger(); |
| 375 | 370 |
| 376 Breakpoint* bpt = debugger->GetBreakpointById(bp_id); | 371 Breakpoint* bpt = debugger->GetBreakpointById(bp_id); |
| 377 if (bpt == NULL) { | 372 if (bpt == NULL) { |
| 378 return Api::NewError("%s: breakpoint with id %" Pd " does not exist", | 373 return Api::NewError("%s: breakpoint with id %" Pd " does not exist", |
| 379 CURRENT_FUNC, bp_id); | 374 CURRENT_FUNC, bp_id); |
| 380 } | 375 } |
| 381 return Api::NewHandle(T, bpt->bpt_location()->url()); | 376 return Api::NewHandle(T, bpt->bpt_location()->url()); |
| 382 } | 377 } |
| 383 | 378 |
| 384 | 379 |
| 385 DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) { | 380 DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) { |
| 386 DARTSCOPE(Thread::Current()); | 381 DARTSCOPE(Thread::Current()); |
| 387 Isolate* I = T->isolate(); | 382 Isolate* I = T->isolate(); |
| 388 CHECK_DEBUGGER(I); | 383 CHECK_DEBUGGER(I); |
| 389 Debugger* debugger = I->debugger(); | 384 Debugger* debugger = I->debugger(); |
| 390 | 385 |
| 391 Breakpoint* bpt = debugger->GetBreakpointById(bp_id); | 386 Breakpoint* bpt = debugger->GetBreakpointById(bp_id); |
| 392 if (bpt == NULL) { | 387 if (bpt == NULL) { |
| 393 return Api::NewError("%s: breakpoint with id %" Pd " does not exist", | 388 return Api::NewError("%s: breakpoint with id %" Pd " does not exist", |
| 394 CURRENT_FUNC, bp_id); | 389 CURRENT_FUNC, bp_id); |
| 395 } | 390 } |
| 396 if (bpt->bpt_location()->IsResolved()) { | 391 if (bpt->bpt_location()->IsResolved()) { |
| 397 return Dart_NewInteger(bpt->bpt_location()->LineNumber()); | 392 return Dart_NewInteger(bpt->bpt_location()->LineNumber()); |
| 398 } else { | 393 } else { |
| 399 return Dart_NewInteger(bpt->bpt_location()->requested_line_number()); | 394 return Dart_NewInteger(bpt->bpt_location()->requested_line_number()); |
| 400 } | 395 } |
| 401 } | 396 } |
| 402 | 397 |
| 403 | 398 |
| 404 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry( | 399 DART_EXPORT Dart_Handle |
| 405 Dart_Handle library_in, | 400 Dart_SetBreakpointAtEntry(Dart_Handle library_in, |
| 406 Dart_Handle class_name_in, | 401 Dart_Handle class_name_in, |
| 407 Dart_Handle function_name_in) { | 402 Dart_Handle function_name_in) { |
| 408 DARTSCOPE(Thread::Current()); | 403 DARTSCOPE(Thread::Current()); |
| 409 Isolate* I = T->isolate(); | 404 Isolate* I = T->isolate(); |
| 410 CHECK_DEBUGGER(I); | 405 CHECK_DEBUGGER(I); |
| 411 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); | 406 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); |
| 412 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); | 407 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); |
| 413 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); | 408 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); |
| 414 | 409 |
| 415 // Ensure that the library is loaded. | 410 // Ensure that the library is loaded. |
| 416 if (!library.Loaded()) { | 411 if (!library.Loaded()) { |
| 417 return Api::NewError( | 412 return Api::NewError( |
| 418 "%s expects library argument 'library_in' to be loaded.", | 413 "%s expects library argument 'library_in' to be loaded.", CURRENT_FUNC); |
| 419 CURRENT_FUNC); | |
| 420 } | 414 } |
| 421 | 415 |
| 422 // Resolve the breakpoint target function. | 416 // Resolve the breakpoint target function. |
| 423 Debugger* debugger = I->debugger(); | 417 Debugger* debugger = I->debugger(); |
| 424 const Function& bp_target = Function::Handle( | 418 const Function& bp_target = Function::Handle( |
| 425 debugger->ResolveFunction(library, class_name, function_name)); | 419 debugger->ResolveFunction(library, class_name, function_name)); |
| 426 if (bp_target.IsNull()) { | 420 if (bp_target.IsNull()) { |
| 427 const bool toplevel = class_name.Length() == 0; | 421 const bool toplevel = class_name.Length() == 0; |
| 428 return Api::NewError("%s: could not find function '%s%s%s'", | 422 return Api::NewError("%s: could not find function '%s%s%s'", CURRENT_FUNC, |
| 429 CURRENT_FUNC, | |
| 430 toplevel ? "" : class_name.ToCString(), | 423 toplevel ? "" : class_name.ToCString(), |
| 431 toplevel ? "" : ".", | 424 toplevel ? "" : ".", function_name.ToCString()); |
| 432 function_name.ToCString()); | |
| 433 } | 425 } |
| 434 | 426 |
| 435 Breakpoint* bpt = debugger->SetBreakpointAtEntry(bp_target, false); | 427 Breakpoint* bpt = debugger->SetBreakpointAtEntry(bp_target, false); |
| 436 if (bpt == NULL) { | 428 if (bpt == NULL) { |
| 437 const char* target_name = Debugger::QualifiedFunctionName(bp_target); | 429 const char* target_name = Debugger::QualifiedFunctionName(bp_target); |
| 438 return Api::NewError("%s: no breakpoint location found in '%s'", | 430 return Api::NewError("%s: no breakpoint location found in '%s'", |
| 439 CURRENT_FUNC, target_name); | 431 CURRENT_FUNC, target_name); |
| 440 } | 432 } |
| 441 return Dart_NewInteger(bpt->id()); | 433 return Dart_NewInteger(bpt->id()); |
| 442 } | 434 } |
| 443 | 435 |
| 444 | 436 |
| 445 DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry( | 437 DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(Dart_Handle library_in, |
| 446 Dart_Handle library_in, | 438 Dart_Handle class_name_in, |
| 447 Dart_Handle class_name_in, | 439 Dart_Handle function_name_in) { |
| 448 Dart_Handle function_name_in) { | |
| 449 DARTSCOPE(Thread::Current()); | 440 DARTSCOPE(Thread::Current()); |
| 450 Isolate* I = T->isolate(); | 441 Isolate* I = T->isolate(); |
| 451 CHECK_DEBUGGER(I); | 442 CHECK_DEBUGGER(I); |
| 452 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); | 443 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); |
| 453 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); | 444 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); |
| 454 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); | 445 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); |
| 455 | 446 |
| 456 // Ensure that the library is loaded. | 447 // Ensure that the library is loaded. |
| 457 if (!library.Loaded()) { | 448 if (!library.Loaded()) { |
| 458 return Api::NewError( | 449 return Api::NewError( |
| 459 "%s expects library argument 'library_in' to be loaded.", | 450 "%s expects library argument 'library_in' to be loaded.", CURRENT_FUNC); |
| 460 CURRENT_FUNC); | |
| 461 } | 451 } |
| 462 | 452 |
| 463 // Resolve the breakpoint target function. | 453 // Resolve the breakpoint target function. |
| 464 Debugger* debugger = I->debugger(); | 454 Debugger* debugger = I->debugger(); |
| 465 const Function& bp_target = Function::Handle( | 455 const Function& bp_target = Function::Handle( |
| 466 debugger->ResolveFunction(library, class_name, function_name)); | 456 debugger->ResolveFunction(library, class_name, function_name)); |
| 467 if (bp_target.IsNull()) { | 457 if (bp_target.IsNull()) { |
| 468 const bool toplevel = class_name.Length() == 0; | 458 const bool toplevel = class_name.Length() == 0; |
| 469 return Api::NewError("%s: could not find function '%s%s%s'", | 459 return Api::NewError("%s: could not find function '%s%s%s'", CURRENT_FUNC, |
| 470 CURRENT_FUNC, | |
| 471 toplevel ? "" : class_name.ToCString(), | 460 toplevel ? "" : class_name.ToCString(), |
| 472 toplevel ? "" : ".", | 461 toplevel ? "" : ".", function_name.ToCString()); |
| 473 function_name.ToCString()); | |
| 474 } | 462 } |
| 475 | 463 |
| 476 const Error& error = Error::Handle(Z, | 464 const Error& error = |
| 477 debugger->OneTimeBreakAtEntry(bp_target)); | 465 Error::Handle(Z, debugger->OneTimeBreakAtEntry(bp_target)); |
| 478 if (!error.IsNull()) { | 466 if (!error.IsNull()) { |
| 479 return Api::NewHandle(T, error.raw()); | 467 return Api::NewHandle(T, error.raw()); |
| 480 } | 468 } |
| 481 return Api::Success(); | 469 return Api::Success(); |
| 482 } | 470 } |
| 483 | 471 |
| 484 | 472 |
| 485 DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) { | 473 DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) { |
| 486 DARTSCOPE(Thread::Current()); | 474 DARTSCOPE(Thread::Current()); |
| 487 Isolate* I = T->isolate(); | 475 Isolate* I = T->isolate(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 526 } |
| 539 const Class& cls = Class::Handle(Z, type_obj.type_class()); | 527 const Class& cls = Class::Handle(Z, type_obj.type_class()); |
| 540 return Api::NewHandle(T, I->debugger()->GetStaticFields(cls)); | 528 return Api::NewHandle(T, I->debugger()->GetStaticFields(cls)); |
| 541 } | 529 } |
| 542 | 530 |
| 543 | 531 |
| 544 DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) { | 532 DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) { |
| 545 DARTSCOPE(Thread::Current()); | 533 DARTSCOPE(Thread::Current()); |
| 546 Isolate* I = T->isolate(); | 534 Isolate* I = T->isolate(); |
| 547 CHECK_DEBUGGER(I); | 535 CHECK_DEBUGGER(I); |
| 548 const Library& lib = | 536 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); |
| 549 Library::Handle(Z, Library::GetLibrary(library_id)); | |
| 550 if (lib.IsNull()) { | 537 if (lib.IsNull()) { |
| 551 return Api::NewError("%s: %" Pd " is not a valid library id", | 538 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 552 CURRENT_FUNC, library_id); | 539 library_id); |
| 553 } | 540 } |
| 554 return Api::NewHandle(T, I->debugger()->GetLibraryFields(lib)); | 541 return Api::NewHandle(T, I->debugger()->GetLibraryFields(lib)); |
| 555 } | 542 } |
| 556 | 543 |
| 557 | 544 |
| 558 DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) { | 545 DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) { |
| 559 DARTSCOPE(Thread::Current()); | 546 DARTSCOPE(Thread::Current()); |
| 560 Isolate* I = T->isolate(); | 547 Isolate* I = T->isolate(); |
| 561 CHECK_DEBUGGER(I); | 548 CHECK_DEBUGGER(I); |
| 562 | 549 |
| 563 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); | 550 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); |
| 564 if (lib.IsNull()) { | 551 if (lib.IsNull()) { |
| 565 return Api::NewError("%s: %" Pd " is not a valid library id", | 552 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 566 CURRENT_FUNC, library_id); | 553 library_id); |
| 567 } | 554 } |
| 568 return Api::NewHandle(T, I->debugger()->GetGlobalFields(lib)); | 555 return Api::NewHandle(T, I->debugger()->GetGlobalFields(lib)); |
| 569 } | 556 } |
| 570 | 557 |
| 571 | 558 |
| 572 DART_EXPORT Dart_Handle Dart_ActivationFrameEvaluate( | 559 DART_EXPORT Dart_Handle |
| 573 Dart_ActivationFrame activation_frame, | 560 Dart_ActivationFrameEvaluate(Dart_ActivationFrame activation_frame, |
| 574 Dart_Handle expr_in) { | 561 Dart_Handle expr_in) { |
| 575 DARTSCOPE(Thread::Current()); | 562 DARTSCOPE(Thread::Current()); |
| 576 CHECK_DEBUGGER(T->isolate()); | 563 CHECK_DEBUGGER(T->isolate()); |
| 577 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); | 564 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
| 578 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); | 565 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); |
| 579 return Api::NewHandle(T, frame->Evaluate(expr)); | 566 return Api::NewHandle(T, frame->Evaluate(expr)); |
| 580 } | 567 } |
| 581 | 568 |
| 582 | 569 |
| 583 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in, | 570 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in, |
| 584 Dart_Handle expr_in) { | 571 Dart_Handle expr_in) { |
| 585 DARTSCOPE(Thread::Current()); | 572 DARTSCOPE(Thread::Current()); |
| 586 CHECK_DEBUGGER(T->isolate()); | 573 CHECK_DEBUGGER(T->isolate()); |
| 587 | 574 |
| 588 const Object& target = Object::Handle(Z, Api::UnwrapHandle(target_in)); | 575 const Object& target = Object::Handle(Z, Api::UnwrapHandle(target_in)); |
| 589 if (target.IsError()) return target_in; | 576 if (target.IsError()) return target_in; |
| 590 if (target.IsNull()) { | 577 if (target.IsNull()) { |
| 591 return Api::NewError("%s expects argument 'target' to be non-null", | 578 return Api::NewError("%s expects argument 'target' to be non-null", |
| 592 CURRENT_FUNC); | 579 CURRENT_FUNC); |
| 593 } | 580 } |
| 594 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); | 581 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); |
| 595 // Type extends Instance, must check first. | 582 // Type extends Instance, must check first. |
| 596 if (target.IsType()) { | 583 if (target.IsType()) { |
| 597 const Class& cls = Class::Handle(Z, Type::Cast(target).type_class()); | 584 const Class& cls = Class::Handle(Z, Type::Cast(target).type_class()); |
| 598 return Api::NewHandle(T, cls.Evaluate(expr, | 585 return Api::NewHandle( |
| 599 Array::empty_array(), | 586 T, cls.Evaluate(expr, Array::empty_array(), Array::empty_array())); |
| 600 Array::empty_array())); | |
| 601 } else if (target.IsInstance()) { | 587 } else if (target.IsInstance()) { |
| 602 const Instance& inst = Instance::Cast(target); | 588 const Instance& inst = Instance::Cast(target); |
| 603 const Class& receiver_cls = Class::Handle(Z, inst.clazz()); | 589 const Class& receiver_cls = Class::Handle(Z, inst.clazz()); |
| 604 return Api::NewHandle(T, inst.Evaluate(receiver_cls, | 590 return Api::NewHandle( |
| 605 expr, | 591 T, inst.Evaluate(receiver_cls, expr, Array::empty_array(), |
| 606 Array::empty_array(), | 592 Array::empty_array())); |
| 607 Array::empty_array())); | |
| 608 } else if (target.IsLibrary()) { | 593 } else if (target.IsLibrary()) { |
| 609 const Library& lib = Library::Cast(target); | 594 const Library& lib = Library::Cast(target); |
| 610 return Api::NewHandle(T, lib.Evaluate(expr, | 595 return Api::NewHandle( |
| 611 Array::empty_array(), | 596 T, lib.Evaluate(expr, Array::empty_array(), Array::empty_array())); |
| 612 Array::empty_array())); | |
| 613 } else if (target.IsClass()) { | 597 } else if (target.IsClass()) { |
| 614 const Class& cls = Class::Cast(target); | 598 const Class& cls = Class::Cast(target); |
| 615 return Api::NewHandle(T, cls.Evaluate(expr, | 599 return Api::NewHandle( |
| 616 Array::empty_array(), | 600 T, cls.Evaluate(expr, Array::empty_array(), Array::empty_array())); |
| 617 Array::empty_array())); | |
| 618 } | 601 } |
| 619 return Api::NewError("%s: unsupported target type", CURRENT_FUNC); | 602 return Api::NewError("%s: unsupported target type", CURRENT_FUNC); |
| 620 } | 603 } |
| 621 | 604 |
| 622 | 605 |
| 623 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { | 606 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { |
| 624 DARTSCOPE(Thread::Current()); | 607 DARTSCOPE(Thread::Current()); |
| 625 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); | 608 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); |
| 626 return Api::NewHandle(T, obj.GetType()); | 609 return Api::NewHandle(T, obj.GetType()); |
| 627 } | 610 } |
| 628 | 611 |
| 629 | 612 |
| 630 DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in, | 613 DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in, |
| 631 intptr_t* class_id) { | 614 intptr_t* class_id) { |
| 632 DARTSCOPE(Thread::Current()); | 615 DARTSCOPE(Thread::Current()); |
| 633 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); | 616 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); |
| 634 CHECK_NOT_NULL(class_id); | 617 CHECK_NOT_NULL(class_id); |
| 635 *class_id = obj.GetClassId(); | 618 *class_id = obj.GetClassId(); |
| 636 return Api::Success(); | 619 return Api::Success(); |
| 637 } | 620 } |
| 638 | 621 |
| 639 | 622 |
| 640 DART_EXPORT Dart_Handle Dart_GetClassFromId(intptr_t class_id) { | 623 DART_EXPORT Dart_Handle Dart_GetClassFromId(intptr_t class_id) { |
| 641 DARTSCOPE(Thread::Current()); | 624 DARTSCOPE(Thread::Current()); |
| 642 Isolate* I = T->isolate(); | 625 Isolate* I = T->isolate(); |
| 643 if (!I->class_table()->IsValidIndex(class_id)) { | 626 if (!I->class_table()->IsValidIndex(class_id)) { |
| 644 return Api::NewError("%s: %" Pd " is not a valid class id", | 627 return Api::NewError("%s: %" Pd " is not a valid class id", CURRENT_FUNC, |
| 645 CURRENT_FUNC, class_id); | 628 class_id); |
| 646 } | 629 } |
| 647 return Api::NewHandle(T, I->class_table()->At(class_id)); | 630 return Api::NewHandle(T, I->class_table()->At(class_id)); |
| 648 } | 631 } |
| 649 | 632 |
| 650 | 633 |
| 651 DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type_in) { | 634 DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type_in) { |
| 652 DARTSCOPE(Thread::Current()); | 635 DARTSCOPE(Thread::Current()); |
| 653 | 636 |
| 654 UNWRAP_AND_CHECK_PARAM(Type, type, type_in); | 637 UNWRAP_AND_CHECK_PARAM(Type, type, type_in); |
| 655 if (!type.IsFinalized()) { | 638 if (!type.IsFinalized()) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 670 |
| 688 // Construct the super type object, canonicalize it and return. | 671 // Construct the super type object, canonicalize it and return. |
| 689 Type& instantiated_type = Type::Handle( | 672 Type& instantiated_type = Type::Handle( |
| 690 Type::New(super_cls, super_type_args_array, TokenPosition::kNoSource)); | 673 Type::New(super_cls, super_type_args_array, TokenPosition::kNoSource)); |
| 691 ASSERT(!instantiated_type.IsNull()); | 674 ASSERT(!instantiated_type.IsNull()); |
| 692 instantiated_type.SetIsFinalized(); | 675 instantiated_type.SetIsFinalized(); |
| 693 return Api::NewHandle(T, instantiated_type.Canonicalize()); | 676 return Api::NewHandle(T, instantiated_type.Canonicalize()); |
| 694 } | 677 } |
| 695 | 678 |
| 696 | 679 |
| 697 DART_EXPORT Dart_Handle Dart_GetClosureInfo( | 680 DART_EXPORT Dart_Handle Dart_GetClosureInfo(Dart_Handle closure, |
| 698 Dart_Handle closure, | 681 Dart_Handle* name, |
| 699 Dart_Handle* name, | 682 Dart_Handle* signature, |
| 700 Dart_Handle* signature, | 683 Dart_CodeLocation* location) { |
| 701 Dart_CodeLocation* location) { | |
| 702 DARTSCOPE(Thread::Current()); | 684 DARTSCOPE(Thread::Current()); |
| 703 UNWRAP_AND_CHECK_PARAM(Instance, instance, closure); | 685 UNWRAP_AND_CHECK_PARAM(Instance, instance, closure); |
| 704 CHECK_NOT_NULL(location); | 686 CHECK_NOT_NULL(location); |
| 705 | 687 |
| 706 if (!instance.IsClosure()) { | 688 if (!instance.IsClosure()) { |
| 707 return Api::NewError("%s: parameter 0 is not a closure", CURRENT_FUNC); | 689 return Api::NewError("%s: parameter 0 is not a closure", CURRENT_FUNC); |
| 708 } | 690 } |
| 709 const Function& func = Function::Handle(Closure::Cast(instance).function()); | 691 const Function& func = Function::Handle(Closure::Cast(instance).function()); |
| 710 ASSERT(!func.IsNull()); | 692 ASSERT(!func.IsNull()); |
| 711 if (name != NULL) { | 693 if (name != NULL) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 730 } else { | 712 } else { |
| 731 location->script_url = Api::NewHandle(T, String::null()); | 713 location->script_url = Api::NewHandle(T, String::null()); |
| 732 location->library_id = -1; | 714 location->library_id = -1; |
| 733 location->token_pos = -1; | 715 location->token_pos = -1; |
| 734 } | 716 } |
| 735 } | 717 } |
| 736 return Api::True(); | 718 return Api::True(); |
| 737 } | 719 } |
| 738 | 720 |
| 739 | 721 |
| 740 DART_EXPORT Dart_Handle Dart_GetClassInfo( | 722 DART_EXPORT Dart_Handle Dart_GetClassInfo(intptr_t cls_id, |
| 741 intptr_t cls_id, | 723 Dart_Handle* class_name, |
| 742 Dart_Handle* class_name, | 724 intptr_t* library_id, |
| 743 intptr_t* library_id, | 725 intptr_t* super_class_id, |
| 744 intptr_t* super_class_id, | 726 Dart_Handle* static_fields) { |
| 745 Dart_Handle* static_fields) { | |
| 746 DARTSCOPE(Thread::Current()); | 727 DARTSCOPE(Thread::Current()); |
| 747 Isolate* I = T->isolate(); | 728 Isolate* I = T->isolate(); |
| 748 CHECK_DEBUGGER(I); | 729 CHECK_DEBUGGER(I); |
| 749 if (!I->class_table()->IsValidIndex(cls_id)) { | 730 if (!I->class_table()->IsValidIndex(cls_id)) { |
| 750 return Api::NewError("%s: %" Pd " is not a valid class id", | 731 return Api::NewError("%s: %" Pd " is not a valid class id", CURRENT_FUNC, |
| 751 CURRENT_FUNC, cls_id); | 732 cls_id); |
| 752 } | 733 } |
| 753 Class& cls = Class::Handle(Z, I->class_table()->At(cls_id)); | 734 Class& cls = Class::Handle(Z, I->class_table()->At(cls_id)); |
| 754 if (class_name != NULL) { | 735 if (class_name != NULL) { |
| 755 *class_name = Api::NewHandle(T, cls.Name()); | 736 *class_name = Api::NewHandle(T, cls.Name()); |
| 756 } | 737 } |
| 757 if (library_id != NULL) { | 738 if (library_id != NULL) { |
| 758 const Library& lib = Library::Handle(Z, cls.library()); | 739 const Library& lib = Library::Handle(Z, cls.library()); |
| 759 *library_id = lib.index(); | 740 *library_id = lib.index(); |
| 760 } | 741 } |
| 761 if (super_class_id != NULL) { | 742 if (super_class_id != NULL) { |
| 762 *super_class_id = 0; | 743 *super_class_id = 0; |
| 763 Class& super_cls = Class::Handle(Z, cls.SuperClass()); | 744 Class& super_cls = Class::Handle(Z, cls.SuperClass()); |
| 764 if (!super_cls.IsNull()) { | 745 if (!super_cls.IsNull()) { |
| 765 *super_class_id = super_cls.id(); | 746 *super_class_id = super_cls.id(); |
| 766 } | 747 } |
| 767 } | 748 } |
| 768 if (static_fields != NULL) { | 749 if (static_fields != NULL) { |
| 769 *static_fields = | 750 *static_fields = Api::NewHandle(T, I->debugger()->GetStaticFields(cls)); |
| 770 Api::NewHandle(T, I->debugger()->GetStaticFields(cls)); | |
| 771 } | 751 } |
| 772 return Api::Success(); | 752 return Api::Success(); |
| 773 } | 753 } |
| 774 | 754 |
| 775 | 755 |
| 776 DART_EXPORT Dart_Handle Dart_ScriptGetSource( | 756 DART_EXPORT Dart_Handle Dart_ScriptGetSource(intptr_t library_id, |
| 777 intptr_t library_id, | 757 Dart_Handle script_url_in) { |
| 778 Dart_Handle script_url_in) { | |
| 779 DARTSCOPE(Thread::Current()); | 758 DARTSCOPE(Thread::Current()); |
| 780 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 759 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
| 781 if (lib.IsNull()) { | 760 if (lib.IsNull()) { |
| 782 return Api::NewError("%s: %" Pd " is not a valid library id", | 761 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 783 CURRENT_FUNC, library_id); | 762 library_id); |
| 784 } | 763 } |
| 785 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 764 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 786 const Script& script = Script::Handle(lib.LookupScript(script_url)); | 765 const Script& script = Script::Handle(lib.LookupScript(script_url)); |
| 787 if (script.IsNull()) { | 766 if (script.IsNull()) { |
| 788 return Api::NewError("%s: script '%s' not found in library '%s'", | 767 return Api::NewError("%s: script '%s' not found in library '%s'", |
| 789 CURRENT_FUNC, script_url.ToCString(), | 768 CURRENT_FUNC, script_url.ToCString(), |
| 790 String::Handle(lib.url()).ToCString()); | 769 String::Handle(lib.url()).ToCString()); |
| 791 } | 770 } |
| 792 return Api::NewHandle(T, script.Source()); | 771 return Api::NewHandle(T, script.Source()); |
| 793 } | 772 } |
| 794 | 773 |
| 795 | 774 |
| 796 DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo( | 775 DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(intptr_t library_id, |
| 797 intptr_t library_id, | 776 Dart_Handle script_url_in) { |
| 798 Dart_Handle script_url_in) { | |
| 799 DARTSCOPE(Thread::Current()); | 777 DARTSCOPE(Thread::Current()); |
| 800 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 778 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
| 801 if (lib.IsNull()) { | 779 if (lib.IsNull()) { |
| 802 return Api::NewError("%s: %" Pd " is not a valid library id", | 780 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 803 CURRENT_FUNC, library_id); | 781 library_id); |
| 804 } | 782 } |
| 805 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 783 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 806 const Script& script = Script::Handle(lib.LookupScript(script_url)); | 784 const Script& script = Script::Handle(lib.LookupScript(script_url)); |
| 807 if (script.IsNull()) { | 785 if (script.IsNull()) { |
| 808 return Api::NewError("%s: script '%s' not found in library '%s'", | 786 return Api::NewError("%s: script '%s' not found in library '%s'", |
| 809 CURRENT_FUNC, script_url.ToCString(), | 787 CURRENT_FUNC, script_url.ToCString(), |
| 810 String::Handle(lib.url()).ToCString()); | 788 String::Handle(lib.url()).ToCString()); |
| 811 } | 789 } |
| 812 | 790 |
| 813 const GrowableObjectArray& info = | 791 const GrowableObjectArray& info = |
| 814 GrowableObjectArray::Handle(script.GenerateLineNumberArray()); | 792 GrowableObjectArray::Handle(script.GenerateLineNumberArray()); |
| 815 return Api::NewHandle(T, Array::MakeArray(info)); | 793 return Api::NewHandle(T, Array::MakeArray(info)); |
| 816 } | 794 } |
| 817 | 795 |
| 818 | 796 |
| 819 DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in, | 797 DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in, |
| 820 Dart_Handle script_url_in) { | 798 Dart_Handle script_url_in) { |
| 821 DARTSCOPE(Thread::Current()); | 799 DARTSCOPE(Thread::Current()); |
| 822 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | 800 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
| 823 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 801 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 824 | 802 |
| 825 const Library& library = Library::Handle(Z, | 803 const Library& library = |
| 826 Library::LookupLibrary(T, library_url)); | 804 Library::Handle(Z, Library::LookupLibrary(T, library_url)); |
| 827 if (library.IsNull()) { | 805 if (library.IsNull()) { |
| 828 return Api::NewError("%s: library '%s' not found", | 806 return Api::NewError("%s: library '%s' not found", CURRENT_FUNC, |
| 829 CURRENT_FUNC, library_url.ToCString()); | 807 library_url.ToCString()); |
| 830 } | 808 } |
| 831 | 809 |
| 832 const Script& script = Script::Handle(Z, library.LookupScript(script_url)); | 810 const Script& script = Script::Handle(Z, library.LookupScript(script_url)); |
| 833 if (script.IsNull()) { | 811 if (script.IsNull()) { |
| 834 return Api::NewError("%s: script '%s' not found in library '%s'", | 812 return Api::NewError("%s: script '%s' not found in library '%s'", |
| 835 CURRENT_FUNC, script_url.ToCString(), | 813 CURRENT_FUNC, script_url.ToCString(), |
| 836 library_url.ToCString()); | 814 library_url.ToCString()); |
| 837 } | 815 } |
| 838 | 816 |
| 839 return Api::NewHandle(T, script.GenerateSource()); | 817 return Api::NewHandle(T, script.GenerateSource()); |
| 840 } | 818 } |
| 841 | 819 |
| 842 | 820 |
| 843 DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { | 821 DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { |
| 844 DARTSCOPE(Thread::Current()); | 822 DARTSCOPE(Thread::Current()); |
| 845 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | 823 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
| 846 | 824 |
| 847 const Library& library = Library::Handle(Z, | 825 const Library& library = |
| 848 Library::LookupLibrary(T, library_url)); | 826 Library::Handle(Z, Library::LookupLibrary(T, library_url)); |
| 849 if (library.IsNull()) { | 827 if (library.IsNull()) { |
| 850 return Api::NewError("%s: library '%s' not found", | 828 return Api::NewError("%s: library '%s' not found", CURRENT_FUNC, |
| 851 CURRENT_FUNC, library_url.ToCString()); | 829 library_url.ToCString()); |
| 852 } | 830 } |
| 853 const Array& loaded_scripts = Array::Handle(Z, library.LoadedScripts()); | 831 const Array& loaded_scripts = Array::Handle(Z, library.LoadedScripts()); |
| 854 ASSERT(!loaded_scripts.IsNull()); | 832 ASSERT(!loaded_scripts.IsNull()); |
| 855 intptr_t num_scripts = loaded_scripts.Length(); | 833 intptr_t num_scripts = loaded_scripts.Length(); |
| 856 const Array& script_list = Array::Handle(Z, Array::New(num_scripts)); | 834 const Array& script_list = Array::Handle(Z, Array::New(num_scripts)); |
| 857 Script& script = Script::Handle(Z); | 835 Script& script = Script::Handle(Z); |
| 858 String& url = String::Handle(Z); | 836 String& url = String::Handle(Z); |
| 859 for (int i = 0; i < num_scripts; i++) { | 837 for (int i = 0; i < num_scripts; i++) { |
| 860 script ^= loaded_scripts.At(i); | 838 script ^= loaded_scripts.At(i); |
| 861 url = script.url(); | 839 url = script.url(); |
| 862 script_list.SetAt(i, url); | 840 script_list.SetAt(i, url); |
| 863 } | 841 } |
| 864 return Api::NewHandle(T, script_list.raw()); | 842 return Api::NewHandle(T, script_list.raw()); |
| 865 } | 843 } |
| 866 | 844 |
| 867 | 845 |
| 868 DART_EXPORT Dart_Handle Dart_GetLibraryIds() { | 846 DART_EXPORT Dart_Handle Dart_GetLibraryIds() { |
| 869 DARTSCOPE(Thread::Current()); | 847 DARTSCOPE(Thread::Current()); |
| 870 Isolate* I = T->isolate(); | 848 Isolate* I = T->isolate(); |
| 871 | 849 |
| 872 const GrowableObjectArray& libs = | 850 const GrowableObjectArray& libs = |
| 873 GrowableObjectArray::Handle(Z, I->object_store()->libraries()); | 851 GrowableObjectArray::Handle(Z, I->object_store()->libraries()); |
| 874 int num_libs = libs.Length(); | 852 int num_libs = libs.Length(); |
| 875 | 853 |
| 876 // Create new list and populate with the url of loaded libraries. | 854 // Create new list and populate with the url of loaded libraries. |
| 877 Library &lib = Library::Handle(); | 855 Library& lib = Library::Handle(); |
| 878 const Array& library_id_list = Array::Handle(Z, Array::New(num_libs)); | 856 const Array& library_id_list = Array::Handle(Z, Array::New(num_libs)); |
| 879 for (int i = 0; i < num_libs; i++) { | 857 for (int i = 0; i < num_libs; i++) { |
| 880 lib ^= libs.At(i); | 858 lib ^= libs.At(i); |
| 881 ASSERT(!lib.IsNull()); | 859 ASSERT(!lib.IsNull()); |
| 882 ASSERT(Smi::IsValid(lib.index())); | 860 ASSERT(Smi::IsValid(lib.index())); |
| 883 library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index()))); | 861 library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index()))); |
| 884 } | 862 } |
| 885 return Api::NewHandle(T, library_id_list.raw()); | 863 return Api::NewHandle(T, library_id_list.raw()); |
| 886 } | 864 } |
| 887 | 865 |
| 888 | 866 |
| 889 DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id) { | 867 DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id) { |
| 890 DARTSCOPE(Thread::Current()); | 868 DARTSCOPE(Thread::Current()); |
| 891 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); | 869 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); |
| 892 if (lib.IsNull()) { | 870 if (lib.IsNull()) { |
| 893 return Api::NewError("%s: %" Pd " is not a valid library id", | 871 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 894 CURRENT_FUNC, library_id); | 872 library_id); |
| 895 } | 873 } |
| 896 return Api::NewHandle(T, lib.raw()); | 874 return Api::NewHandle(T, lib.raw()); |
| 897 } | 875 } |
| 898 | 876 |
| 899 | 877 |
| 900 DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library, | 878 DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library, |
| 901 intptr_t* library_id) { | 879 intptr_t* library_id) { |
| 902 DARTSCOPE(Thread::Current()); | 880 DARTSCOPE(Thread::Current()); |
| 903 const Library& lib = Api::UnwrapLibraryHandle(Z, library); | 881 const Library& lib = Api::UnwrapLibraryHandle(Z, library); |
| 904 if (lib.IsNull()) { | 882 if (lib.IsNull()) { |
| 905 RETURN_TYPE_ERROR(Z, library, Library); | 883 RETURN_TYPE_ERROR(Z, library, Library); |
| 906 } | 884 } |
| 907 if (library_id == NULL) { | 885 if (library_id == NULL) { |
| 908 RETURN_NULL_ERROR(library_id); | 886 RETURN_NULL_ERROR(library_id); |
| 909 } | 887 } |
| 910 *library_id = lib.index(); | 888 *library_id = lib.index(); |
| 911 return Api::Success(); | 889 return Api::Success(); |
| 912 } | 890 } |
| 913 | 891 |
| 914 | 892 |
| 915 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { | 893 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { |
| 916 DARTSCOPE(Thread::Current()); | 894 DARTSCOPE(Thread::Current()); |
| 917 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 895 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
| 918 if (lib.IsNull()) { | 896 if (lib.IsNull()) { |
| 919 return Api::NewError("%s: %" Pd " is not a valid library id", | 897 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 920 CURRENT_FUNC, library_id); | 898 library_id); |
| 921 } | 899 } |
| 922 const GrowableObjectArray& import_list = | 900 const GrowableObjectArray& import_list = |
| 923 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); | 901 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); |
| 924 | 902 |
| 925 String& prefix_name = String::Handle(Z); | 903 String& prefix_name = String::Handle(Z); |
| 926 Library& imported = Library::Handle(Z); | 904 Library& imported = Library::Handle(Z); |
| 927 intptr_t num_imports = lib.num_imports(); | 905 intptr_t num_imports = lib.num_imports(); |
| 928 for (int i = 0; i < num_imports; i++) { | 906 for (int i = 0; i < num_imports; i++) { |
| 929 import_list.Add(prefix_name); // Null prefix name means no prefix. | 907 import_list.Add(prefix_name); // Null prefix name means no prefix. |
| 930 imported = lib.ImportLibraryAt(i); | 908 imported = lib.ImportLibraryAt(i); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 946 } | 924 } |
| 947 } | 925 } |
| 948 return Api::NewHandle(T, Array::MakeArray(import_list)); | 926 return Api::NewHandle(T, Array::MakeArray(import_list)); |
| 949 } | 927 } |
| 950 | 928 |
| 951 | 929 |
| 952 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { | 930 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { |
| 953 DARTSCOPE(Thread::Current()); | 931 DARTSCOPE(Thread::Current()); |
| 954 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); | 932 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); |
| 955 if (lib.IsNull()) { | 933 if (lib.IsNull()) { |
| 956 return Api::NewError("%s: %" Pd " is not a valid library id", | 934 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 957 CURRENT_FUNC, library_id); | 935 library_id); |
| 958 } | 936 } |
| 959 return Api::NewHandle(T, lib.url()); | 937 return Api::NewHandle(T, lib.url()); |
| 960 } | 938 } |
| 961 | 939 |
| 962 | 940 |
| 963 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, | 941 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, |
| 964 bool* is_debuggable) { | 942 bool* is_debuggable) { |
| 965 DARTSCOPE(Thread::Current()); | 943 DARTSCOPE(Thread::Current()); |
| 966 CHECK_NOT_NULL(is_debuggable); | 944 CHECK_NOT_NULL(is_debuggable); |
| 967 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 945 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
| 968 if (lib.IsNull()) { | 946 if (lib.IsNull()) { |
| 969 return Api::NewError("%s: %" Pd " is not a valid library id", | 947 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 970 CURRENT_FUNC, library_id); | 948 library_id); |
| 971 } | 949 } |
| 972 *is_debuggable = lib.IsDebuggable(); | 950 *is_debuggable = lib.IsDebuggable(); |
| 973 return Api::Success(); | 951 return Api::Success(); |
| 974 } | 952 } |
| 975 | 953 |
| 976 | 954 |
| 977 DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, | 955 DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, |
| 978 bool is_debuggable) { | 956 bool is_debuggable) { |
| 979 DARTSCOPE(Thread::Current()); | 957 DARTSCOPE(Thread::Current()); |
| 980 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); | 958 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); |
| 981 if (lib.IsNull()) { | 959 if (lib.IsNull()) { |
| 982 return Api::NewError("%s: %" Pd " is not a valid library id", | 960 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, |
| 983 CURRENT_FUNC, library_id); | 961 library_id); |
| 984 } | 962 } |
| 985 lib.set_debuggable(is_debuggable); | 963 lib.set_debuggable(is_debuggable); |
| 986 return Api::Success(); | 964 return Api::Success(); |
| 987 } | 965 } |
| 988 | 966 |
| 989 | 967 |
| 990 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { | 968 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { |
| 991 Isolate* isolate = PortMap::GetIsolate(isolate_id); | 969 Isolate* isolate = PortMap::GetIsolate(isolate_id); |
| 992 return Api::CastIsolate(isolate); | 970 return Api::CastIsolate(isolate); |
| 993 } | 971 } |
| 994 | 972 |
| 995 | 973 |
| 996 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) { | 974 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) { |
| 997 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); | 975 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); |
| 998 if (isolate->debugger() == NULL) { | 976 if (isolate->debugger() == NULL) { |
| 999 return ILLEGAL_ISOLATE_ID; | 977 return ILLEGAL_ISOLATE_ID; |
| 1000 } | 978 } |
| 1001 return isolate->debugger()->GetIsolateId(); | 979 return isolate->debugger()->GetIsolateId(); |
| 1002 } | 980 } |
| 1003 | 981 |
| 1004 #else | 982 #else |
| 1005 | 983 |
| 1006 DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) { | 984 DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) { |
| 1007 // NOOP. | 985 // NOOP. |
| 1008 } | 986 } |
| 1009 | 987 |
| 1010 #endif // !PRODUCT | 988 #endif // !PRODUCT |
| 1011 | 989 |
| 1012 } // namespace dart | 990 } // namespace dart |
| OLD | NEW |