mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:17:14 +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()) {
|
||||
// Can't instrument native functions.
|
||||
return;
|
||||
// Can't instrument native functions. Fail silently.
|
||||
return Error::null();
|
||||
}
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (!target_function.HasCode()) {
|
||||
Compiler::CompileFunction(isolate, target_function);
|
||||
// If there were any errors, ignore them silently and return without
|
||||
// adding breakpoints to target.
|
||||
if (!target_function.HasCode()) {
|
||||
return;
|
||||
const Error& error = Error::Handle(
|
||||
Compiler::CompileFunction(isolate, target_function));
|
||||
if (!error.IsNull()) {
|
||||
return error.raw();
|
||||
}
|
||||
}
|
||||
// Hang on to the code object before deoptimizing, in case deoptimization
|
||||
|
@ -1213,6 +1212,7 @@ void Debugger::SetInternalBreakpoints(const Function& target_function) {
|
|||
bpt->Enable();
|
||||
}
|
||||
}
|
||||
return Error::null();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1871,13 +1871,15 @@ void Debugger::SyncBreakpoint(SourceBreakpoint* bpt) {
|
|||
}
|
||||
|
||||
|
||||
void Debugger::OneTimeBreakAtEntry(const Function& target_function) {
|
||||
SetInternalBreakpoints(target_function);
|
||||
if (target_function.HasImplicitClosureFunction()) {
|
||||
RawError* Debugger::OneTimeBreakAtEntry(const Function& target_function) {
|
||||
Error& err = Error::Handle();
|
||||
err = SetInternalBreakpoints(target_function);
|
||||
if (err.IsNull() && target_function.HasImplicitClosureFunction()) {
|
||||
const Function& closure_func =
|
||||
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.
|
||||
SourceBreakpoint* SetBreakpointAtLine(const String& script_url,
|
||||
intptr_t line_number);
|
||||
void OneTimeBreakAtEntry(const Function& target_function);
|
||||
RawError* OneTimeBreakAtEntry(const Function& target_function);
|
||||
|
||||
void RemoveBreakpoint(intptr_t bp_id);
|
||||
SourceBreakpoint* GetBreakpointById(intptr_t id);
|
||||
|
@ -458,7 +458,7 @@ class Debugger {
|
|||
intptr_t requested_token_pos,
|
||||
intptr_t last_token_pos);
|
||||
void DeoptimizeWorld();
|
||||
void SetInternalBreakpoints(const Function& target_function);
|
||||
RawError* SetInternalBreakpoints(const Function& target_function);
|
||||
SourceBreakpoint* SetBreakpoint(const Script& script,
|
||||
intptr_t token_pos,
|
||||
intptr_t last_token_pos);
|
||||
|
|
|
@ -450,7 +450,11 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
|
|||
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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue