Flutter Engine
The Flutter Engine
debugger_api_impl_test.h
Go to the documentation of this file.
1// Copyright (c) 2017, 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#ifndef RUNTIME_VM_DEBUGGER_API_IMPL_TEST_H_
6#define RUNTIME_VM_DEBUGGER_API_IMPL_TEST_H_
7
8#include "include/dart_api.h"
9#include "vm/debugger.h"
10
11namespace dart {
12
13typedef struct _Dart_Breakpoint* Dart_Breakpoint;
14
15typedef struct _Dart_StackTrace* Dart_StackTrace;
16
17typedef struct _Dart_ActivationFrame* Dart_ActivationFrame;
18
19/**
20 * An id used to uniquely represent an Isolate in the debugger wire protocol
21 * messages.
22 */
24
25/**
26 * ILLEGAL_ISOLATE_ID is a number guaranteed never to be associated with a
27 * valid isolate.
28 */
29#define ILLEGAL_ISOLATE_ID ILLEGAL_PORT
30
31/**
32 * Null value for breakpoint id. Guaranteed never to be associated
33 * with a valid breakpoint.
34 */
35#define ILLEGAL_BREAKPOINT_ID 0
36
38 Dart_Handle exception_object,
39 Dart_StackTrace stack_trace);
40
41typedef enum {
46
47/**
48 * Represents a location in Dart code.
49 */
50typedef struct {
51 Dart_Handle script_url; // Url (string) of the script.
52 int32_t library_id; // Library in which the script is loaded.
53 int32_t token_pos; // Code address.
55
58
60 intptr_t bp_id,
61 const Dart_CodeLocation& location);
62
64 intptr_t bp_id,
65 const Dart_CodeLocation& location);
66
67/**
68 * Returns true if the debugger can step into code of the given library.
69 *
70 * Requires there to be a current isolate.
71 *
72 * \return A handle to the True object if no error occurs.
73 */
74Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, bool* is_debuggable);
75
76/**
77 * Requests that debugging be enabled for the given library.
78 *
79 * Requires there to be a current isolate.
80 *
81 * \return A handle to the True object if no error occurs.
82 */
83Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, bool is_debuggable);
84
85/**
86 * Remove breakpoint with provided id.
87 *
88 * Requires there to be a current isolate.
89 */
91/**
92 * Sets a breakpoint at line \line_number in \script_url, or the closest
93 * following line (within the same function) where a breakpoint can be set.
94 *
95 * Requires there to be a current isolate.
96 *
97 * \return A handle containing the breakpoint id, which is an integer
98 * value, or an error object if a breakpoint could not be set.
99 */
100Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url, intptr_t line_number);
101
102/**
103 * Returns in \trace the current stack trace, or nullptr if the
104 * VM is not paused.
105 *
106 * Requires there to be a current isolate.
107 *
108 * \return A valid handle if no error occurs during the operation.
109 */
111
112/**
113 * Returns in \trace the stack trace associated with the error given in \handle.
114 *
115 * Requires there to be a current isolate.
116 *
117 * \return A valid handle if no error occurs during the operation.
118 */
120 Dart_StackTrace* trace);
121
122/**
123 * Returns in \length the number of activation frames in the given
124 * stack trace.
125 *
126 * Requires there to be a current isolate.
127 *
128 * \return A handle to the True object if no error occurs.
129 */
131
132/**
133 * Returns in \frame the activation frame with index \frame_index.
134 * The activation frame at the top of stack has index 0.
135 *
136 * Requires there to be a current isolate.
137 *
138 * \return A handle to the True object if no error occurs.
139 */
141 int frame_index,
143
144/**
145 * Returns information about the given activation frame.
146 * \function_name receives a string handle with the qualified
147 * function name.
148 * \script_url receives a string handle with the url of the
149 * source script that contains the frame's function.
150 * \line_number receives the line number in the script.
151 * \col_number receives the column number in the script, or -1 if column
152 * information is not available
153 *
154 * Any or all of the out parameters above may be nullptr.
155 *
156 * Requires there to be a current isolate.
157 *
158 * \return A valid handle if no error occurs during the operation.
159 */
162 Dart_Handle* script_url,
163 intptr_t* line_number,
164 intptr_t* column_number);
165
166/**
167 * Execute the expression given in string \expr in the context
168 * of \lib_handle library, as if it were a top-level function in it.
169 *
170 * Requires there to be a current isolate.
171 *
172 * \return A handle to the computed value, or an error object if
173 * the compilation of the expression fails, or if the evaluation throws
174 * an error.
175 */
177
178/**
179 * Returns in \library_id the library id of the given \library.
180 *
181 * \return A valid handle if no error occurs during the operation.
182 */
183Dart_Handle Dart_LibraryId(Dart_Handle library, intptr_t* library_id);
184
185} // namespace dart
186
187#endif // RUNTIME_VM_DEBUGGER_API_IMPL_TEST_H_
int64_t Dart_Port
Definition: dart_api.h:1525
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
double frame
Definition: examples.cpp:31
const uint8_t uint32_t uint32_t GError ** error
size_t length
Definition: dart_vm.cc:33
Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, bool *is_debuggable)
Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace, intptr_t *length)
void Dart_PausedEventHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation &location)
Dart_Handle Dart_ActivationFrameInfo(Dart_ActivationFrame activation_frame, Dart_Handle *function_name, Dart_Handle *script_url, intptr_t *line_number, intptr_t *column_number)
Dart_Handle Dart_EvaluateStaticExpr(Dart_Handle lib_handle, Dart_Handle expr_in)
Dart_Handle Dart_GetStackTrace(Dart_StackTrace *trace)
void Dart_BreakpointResolvedHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation &location)
Dart_Handle Dart_RemoveBreakpoint(Dart_Handle breakpoint_id_in)
void Dart_IsolateEventHandler(Dart_IsolateId isolate_id, Dart_IsolateEvent kind)
Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, bool is_debuggable)
struct _Dart_ActivationFrame * Dart_ActivationFrame
Dart_Handle Dart_GetActivationFrame(Dart_StackTrace trace, int frame_index, Dart_ActivationFrame *frame)
Dart_Port Dart_IsolateId
Dart_Handle Dart_LibraryId(Dart_Handle library, intptr_t *library_id)
Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle, Dart_StackTrace *trace)
struct _Dart_StackTrace * Dart_StackTrace
void Dart_ExceptionThrownHandler(Dart_IsolateId isolate_id, Dart_Handle exception_object, Dart_StackTrace stack_trace)
const char *const function_name
Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url_in, intptr_t line_number)
struct _Dart_Breakpoint * Dart_Breakpoint