OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 8878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8889 internal_isolate->stack_guard()->ClearDebugBreak(); | 8889 internal_isolate->stack_guard()->ClearDebugBreak(); |
8890 } | 8890 } |
8891 | 8891 |
8892 | 8892 |
8893 bool Debug::CheckDebugBreak(Isolate* isolate) { | 8893 bool Debug::CheckDebugBreak(Isolate* isolate) { |
8894 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8894 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8895 return internal_isolate->stack_guard()->CheckDebugBreak(); | 8895 return internal_isolate->stack_guard()->CheckDebugBreak(); |
8896 } | 8896 } |
8897 | 8897 |
8898 | 8898 |
| 8899 void Debug::SetMessageHandler(Isolate* isolate, |
| 8900 v8::Debug::MessageHandler handler) { |
| 8901 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 8902 ENTER_V8(i_isolate); |
| 8903 i_isolate->debug()->SetMessageHandler(handler); |
| 8904 } |
| 8905 |
| 8906 |
| 8907 void Debug::SendCommand(Isolate* isolate, |
| 8908 const uint16_t* command, |
| 8909 int length, |
| 8910 ClientData* client_data) { |
| 8911 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 8912 internal_isolate->debug()->EnqueueCommandMessage( |
| 8913 i::Vector<const uint16_t>(command, length), client_data); |
| 8914 } |
| 8915 |
| 8916 |
8899 MaybeLocal<Value> Debug::Call(Local<Context> context, | 8917 MaybeLocal<Value> Debug::Call(Local<Context> context, |
8900 v8::Local<v8::Function> fun, | 8918 v8::Local<v8::Function> fun, |
8901 v8::Local<v8::Value> data) { | 8919 v8::Local<v8::Value> data) { |
8902 PREPARE_FOR_EXECUTION(context, Debug, Call, Value); | 8920 PREPARE_FOR_EXECUTION(context, Debug, Call, Value); |
8903 i::Handle<i::Object> data_obj; | 8921 i::Handle<i::Object> data_obj; |
8904 if (data.IsEmpty()) { | 8922 if (data.IsEmpty()) { |
8905 data_obj = isolate->factory()->undefined_value(); | 8923 data_obj = isolate->factory()->undefined_value(); |
8906 } else { | 8924 } else { |
8907 data_obj = Utils::OpenHandle(*data); | 8925 data_obj = Utils::OpenHandle(*data); |
8908 } | 8926 } |
(...skipping 19 matching lines...) Expand all Loading... |
8928 const int kArgc = 1; | 8946 const int kArgc = 1; |
8929 v8::Local<v8::Value> argv[kArgc] = {obj}; | 8947 v8::Local<v8::Value> argv[kArgc] = {obj}; |
8930 Local<Value> result; | 8948 Local<Value> result; |
8931 has_pending_exception = | 8949 has_pending_exception = |
8932 !v8_fun->Call(context, Utils::ToLocal(debug), kArgc, argv) | 8950 !v8_fun->Call(context, Utils::ToLocal(debug), kArgc, argv) |
8933 .ToLocal(&result); | 8951 .ToLocal(&result); |
8934 RETURN_ON_FAILED_EXECUTION(Value); | 8952 RETURN_ON_FAILED_EXECUTION(Value); |
8935 RETURN_ESCAPED(result); | 8953 RETURN_ESCAPED(result); |
8936 } | 8954 } |
8937 | 8955 |
| 8956 void Debug::ProcessDebugMessages(Isolate* isolate) { |
| 8957 reinterpret_cast<i::Isolate*>(isolate)->debug()->ProcessDebugMessages(true); |
| 8958 } |
8938 | 8959 |
| 8960 |
8939 Local<Context> Debug::GetDebugContext(Isolate* isolate) { | 8961 Local<Context> Debug::GetDebugContext(Isolate* isolate) { |
8940 return debug::GetDebugContext(isolate); | 8962 return debug::GetDebugContext(isolate); |
8941 } | 8963 } |
8942 | 8964 |
8943 | 8965 |
8944 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { | 8966 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { |
8945 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8967 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8946 ENTER_V8(i_isolate); | 8968 ENTER_V8(i_isolate); |
8947 if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>(); | 8969 if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>(); |
8948 i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext(); | 8970 i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext(); |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9999 Address callback_address = | 10021 Address callback_address = |
10000 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10022 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10001 VMState<EXTERNAL> state(isolate); | 10023 VMState<EXTERNAL> state(isolate); |
10002 ExternalCallbackScope call_scope(isolate, callback_address); | 10024 ExternalCallbackScope call_scope(isolate, callback_address); |
10003 callback(info); | 10025 callback(info); |
10004 } | 10026 } |
10005 | 10027 |
10006 | 10028 |
10007 } // namespace internal | 10029 } // namespace internal |
10008 } // namespace v8 | 10030 } // namespace v8 |
OLD | NEW |