mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:41:19 +00:00
Detect compile errors when setting breakpoint
When the VM is started with the —-debug option, it compiles the main function eagerly to set a one-shot breakpoint. So far we silently dropped errors during the compilation, which is wrong. This change propagates the error to the caller. Fixes issue https://code.google.com/p/dart/issues/detail?id=20558 R=regis@google.com Review URL: https://codereview.chromium.org//470353003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39390 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
37826c2b62
commit
549f9d467c
|
@ -1176,18 +1176,17 @@ void Debugger::DeoptimizeWorld() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Debugger::SetInternalBreakpoints(const Function& target_function) {
|
RawError* Debugger::SetInternalBreakpoints(const Function& target_function) {
|
||||||
if (target_function.is_native()) {
|
if (target_function.is_native()) {
|
||||||
// Can't instrument native functions.
|
// Can't instrument native functions. Fail silently.
|
||||||
return;
|
return Error::null();
|
||||||
}
|
}
|
||||||
Isolate* isolate = Isolate::Current();
|
Isolate* isolate = Isolate::Current();
|
||||||
if (!target_function.HasCode()) {
|
if (!target_function.HasCode()) {
|
||||||
Compiler::CompileFunction(isolate, target_function);
|
const Error& error = Error::Handle(
|
||||||
// If there were any errors, ignore them silently and return without
|
Compiler::CompileFunction(isolate, target_function));
|
||||||
// adding breakpoints to target.
|
if (!error.IsNull()) {
|
||||||
if (!target_function.HasCode()) {
|
return error.raw();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Hang on to the code object before deoptimizing, in case deoptimization
|
// Hang on to the code object before deoptimizing, in case deoptimization
|
||||||
|
@ -1213,6 +1212,7 @@ void Debugger::SetInternalBreakpoints(const Function& target_function) {
|
||||||
bpt->Enable();
|
bpt->Enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Error::null();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1871,13 +1871,15 @@ void Debugger::SyncBreakpoint(SourceBreakpoint* bpt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Debugger::OneTimeBreakAtEntry(const Function& target_function) {
|
RawError* Debugger::OneTimeBreakAtEntry(const Function& target_function) {
|
||||||
SetInternalBreakpoints(target_function);
|
Error& err = Error::Handle();
|
||||||
if (target_function.HasImplicitClosureFunction()) {
|
err = SetInternalBreakpoints(target_function);
|
||||||
|
if (err.IsNull() && target_function.HasImplicitClosureFunction()) {
|
||||||
const Function& closure_func =
|
const Function& closure_func =
|
||||||
Function::Handle(target_function.ImplicitClosureFunction());
|
Function::Handle(target_function.ImplicitClosureFunction());
|
||||||
SetInternalBreakpoints(closure_func);
|
err = SetInternalBreakpoints(closure_func);
|
||||||
}
|
}
|
||||||
|
return err.raw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ class Debugger {
|
||||||
// TODO(turnidge): script_url may no longer be specific enough.
|
// TODO(turnidge): script_url may no longer be specific enough.
|
||||||
SourceBreakpoint* SetBreakpointAtLine(const String& script_url,
|
SourceBreakpoint* SetBreakpointAtLine(const String& script_url,
|
||||||
intptr_t line_number);
|
intptr_t line_number);
|
||||||
void OneTimeBreakAtEntry(const Function& target_function);
|
RawError* OneTimeBreakAtEntry(const Function& target_function);
|
||||||
|
|
||||||
void RemoveBreakpoint(intptr_t bp_id);
|
void RemoveBreakpoint(intptr_t bp_id);
|
||||||
SourceBreakpoint* GetBreakpointById(intptr_t id);
|
SourceBreakpoint* GetBreakpointById(intptr_t id);
|
||||||
|
@ -458,7 +458,7 @@ class Debugger {
|
||||||
intptr_t requested_token_pos,
|
intptr_t requested_token_pos,
|
||||||
intptr_t last_token_pos);
|
intptr_t last_token_pos);
|
||||||
void DeoptimizeWorld();
|
void DeoptimizeWorld();
|
||||||
void SetInternalBreakpoints(const Function& target_function);
|
RawError* SetInternalBreakpoints(const Function& target_function);
|
||||||
SourceBreakpoint* SetBreakpoint(const Script& script,
|
SourceBreakpoint* SetBreakpoint(const Script& script,
|
||||||
intptr_t token_pos,
|
intptr_t token_pos,
|
||||||
intptr_t last_token_pos);
|
intptr_t last_token_pos);
|
||||||
|
|
|
@ -450,7 +450,11 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
|
||||||
function_name.ToCString());
|
function_name.ToCString());
|
||||||
}
|
}
|
||||||
|
|
||||||
debugger->OneTimeBreakAtEntry(bp_target);
|
const Error& error =
|
||||||
|
Error::Handle(isolate, debugger->OneTimeBreakAtEntry(bp_target));
|
||||||
|
if (!error.IsNull()) {
|
||||||
|
return Api::NewHandle(isolate, error.raw());
|
||||||
|
}
|
||||||
return Api::Success();
|
return Api::Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue