Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: src/debug.cc

Issue 21347: Make the debugger completely unload when the debug event listener is unregist... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.h ('k') | src/debug-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
===================================================================
--- src/debug.cc (revision 1255)
+++ src/debug.cc (working copy)
@@ -314,6 +314,8 @@
void BreakLocationIterator::PrepareStepIn() {
+ HandleScope scope;
+
// Step in can only be prepared if currently positioned on an IC call or
// construct call.
Address target = rinfo()->target_address();
@@ -363,6 +365,17 @@
}
+// Clear out all the debug break code. This is ONLY supposed to be used when
+// shutting down the debugger as it will leave the break point information in
+// DebugInfo even though the code is patched back to the non break point state.
+void BreakLocationIterator::ClearAllDebugBreak() {
+ while (!Done()) {
+ ClearDebugBreak();
+ Next();
+ }
+}
+
+
bool BreakLocationIterator::RinfoDone() const {
ASSERT(reloc_iterator_->done() == reloc_iterator_original_->done());
return reloc_iterator_->done();
@@ -589,6 +602,9 @@
return;
}
+ // Get rid of all break points and related information.
+ ClearAllBreakPoints();
+
// Clear debugger context global handle.
GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_context_.location()));
debug_context_ = Handle<Context>();
@@ -715,6 +731,8 @@
// Check whether a single break point object is triggered.
bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
+ HandleScope scope;
+
// Ignore check if break point object is not a JSObject.
if (!break_point_object->IsJSObject()) return true;
@@ -765,6 +783,8 @@
void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
int source_position,
Handle<Object> break_point_object) {
+ HandleScope scope;
+
if (!EnsureDebugInfo(shared)) {
// Return if retrieving debug info failed.
return;
@@ -785,6 +805,8 @@
void Debug::ClearBreakPoint(Handle<Object> break_point_object) {
+ HandleScope scope;
+
DebugInfoListNode* node = debug_info_list_;
while (node != NULL) {
Object* result = DebugInfo::FindBreakPointInfo(node->debug_info(),
@@ -817,6 +839,22 @@
}
+void Debug::ClearAllBreakPoints() {
+ DebugInfoListNode* node = debug_info_list_;
+ while (node != NULL) {
+ // Remove all debug break code.
+ BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
+ it.ClearAllDebugBreak();
+ node = node->next();
+ }
+
+ // Remove all debug info.
+ while (debug_info_list_ != NULL) {
+ RemoveDebugInfo(debug_info_list_->debug_info());
+ }
+}
+
+
void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared) {
// Make sure the function has setup the debug info.
if (!EnsureDebugInfo(shared)) {
@@ -1214,6 +1252,8 @@
void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
+ HandleScope scope;
+
// Get the executing function in which the debug break occurred.
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
@@ -1289,6 +1329,7 @@
void Debug::ClearMirrorCache() {
+ HandleScope scope;
ASSERT(Top::context() == *Debug::debug_context());
// Clear the mirror cache.
@@ -1588,6 +1629,8 @@
void Debugger::ProcessDebugEvent(v8::DebugEvent event,
Handle<Object> event_data) {
+ HandleScope scope;
+
// Create the execution state.
bool caught_exception = false;
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
@@ -1704,6 +1747,9 @@
if (!debugger_active() && message_thread_) {
message_thread_->OnDebuggerInactive();
}
+ if (!debugger_active()) {
+ Debug::Unload();
+ }
}
@@ -1808,6 +1854,8 @@
void DebugMessageThread::DebugEvent(v8::DebugEvent event,
Handle<Object> exec_state,
Handle<Object> event_data) {
+ HandleScope scope;
+
if (!Debug::Load()) return;
// Process the individual events.
« no previous file with comments | « src/debug.h ('k') | src/debug-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698