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

Side by Side Diff: runtime/vm/dart_dapi_impl.cc

Issue 8826007: First bits of external debugger API (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4
5 #include "include/dart_dapi.h"
6
7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_api_state.h"
9 #include "vm/debugger.h"
10 #include "vm/isolate.h"
11 #include "vm/longjump.h"
12
13
14 namespace dart {
siva 2011/12/07 05:44:48 extra blank line?
hausner 2011/12/07 22:14:26 Done.
15
16
17 DART_EXPORT void Dart_InitDebugger() {
18 Isolate* isolate = Isolate::Current();
19 DARTSCOPE(isolate);
20 isolate->debugger()->Initialize(isolate);
21 }
22
23
24 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
25 Dart_Handle library_in,
26 Dart_Handle class_name_in,
27 Dart_Handle function_name_in,
28 Dart_Breakpoint* breakpoint) {
29 Isolate* isolate = Isolate::Current();
30 DARTSCOPE(isolate);
siva 2011/12/07 05:44:48 In the dart API functions we normally check for va
hausner 2011/12/07 22:14:26 The idea was to allow NULL as a valid value. The c
siva 2011/12/07 22:27:08 Does that mean you will implement the delete API a
hausner 2011/12/07 22:36:49 Hmm, good point. I'm pretty sure there will also b
31 if (breakpoint != NULL) {
32 *breakpoint = NULL;
33 }
34 const char* msg = CheckIsolateState(isolate);
35 if (msg != NULL) {
36 return Api::Error(msg);
37 }
siva 2011/12/07 05:44:48 Should the isolate state check happen after valida
hausner 2011/12/07 22:14:26 Yes, good point. Rearranged the order of things.
38
39 const Library& library =
40 Library::CheckedHandle(Api::UnwrapHandle(library_in));
41 if (library.IsNull()) {
42 return Api::Error("No library specified");
siva 2011/12/07 05:44:48 The wording of error messages are not consistent w
hausner 2011/12/07 22:14:26 Ok, adapted the scheme used in dart_api_impl.
43 }
44 const String& class_name =
45 String::CheckedHandle(Api::UnwrapHandle(class_name_in));
siva 2011/12/07 05:44:48 Need similar null checks on class_name_in paramete
hausner 2011/12/07 22:14:26 Done.
46 const String& function_name =
47 String::CheckedHandle(Api::UnwrapHandle(function_name_in));
siva 2011/12/07 05:44:48 Ditto on check.
hausner 2011/12/07 22:14:26 Done.
48
49 // Resolve the breakpoint target function.
50 const Function& bp_target = Function::Handle(
51 isolate->debugger()->ResolveFunction(
52 library, class_name, function_name));
53 if (bp_target.IsNull()) {
54 return Api::Error("Breakpoint target function does not exist");
siva 2011/12/07 05:44:48 I guess the error message needs to be more descrip
hausner 2011/12/07 22:14:26 How? You mean by including the function name?
siva 2011/12/07 22:27:08 Yes, the fully qualified function name (i.e librar
hausner 2011/12/07 22:36:49 Ok, will do in the next CL.
55 }
56
57 LongJump* base = isolate->long_jump_base();
58 LongJump jump;
59 isolate->set_long_jump_base(&jump);
60 Dart_Handle result = Api::True();
61 if (setjmp(*jump.Set()) == 0) {
62 Breakpoint* bpt = isolate->debugger()->SetBreakpointAtEntry(bp_target);
siva 2011/12/07 05:44:48 We seem to be using isolate->debugger() a lot in t
hausner 2011/12/07 22:14:26 It's only used twice. Done.
63 if (breakpoint != NULL) {
siva 2011/12/07 05:44:48 breakpoint will be non NULL here if we error out e
hausner 2011/12/07 22:14:26 *breakpoint is set to NULL early on. It only has a
64 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt);
65 }
66 } else {
67 SetupErrorResult(&result);
68 }
69 isolate->set_long_jump_base(base);
70 return result;
71 }
72
73
74 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698