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

Side by Side Diff: test/cctest/test-debug.cc

Issue 484643002: Version 3.28.71.3 (merged r23081) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.28
Patch Set: Created 6 years, 4 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 | « test/cctest/test-circular-queue.cc ('k') | test/cctest/test-declarative-accessors.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 2012 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
(...skipping 4830 matching lines...) Expand 10 before | Expand all | Expand 10 after
4841 * response messages to the debugger. Fills queues and makes 4841 * response messages to the debugger. Fills queues and makes
4842 * them grow. 4842 * them grow.
4843 */ 4843 */
4844 Barriers message_queue_barriers; 4844 Barriers message_queue_barriers;
4845 4845
4846 // This is the debugger thread, that executes no v8 calls except 4846 // This is the debugger thread, that executes no v8 calls except
4847 // placing JSON debugger commands in the queue. 4847 // placing JSON debugger commands in the queue.
4848 class MessageQueueDebuggerThread : public v8::base::Thread { 4848 class MessageQueueDebuggerThread : public v8::base::Thread {
4849 public: 4849 public:
4850 MessageQueueDebuggerThread() 4850 MessageQueueDebuggerThread()
4851 : Thread("MessageQueueDebuggerThread") { } 4851 : Thread(Options("MessageQueueDebuggerThread")) {}
4852 void Run(); 4852 void Run();
4853 }; 4853 };
4854 4854
4855 4855
4856 static void MessageHandler(const v8::Debug::Message& message) { 4856 static void MessageHandler(const v8::Debug::Message& message) {
4857 v8::Handle<v8::String> json = message.GetJSON(); 4857 v8::Handle<v8::String> json = message.GetJSON();
4858 v8::String::Utf8Value utf8(json); 4858 v8::String::Utf8Value utf8(json);
4859 if (IsBreakEventMessage(*utf8)) { 4859 if (IsBreakEventMessage(*utf8)) {
4860 // Lets test script wait until break occurs to send commands. 4860 // Lets test script wait until break occurs to send commands.
4861 // Signals when a break is reported. 4861 // Signals when a break is reported.
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
5097 /* This test interrupts a running infinite loop that is 5097 /* This test interrupts a running infinite loop that is
5098 * occupying the v8 thread by a break command from the 5098 * occupying the v8 thread by a break command from the
5099 * debugger thread. It then changes the value of a 5099 * debugger thread. It then changes the value of a
5100 * global object, to make the loop terminate. 5100 * global object, to make the loop terminate.
5101 */ 5101 */
5102 5102
5103 Barriers threaded_debugging_barriers; 5103 Barriers threaded_debugging_barriers;
5104 5104
5105 class V8Thread : public v8::base::Thread { 5105 class V8Thread : public v8::base::Thread {
5106 public: 5106 public:
5107 V8Thread() : Thread("V8Thread") { } 5107 V8Thread() : Thread(Options("V8Thread")) {}
5108 void Run(); 5108 void Run();
5109 }; 5109 };
5110 5110
5111 class DebuggerThread : public v8::base::Thread { 5111 class DebuggerThread : public v8::base::Thread {
5112 public: 5112 public:
5113 DebuggerThread() : Thread("DebuggerThread") { } 5113 DebuggerThread() : Thread(Options("DebuggerThread")) {}
5114 void Run(); 5114 void Run();
5115 }; 5115 };
5116 5116
5117 5117
5118 static void ThreadedAtBarrier1( 5118 static void ThreadedAtBarrier1(
5119 const v8::FunctionCallbackInfo<v8::Value>& args) { 5119 const v8::FunctionCallbackInfo<v8::Value>& args) {
5120 threaded_debugging_barriers.barrier_1.Wait(); 5120 threaded_debugging_barriers.barrier_1.Wait();
5121 } 5121 }
5122 5122
5123 5123
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
5209 5209
5210 /* Test RecursiveBreakpoints */ 5210 /* Test RecursiveBreakpoints */
5211 /* In this test, the debugger evaluates a function with a breakpoint, after 5211 /* In this test, the debugger evaluates a function with a breakpoint, after
5212 * hitting a breakpoint in another function. We do this with both values 5212 * hitting a breakpoint in another function. We do this with both values
5213 * of the flag enabling recursive breakpoints, and verify that the second 5213 * of the flag enabling recursive breakpoints, and verify that the second
5214 * breakpoint is hit when enabled, and missed when disabled. 5214 * breakpoint is hit when enabled, and missed when disabled.
5215 */ 5215 */
5216 5216
5217 class BreakpointsV8Thread : public v8::base::Thread { 5217 class BreakpointsV8Thread : public v8::base::Thread {
5218 public: 5218 public:
5219 BreakpointsV8Thread() : Thread("BreakpointsV8Thread") { } 5219 BreakpointsV8Thread() : Thread(Options("BreakpointsV8Thread")) {}
5220 void Run(); 5220 void Run();
5221 }; 5221 };
5222 5222
5223 class BreakpointsDebuggerThread : public v8::base::Thread { 5223 class BreakpointsDebuggerThread : public v8::base::Thread {
5224 public: 5224 public:
5225 explicit BreakpointsDebuggerThread(bool global_evaluate) 5225 explicit BreakpointsDebuggerThread(bool global_evaluate)
5226 : Thread("BreakpointsDebuggerThread"), 5226 : Thread(Options("BreakpointsDebuggerThread")),
5227 global_evaluate_(global_evaluate) {} 5227 global_evaluate_(global_evaluate) {}
5228 void Run(); 5228 void Run();
5229 5229
5230 private: 5230 private:
5231 bool global_evaluate_; 5231 bool global_evaluate_;
5232 }; 5232 };
5233 5233
5234 5234
5235 Barriers* breakpoints_barriers; 5235 Barriers* breakpoints_barriers;
5236 int break_event_breakpoint_id; 5236 int break_event_breakpoint_id;
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
6518 6518
6519 // Get rid of the debug message handler. 6519 // Get rid of the debug message handler.
6520 v8::Debug::SetMessageHandler(NULL); 6520 v8::Debug::SetMessageHandler(NULL);
6521 CheckDebuggerUnloaded(); 6521 CheckDebuggerUnloaded();
6522 } 6522 }
6523 6523
6524 6524
6525 class SendCommandThread : public v8::base::Thread { 6525 class SendCommandThread : public v8::base::Thread {
6526 public: 6526 public:
6527 explicit SendCommandThread(v8::Isolate* isolate) 6527 explicit SendCommandThread(v8::Isolate* isolate)
6528 : Thread("SendCommandThread"), 6528 : Thread(Options("SendCommandThread")),
6529 semaphore_(0), 6529 semaphore_(0),
6530 isolate_(isolate) { } 6530 isolate_(isolate) {}
6531 6531
6532 static void ProcessDebugMessages(v8::Isolate* isolate, void* data) { 6532 static void ProcessDebugMessages(v8::Isolate* isolate, void* data) {
6533 v8::Debug::ProcessDebugMessages(); 6533 v8::Debug::ProcessDebugMessages();
6534 reinterpret_cast<v8::base::Semaphore*>(data)->Signal(); 6534 reinterpret_cast<v8::base::Semaphore*>(data)->Signal();
6535 } 6535 }
6536 6536
6537 virtual void Run() { 6537 virtual void Run() {
6538 semaphore_.Wait(); 6538 semaphore_.Wait();
6539 const int kBufferSize = 1000; 6539 const int kBufferSize = 1000;
6540 uint16_t buffer[kBufferSize]; 6540 uint16_t buffer[kBufferSize];
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
7372 if (event_details.GetEvent() != v8::Break || terminate_already_fired) return; 7372 if (event_details.GetEvent() != v8::Break || terminate_already_fired) return;
7373 terminate_requested_semaphore.Signal(); 7373 terminate_requested_semaphore.Signal();
7374 // Wait for at most 2 seconds for the terminate request. 7374 // Wait for at most 2 seconds for the terminate request.
7375 CHECK(terminate_fired_semaphore.WaitFor(v8::base::TimeDelta::FromSeconds(2))); 7375 CHECK(terminate_fired_semaphore.WaitFor(v8::base::TimeDelta::FromSeconds(2)));
7376 terminate_already_fired = true; 7376 terminate_already_fired = true;
7377 } 7377 }
7378 7378
7379 7379
7380 class TerminationThread : public v8::base::Thread { 7380 class TerminationThread : public v8::base::Thread {
7381 public: 7381 public:
7382 explicit TerminationThread(v8::Isolate* isolate) : Thread("terminator"), 7382 explicit TerminationThread(v8::Isolate* isolate)
7383 isolate_(isolate) { } 7383 : Thread(Options("terminator")), isolate_(isolate) {}
7384 7384
7385 virtual void Run() { 7385 virtual void Run() {
7386 terminate_requested_semaphore.Wait(); 7386 terminate_requested_semaphore.Wait();
7387 v8::V8::TerminateExecution(isolate_); 7387 v8::V8::TerminateExecution(isolate_);
7388 terminate_fired_semaphore.Signal(); 7388 terminate_fired_semaphore.Signal();
7389 } 7389 }
7390 7390
7391 private: 7391 private:
7392 v8::Isolate* isolate_; 7392 v8::Isolate* isolate_;
7393 }; 7393 };
7394 7394
7395 7395
7396 TEST(DebugBreakOffThreadTerminate) { 7396 TEST(DebugBreakOffThreadTerminate) {
7397 DebugLocalContext env; 7397 DebugLocalContext env;
7398 v8::Isolate* isolate = env->GetIsolate(); 7398 v8::Isolate* isolate = env->GetIsolate();
7399 v8::HandleScope scope(isolate); 7399 v8::HandleScope scope(isolate);
7400 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); 7400 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate);
7401 TerminationThread terminator(isolate); 7401 TerminationThread terminator(isolate);
7402 terminator.Start(); 7402 terminator.Start();
7403 v8::TryCatch try_catch; 7403 v8::TryCatch try_catch;
7404 v8::Debug::DebugBreak(isolate); 7404 v8::Debug::DebugBreak(isolate);
7405 CompileRun("while (true);"); 7405 CompileRun("while (true);");
7406 CHECK(try_catch.HasTerminated()); 7406 CHECK(try_catch.HasTerminated());
7407 } 7407 }
OLDNEW
« no previous file with comments | « test/cctest/test-circular-queue.cc ('k') | test/cctest/test-declarative-accessors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698