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

Side by Side Diff: src/debug.cc

Issue 13720: Changed the debugger break handling to support situations where there are no ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 // Flood the function with break points. 842 // Flood the function with break points.
843 BreakLocationIterator it(GetDebugInfo(shared), ALL_BREAK_LOCATIONS); 843 BreakLocationIterator it(GetDebugInfo(shared), ALL_BREAK_LOCATIONS);
844 while (!it.Done()) { 844 while (!it.Done()) {
845 it.SetOneShot(); 845 it.SetOneShot();
846 it.Next(); 846 it.Next();
847 } 847 }
848 } 848 }
849 849
850 850
851 void Debug::FloodHandlerWithOneShot() { 851 void Debug::FloodHandlerWithOneShot() {
852 // Iterate through the JavaScript stack looking for handlers.
852 StackFrame::Id id = Top::break_frame_id(); 853 StackFrame::Id id = Top::break_frame_id();
854 if (id == StackFrame::NO_ID) {
855 // If there is no JavaScript stack don't do anything.
856 return;
857 }
853 for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) { 858 for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) {
854 JavaScriptFrame* frame = it.frame(); 859 JavaScriptFrame* frame = it.frame();
855 if (frame->HasHandler()) { 860 if (frame->HasHandler()) {
856 Handle<SharedFunctionInfo> shared = 861 Handle<SharedFunctionInfo> shared =
857 Handle<SharedFunctionInfo>( 862 Handle<SharedFunctionInfo>(
858 JSFunction::cast(frame->function())->shared()); 863 JSFunction::cast(frame->function())->shared());
859 // Flood the function with the catch block with break points 864 // Flood the function with the catch block with break points
860 FloodWithOneShot(shared); 865 FloodWithOneShot(shared);
861 return; 866 return;
862 } 867 }
(...skipping 16 matching lines...) Expand all
879 884
880 // Remember this step action and count. 885 // Remember this step action and count.
881 thread_local_.last_step_action_ = step_action; 886 thread_local_.last_step_action_ = step_action;
882 thread_local_.step_count_ = step_count; 887 thread_local_.step_count_ = step_count;
883 888
884 // Get the frame where the execution has stopped and skip the debug frame if 889 // Get the frame where the execution has stopped and skip the debug frame if
885 // any. The debug frame will only be present if execution was stopped due to 890 // any. The debug frame will only be present if execution was stopped due to
886 // hitting a break point. In other situations (e.g. unhandled exception) the 891 // hitting a break point. In other situations (e.g. unhandled exception) the
887 // debug frame is not present. 892 // debug frame is not present.
888 StackFrame::Id id = Top::break_frame_id(); 893 StackFrame::Id id = Top::break_frame_id();
894 if (id == StackFrame::NO_ID) {
895 // If there is no JavaScript stack don't do anything.
896 return;
897 }
889 JavaScriptFrameIterator frames_it(id); 898 JavaScriptFrameIterator frames_it(id);
890 JavaScriptFrame* frame = frames_it.frame(); 899 JavaScriptFrame* frame = frames_it.frame();
891 900
892 // First of all ensure there is one-shot break points in the top handler 901 // First of all ensure there is one-shot break points in the top handler
893 // if any. 902 // if any.
894 FloodHandlerWithOneShot(); 903 FloodHandlerWithOneShot();
895 904
896 // If the function on the top frame is unresolved perform step out. This will 905 // If the function on the top frame is unresolved perform step out. This will
897 // be the case when calling unknown functions and having the debugger stopped 906 // be the case when calling unknown functions and having the debugger stopped
898 // in an unhandled exception. 907 // in an unhandled exception.
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 } 1961 }
1953 1962
1954 1963
1955 void LockingMessageQueue::Clear() { 1964 void LockingMessageQueue::Clear() {
1956 ScopedLock sl(lock_); 1965 ScopedLock sl(lock_);
1957 queue_.Clear(); 1966 queue_.Clear();
1958 } 1967 }
1959 1968
1960 1969
1961 } } // namespace v8::internal 1970 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698