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

Side by Side Diff: src/debug.cc

Issue 9965101: Don't crash on stack overflow entering the debugger. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/execution.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 isolate->clear_pending_exception(); 760 isolate->clear_pending_exception();
761 return false; 761 return false;
762 } 762 }
763 763
764 // Execute the shared function in the debugger context. 764 // Execute the shared function in the debugger context.
765 Handle<Context> context = isolate->global_context(); 765 Handle<Context> context = isolate->global_context();
766 bool caught_exception; 766 bool caught_exception;
767 Handle<JSFunction> function = 767 Handle<JSFunction> function =
768 factory->NewFunctionFromSharedFunctionInfo(function_info, context); 768 factory->NewFunctionFromSharedFunctionInfo(function_info, context);
769 769
770 Execution::TryCall(function, Handle<Object>(context->global()), 770 Handle<Object> exception =
771 0, NULL, &caught_exception); 771 Execution::TryCall(function, Handle<Object>(context->global()),
772 0, NULL, &caught_exception);
772 773
773 // Check for caught exceptions. 774 // Check for caught exceptions.
774 if (caught_exception) { 775 if (caught_exception) {
776 ASSERT(!isolate->has_pending_exception());
777 MessageLocation computed_location;
778 isolate->ComputeLocation(&computed_location);
775 Handle<Object> message = MessageHandler::MakeMessageObject( 779 Handle<Object> message = MessageHandler::MakeMessageObject(
776 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), 780 "error_loading_debugger", &computed_location,
777 Handle<String>(), Handle<JSArray>()); 781 Vector<Handle<Object> >::empty(), Handle<String>(), Handle<JSArray>());
782 ASSERT(!isolate->has_pending_exception());
783 isolate->set_pending_exception(*exception);
778 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); 784 MessageHandler::ReportMessage(Isolate::Current(), NULL, message);
785 isolate->clear_pending_exception();
779 return false; 786 return false;
780 } 787 }
781 788
782 // Mark this script as native and return successfully. 789 // Mark this script as native and return successfully.
783 Handle<Script> script(Script::cast(function->shared()->script())); 790 Handle<Script> script(Script::cast(function->shared()->script()));
784 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 791 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
785 return true; 792 return true;
786 } 793 }
787 794
788 795
(...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after
3225 3232
3226 3233
3227 EnterDebugger::~EnterDebugger() { 3234 EnterDebugger::~EnterDebugger() {
3228 ASSERT(Isolate::Current() == isolate_); 3235 ASSERT(Isolate::Current() == isolate_);
3229 Debug* debug = isolate_->debug(); 3236 Debug* debug = isolate_->debug();
3230 3237
3231 // Restore to the previous break state. 3238 // Restore to the previous break state.
3232 debug->SetBreak(break_frame_id_, break_id_); 3239 debug->SetBreak(break_frame_id_, break_id_);
3233 3240
3234 // Check for leaving the debugger. 3241 // Check for leaving the debugger.
3235 if (prev_ == NULL) { 3242 if (!load_failed_ && prev_ == NULL) {
3236 // Clear mirror cache when leaving the debugger. Skip this if there is a 3243 // Clear mirror cache when leaving the debugger. Skip this if there is a
3237 // pending exception as clearing the mirror cache calls back into 3244 // pending exception as clearing the mirror cache calls back into
3238 // JavaScript. This can happen if the v8::Debug::Call is used in which 3245 // JavaScript. This can happen if the v8::Debug::Call is used in which
3239 // case the exception should end up in the calling code. 3246 // case the exception should end up in the calling code.
3240 if (!isolate_->has_pending_exception()) { 3247 if (!isolate_->has_pending_exception()) {
3241 // Try to avoid any pending debug break breaking in the clear mirror 3248 // Try to avoid any pending debug break breaking in the clear mirror
3242 // cache JavaScript code. 3249 // cache JavaScript code.
3243 if (isolate_->stack_guard()->IsDebugBreak()) { 3250 if (isolate_->stack_guard()->IsDebugBreak()) {
3244 debug->set_interrupts_pending(DEBUGBREAK); 3251 debug->set_interrupts_pending(DEBUGBREAK);
3245 isolate_->stack_guard()->Continue(DEBUGBREAK); 3252 isolate_->stack_guard()->Continue(DEBUGBREAK);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3572 { 3579 {
3573 Locker locker; 3580 Locker locker;
3574 Isolate::Current()->debugger()->CallMessageDispatchHandler(); 3581 Isolate::Current()->debugger()->CallMessageDispatchHandler();
3575 } 3582 }
3576 } 3583 }
3577 } 3584 }
3578 3585
3579 #endif // ENABLE_DEBUGGER_SUPPORT 3586 #endif // ENABLE_DEBUGGER_SUPPORT
3580 3587
3581 } } // namespace v8::internal 3588 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698