25#define UNWRAP_AND_CHECK_PARAM(type, var, param) \
26 type& var = type::Handle(); \
28 const Object& tmp = Object::Handle(Api::UnwrapHandle(param)); \
30 return Api::NewError("%s expects argument '%s' to be non-null.", \
31 CURRENT_FUNC, #param); \
32 } else if (tmp.IsApiError()) { \
34 } else if (!tmp.Is##type()) { \
35 return Api::NewError("%s expects argument '%s' to be of type %s.", \
36 CURRENT_FUNC, #param, #type); \
41#define CHECK_AND_CAST(type, var, param) \
42 type* var = nullptr; \
44 if (param == nullptr) { \
45 return Api::NewError("%s expects argument '%s' to be non-null.", \
46 CURRENT_FUNC, #param); \
48 var = reinterpret_cast<type*>(param); \
51#define CHECK_NOT_NULL(param) \
52 if (param == nullptr) { \
53 return Api::NewError("%s expects argument '%s' to be non-null.", \
54 CURRENT_FUNC, #param); \
57#define CHECK_DEBUGGER(isolate) \
58 if (isolate->debugger() == nullptr) { \
59 return Api::NewError("%s requires debugger support.", CURRENT_FUNC); \
66 *
length = stack_trace->Length();
76 if ((frame_index < 0) || (frame_index >= stack_trace->Length())) {
77 return Api::NewError(
"argument 'frame_index' is out of range for %s",
100 if (obj.IsUnhandledException()) {
103 dart_stacktrace ^=
error.stacktrace();
104 if (dart_stacktrace.
IsNull()) {
113 "Can only get stacktraces from error handles or "
114 "instances of Error.");
121 intptr_t* line_number,
122 intptr_t* column_number) {
128 if (script_url !=
nullptr) {
131 if (line_number !=
nullptr) {
132 *line_number =
frame->LineNumber();
134 if (column_number !=
nullptr) {
135 *column_number =
frame->ColumnNumber();
141 intptr_t line_number) {
151 if (bpt ==
nullptr) {
165 I->debugger()->RemoveBreakpoint(breakpoint_id.AsInt64Value());
175 if (
target.IsError())
return lib_handle;
177 return Api::NewError(
"%s expects argument 'target' to be non-null",
190 Array::empty_array(),
191 Array::empty_array(),
192 Array::empty_array(),
193 Array::empty_array(),
194 Array::empty_array(),
198 TokenPosition::kNoSource,
207 const_cast<uint8_t*
>(compilation_result.
kernel),
214 Array::empty_array(),
216 Array::empty_array(),
218 TypeArguments::null_type_arguments()));
225 const Library& lib = Api::UnwrapLibraryHandle(
Z, library);
229 if (library_id ==
nullptr) {
232 *library_id = lib.
index();
237 bool* is_debuggable) {
static Dart_Handle Success()
static Dart_Handle NewHandle(Thread *thread, ObjectPtr raw)
static ObjectPtr UnwrapHandle(Dart_Handle object)
static Dart_Handle NewError(const char *format,...) PRINTF_ATTRIBUTE(1
static DebuggerStackTrace * Collect()
static DebuggerStackTrace * From(const class StackTrace &ex_trace)
Breakpoint * SetBreakpointAtLineCol(const String &script_url, intptr_t line_number, intptr_t column_number)
static ExternalTypedDataPtr NewFinalizeWithFree(uint8_t *data, intptr_t len)
static Dart_KernelCompilationResult CompileExpressionToKernel(const uint8_t *platform_kernel, intptr_t platform_kernel_size, const char *expression, const Array &definitions, const Array &definition_types, const Array &type_definitions, const Array &type_bounds, const Array &type_defaults, const char *library_url, const char *klass, const char *method, TokenPosition token_pos, char const *script_uri, bool is_static)
ObjectPtr EvaluateCompiledExpression(const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array ¶m_values, const TypeArguments &type_param_values) const
static LibraryPtr GetLibrary(intptr_t index)
void set_debuggable(bool value) const
bool IsDebuggable() const
virtual const char * ToCString() const
static Thread * Current()
@ Dart_KernelCompilationStatus_Ok
struct _Dart_Handle * Dart_Handle
#define DARTSCOPE(thread)
#define RETURN_TYPE_ERROR(zone, dart_handle, type)
#define RETURN_NULL_ERROR(parameter)
#define CHECK_AND_CAST(type, var, param)
#define CHECK_NOT_NULL(param)
#define UNWRAP_AND_CHECK_PARAM(type, var, param)
#define CHECK_DEBUGGER(isolate)
const uint8_t uint32_t uint32_t GError ** error
Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, bool *is_debuggable)
Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace, intptr_t *length)
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)
Dart_Handle Dart_RemoveBreakpoint(Dart_Handle breakpoint_id_in)
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
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_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
const char *const function_name
Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url_in, intptr_t line_number)
Dart_KernelCompilationStatus status