| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // Getters for the current exception break state. | 325 // Getters for the current exception break state. |
| 326 static bool break_on_exception() { return break_on_exception_; } | 326 static bool break_on_exception() { return break_on_exception_; } |
| 327 static bool break_on_uncaught_exception() { | 327 static bool break_on_uncaught_exception() { |
| 328 return break_on_uncaught_exception_; | 328 return break_on_uncaught_exception_; |
| 329 } | 329 } |
| 330 | 330 |
| 331 enum AddressId { | 331 enum AddressId { |
| 332 k_after_break_target_address, | 332 k_after_break_target_address, |
| 333 k_debug_break_return_address, | 333 k_debug_break_return_address, |
| 334 k_debug_break_slot_address, | 334 k_debug_break_slot_address, |
| 335 k_restarter_frame_function_pointer, | 335 k_restarter_frame_function_pointer |
| 336 k_register_address | |
| 337 }; | 336 }; |
| 338 | 337 |
| 339 // Support for setting the address to jump to when returning from break point. | 338 // Support for setting the address to jump to when returning from break point. |
| 340 static Address* after_break_target_address() { | 339 static Address* after_break_target_address() { |
| 341 return reinterpret_cast<Address*>(&thread_local_.after_break_target_); | 340 return reinterpret_cast<Address*>(&thread_local_.after_break_target_); |
| 342 } | 341 } |
| 343 static Address* restarter_frame_function_pointer_address() { | 342 static Address* restarter_frame_function_pointer_address() { |
| 344 Object*** address = &thread_local_.restarter_frame_function_pointer_; | 343 Object*** address = &thread_local_.restarter_frame_function_pointer_; |
| 345 return reinterpret_cast<Address*>(address); | 344 return reinterpret_cast<Address*>(address); |
| 346 } | 345 } |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 // The previous state of the disable break used to restore the value when this | 945 // The previous state of the disable break used to restore the value when this |
| 947 // object is destructed. | 946 // object is destructed. |
| 948 bool prev_disable_break_; | 947 bool prev_disable_break_; |
| 949 }; | 948 }; |
| 950 | 949 |
| 951 | 950 |
| 952 // Debug_Address encapsulates the Address pointers used in generating debug | 951 // Debug_Address encapsulates the Address pointers used in generating debug |
| 953 // code. | 952 // code. |
| 954 class Debug_Address { | 953 class Debug_Address { |
| 955 public: | 954 public: |
| 956 Debug_Address(Debug::AddressId id, int reg = 0) | 955 Debug_Address(Debug::AddressId id) : id_(id) { } |
| 957 : id_(id), reg_(reg) { | |
| 958 ASSERT(reg == 0 || id == Debug::k_register_address); | |
| 959 } | |
| 960 | 956 |
| 961 static Debug_Address AfterBreakTarget() { | 957 static Debug_Address AfterBreakTarget() { |
| 962 return Debug_Address(Debug::k_after_break_target_address); | 958 return Debug_Address(Debug::k_after_break_target_address); |
| 963 } | 959 } |
| 964 | 960 |
| 965 static Debug_Address DebugBreakReturn() { | 961 static Debug_Address DebugBreakReturn() { |
| 966 return Debug_Address(Debug::k_debug_break_return_address); | 962 return Debug_Address(Debug::k_debug_break_return_address); |
| 967 } | 963 } |
| 968 | 964 |
| 969 static Debug_Address RestarterFrameFunctionPointer() { | 965 static Debug_Address RestarterFrameFunctionPointer() { |
| 970 return Debug_Address(Debug::k_restarter_frame_function_pointer); | 966 return Debug_Address(Debug::k_restarter_frame_function_pointer); |
| 971 } | 967 } |
| 972 | 968 |
| 973 static Debug_Address Register(int reg) { | |
| 974 return Debug_Address(Debug::k_register_address, reg); | |
| 975 } | |
| 976 | |
| 977 Address address() const { | 969 Address address() const { |
| 978 switch (id_) { | 970 switch (id_) { |
| 979 case Debug::k_after_break_target_address: | 971 case Debug::k_after_break_target_address: |
| 980 return reinterpret_cast<Address>(Debug::after_break_target_address()); | 972 return reinterpret_cast<Address>(Debug::after_break_target_address()); |
| 981 case Debug::k_debug_break_return_address: | 973 case Debug::k_debug_break_return_address: |
| 982 return reinterpret_cast<Address>(Debug::debug_break_return_address()); | 974 return reinterpret_cast<Address>(Debug::debug_break_return_address()); |
| 983 case Debug::k_debug_break_slot_address: | 975 case Debug::k_debug_break_slot_address: |
| 984 return reinterpret_cast<Address>(Debug::debug_break_slot_address()); | 976 return reinterpret_cast<Address>(Debug::debug_break_slot_address()); |
| 985 case Debug::k_restarter_frame_function_pointer: | 977 case Debug::k_restarter_frame_function_pointer: |
| 986 return reinterpret_cast<Address>( | 978 return reinterpret_cast<Address>( |
| 987 Debug::restarter_frame_function_pointer_address()); | 979 Debug::restarter_frame_function_pointer_address()); |
| 988 case Debug::k_register_address: | |
| 989 return reinterpret_cast<Address>(Debug::register_address(reg_)); | |
| 990 default: | 980 default: |
| 991 UNREACHABLE(); | 981 UNREACHABLE(); |
| 992 return NULL; | 982 return NULL; |
| 993 } | 983 } |
| 994 } | 984 } |
| 995 private: | 985 private: |
| 996 Debug::AddressId id_; | 986 Debug::AddressId id_; |
| 997 int reg_; | |
| 998 }; | 987 }; |
| 999 | 988 |
| 1000 // The optional thread that Debug Agent may use to temporary call V8 to process | 989 // The optional thread that Debug Agent may use to temporary call V8 to process |
| 1001 // pending debug requests if debuggee is not running V8 at the moment. | 990 // pending debug requests if debuggee is not running V8 at the moment. |
| 1002 // Techincally it does not call V8 itself, rather it asks embedding program | 991 // Techincally it does not call V8 itself, rather it asks embedding program |
| 1003 // to do this via v8::Debug::HostDispatchHandler | 992 // to do this via v8::Debug::HostDispatchHandler |
| 1004 class MessageDispatchHelperThread: public Thread { | 993 class MessageDispatchHelperThread: public Thread { |
| 1005 public: | 994 public: |
| 1006 MessageDispatchHelperThread(); | 995 MessageDispatchHelperThread(); |
| 1007 ~MessageDispatchHelperThread(); | 996 ~MessageDispatchHelperThread(); |
| 1008 | 997 |
| 1009 void Schedule(); | 998 void Schedule(); |
| 1010 | 999 |
| 1011 private: | 1000 private: |
| 1012 void Run(); | 1001 void Run(); |
| 1013 | 1002 |
| 1014 Semaphore* const sem_; | 1003 Semaphore* const sem_; |
| 1015 Mutex* const mutex_; | 1004 Mutex* const mutex_; |
| 1016 bool already_signalled_; | 1005 bool already_signalled_; |
| 1017 | 1006 |
| 1018 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); | 1007 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); |
| 1019 }; | 1008 }; |
| 1020 | 1009 |
| 1021 | 1010 |
| 1022 } } // namespace v8::internal | 1011 } } // namespace v8::internal |
| 1023 | 1012 |
| 1024 #endif // ENABLE_DEBUGGER_SUPPORT | 1013 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1025 | 1014 |
| 1026 #endif // V8_DEBUG_H_ | 1015 #endif // V8_DEBUG_H_ |
| OLD | NEW |