OLD | NEW |
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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 | 1021 |
1022 // Return the debug info for this function. EnsureDebugInfo must be called | 1022 // Return the debug info for this function. EnsureDebugInfo must be called |
1023 // prior to ensure the debug info has been generated for shared. | 1023 // prior to ensure the debug info has been generated for shared. |
1024 Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) { | 1024 Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) { |
1025 ASSERT(HasDebugInfo(shared)); | 1025 ASSERT(HasDebugInfo(shared)); |
1026 return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info())); | 1026 return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info())); |
1027 } | 1027 } |
1028 | 1028 |
1029 | 1029 |
1030 void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared, | 1030 void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared, |
1031 int source_position, | 1031 Handle<Object> break_point_object, |
1032 Handle<Object> break_point_object) { | 1032 int* source_position) { |
1033 HandleScope scope; | 1033 HandleScope scope; |
1034 | 1034 |
1035 if (!EnsureDebugInfo(shared)) { | 1035 if (!EnsureDebugInfo(shared)) { |
1036 // Return if retrieving debug info failed. | 1036 // Return if retrieving debug info failed. |
1037 return; | 1037 return; |
1038 } | 1038 } |
1039 | 1039 |
1040 Handle<DebugInfo> debug_info = GetDebugInfo(shared); | 1040 Handle<DebugInfo> debug_info = GetDebugInfo(shared); |
1041 // Source positions starts with zero. | 1041 // Source positions starts with zero. |
1042 ASSERT(source_position >= 0); | 1042 ASSERT(source_position >= 0); |
1043 | 1043 |
1044 // Find the break point and change it. | 1044 // Find the break point and change it. |
1045 BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS); | 1045 BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS); |
1046 it.FindBreakLocationFromPosition(source_position); | 1046 it.FindBreakLocationFromPosition(*source_position); |
1047 it.SetBreakPoint(break_point_object); | 1047 it.SetBreakPoint(break_point_object); |
1048 | 1048 |
| 1049 *source_position = it.position(); |
| 1050 |
1049 // At least one active break point now. | 1051 // At least one active break point now. |
1050 ASSERT(debug_info->GetBreakPointCount() > 0); | 1052 ASSERT(debug_info->GetBreakPointCount() > 0); |
1051 } | 1053 } |
1052 | 1054 |
1053 | 1055 |
1054 void Debug::ClearBreakPoint(Handle<Object> break_point_object) { | 1056 void Debug::ClearBreakPoint(Handle<Object> break_point_object) { |
1055 HandleScope scope; | 1057 HandleScope scope; |
1056 | 1058 |
1057 DebugInfoListNode* node = debug_info_list_; | 1059 DebugInfoListNode* node = debug_info_list_; |
1058 while (node != NULL) { | 1060 while (node != NULL) { |
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2920 { | 2922 { |
2921 Locker locker; | 2923 Locker locker; |
2922 Debugger::CallMessageDispatchHandler(); | 2924 Debugger::CallMessageDispatchHandler(); |
2923 } | 2925 } |
2924 } | 2926 } |
2925 } | 2927 } |
2926 | 2928 |
2927 #endif // ENABLE_DEBUGGER_SUPPORT | 2929 #endif // ENABLE_DEBUGGER_SUPPORT |
2928 | 2930 |
2929 } } // namespace v8::internal | 2931 } } // namespace v8::internal |
OLD | NEW |