Add breakOnCaughtException and breakOnUncaughtException flags
Review URL: http://codereview.chromium.org/3275011 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5480 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
eef3bd7c04
commit
41064a57c3
@ -45,7 +45,7 @@ Debug.DebugEvent = { Break: 1,
|
|||||||
ScriptCollected: 6 };
|
ScriptCollected: 6 };
|
||||||
|
|
||||||
// Types of exceptions that can be broken upon.
|
// Types of exceptions that can be broken upon.
|
||||||
Debug.ExceptionBreak = { All : 0,
|
Debug.ExceptionBreak = { Caught : 0,
|
||||||
Uncaught: 1 };
|
Uncaught: 1 };
|
||||||
|
|
||||||
// The different types of steps.
|
// The different types of steps.
|
||||||
@ -87,7 +87,27 @@ var debugger_flags = {
|
|||||||
this.value = !!value;
|
this.value = !!value;
|
||||||
%SetDisableBreak(!this.value);
|
%SetDisableBreak(!this.value);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
breakOnCaughtException: {
|
||||||
|
getValue: function() { return Debug.isBreakOnException(); },
|
||||||
|
setValue: function(value) {
|
||||||
|
if (value) {
|
||||||
|
Debug.setBreakOnException();
|
||||||
|
} else {
|
||||||
|
Debug.clearBreakOnException();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
breakOnUncaughtException: {
|
||||||
|
getValue: function() { return Debug.isBreakOnUncaughtException(); },
|
||||||
|
setValue: function(value) {
|
||||||
|
if (value) {
|
||||||
|
Debug.setBreakOnUncaughtException();
|
||||||
|
} else {
|
||||||
|
Debug.clearBreakOnUncaughtException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -781,11 +801,15 @@ Debug.clearStepping = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug.setBreakOnException = function() {
|
Debug.setBreakOnException = function() {
|
||||||
return %ChangeBreakOnException(Debug.ExceptionBreak.All, true);
|
return %ChangeBreakOnException(Debug.ExceptionBreak.Caught, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
Debug.clearBreakOnException = function() {
|
Debug.clearBreakOnException = function() {
|
||||||
return %ChangeBreakOnException(Debug.ExceptionBreak.All, false);
|
return %ChangeBreakOnException(Debug.ExceptionBreak.Caught, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
Debug.isBreakOnException = function() {
|
||||||
|
return !!%IsBreakOnException(Debug.ExceptionBreak.Caught);
|
||||||
};
|
};
|
||||||
|
|
||||||
Debug.setBreakOnUncaughtException = function() {
|
Debug.setBreakOnUncaughtException = function() {
|
||||||
@ -796,6 +820,10 @@ Debug.clearBreakOnUncaughtException = function() {
|
|||||||
return %ChangeBreakOnException(Debug.ExceptionBreak.Uncaught, false);
|
return %ChangeBreakOnException(Debug.ExceptionBreak.Uncaught, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Debug.isBreakOnUncaughtException = function() {
|
||||||
|
return !!%IsBreakOnException(Debug.ExceptionBreak.Uncaught);
|
||||||
|
};
|
||||||
|
|
||||||
Debug.showBreakPoints = function(f, full) {
|
Debug.showBreakPoints = function(f, full) {
|
||||||
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
|
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
|
||||||
var source = full ? this.scriptSource(f) : this.source(f);
|
var source = full ? this.scriptSource(f) : this.source(f);
|
||||||
|
@ -1200,6 +1200,15 @@ void Debug::ChangeBreakOnException(ExceptionBreakType type, bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Debug::IsBreakOnException(ExceptionBreakType type) {
|
||||||
|
if (type == BreakUncaughtException) {
|
||||||
|
return break_on_uncaught_exception_;
|
||||||
|
} else {
|
||||||
|
return break_on_exception_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Debug::PrepareStep(StepAction step_action, int step_count) {
|
void Debug::PrepareStep(StepAction step_action, int step_count) {
|
||||||
HandleScope scope;
|
HandleScope scope;
|
||||||
ASSERT(Debug::InDebugger());
|
ASSERT(Debug::InDebugger());
|
||||||
|
@ -236,6 +236,7 @@ class Debug {
|
|||||||
static void FloodWithOneShot(Handle<SharedFunctionInfo> shared);
|
static void FloodWithOneShot(Handle<SharedFunctionInfo> shared);
|
||||||
static void FloodHandlerWithOneShot();
|
static void FloodHandlerWithOneShot();
|
||||||
static void ChangeBreakOnException(ExceptionBreakType type, bool enable);
|
static void ChangeBreakOnException(ExceptionBreakType type, bool enable);
|
||||||
|
static bool IsBreakOnException(ExceptionBreakType type);
|
||||||
static void PrepareStep(StepAction step_action, int step_count);
|
static void PrepareStep(StepAction step_action, int step_count);
|
||||||
static void ClearStepping();
|
static void ClearStepping();
|
||||||
static bool StepNextContinue(BreakLocationIterator* break_location_iterator,
|
static bool StepNextContinue(BreakLocationIterator* break_location_iterator,
|
||||||
|
@ -8962,6 +8962,20 @@ static Object* Runtime_ChangeBreakOnException(Arguments args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Returns the state of break on exceptions
|
||||||
|
// args[0]: boolean indicating uncaught exceptions
|
||||||
|
static Object* Runtime_IsBreakOnException(Arguments args) {
|
||||||
|
HandleScope scope;
|
||||||
|
ASSERT(args.length() == 1);
|
||||||
|
ASSERT(args[0]->IsNumber());
|
||||||
|
|
||||||
|
ExceptionBreakType type =
|
||||||
|
static_cast<ExceptionBreakType>(NumberToUint32(args[0]));
|
||||||
|
bool result = Debug::IsBreakOnException(type);
|
||||||
|
return Smi::FromInt(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Prepare for stepping
|
// Prepare for stepping
|
||||||
// args[0]: break id for checking execution state
|
// args[0]: break id for checking execution state
|
||||||
// args[1]: step action from the enumeration StepAction
|
// args[1]: step action from the enumeration StepAction
|
||||||
|
@ -332,6 +332,7 @@ namespace internal {
|
|||||||
F(SetScriptBreakPoint, 3, 1) \
|
F(SetScriptBreakPoint, 3, 1) \
|
||||||
F(ClearBreakPoint, 1, 1) \
|
F(ClearBreakPoint, 1, 1) \
|
||||||
F(ChangeBreakOnException, 2, 1) \
|
F(ChangeBreakOnException, 2, 1) \
|
||||||
|
F(IsBreakOnException, 1, 1) \
|
||||||
F(PrepareStep, 3, 1) \
|
F(PrepareStep, 3, 1) \
|
||||||
F(ClearStepping, 0, 1) \
|
F(ClearStepping, 0, 1) \
|
||||||
F(DebugEvaluate, 4, 1) \
|
F(DebugEvaluate, 4, 1) \
|
||||||
|
Loading…
Reference in New Issue
Block a user