OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (text_str.length() > 0) { | 152 if (text_str.length() > 0) { |
153 printf("%s\n", *text_str); | 153 printf("%s\n", *text_str); |
154 } | 154 } |
155 running = | 155 running = |
156 response_details->Get(String::New("running"))->ToBoolean()->Value(); | 156 response_details->Get(String::New("running"))->ToBoolean()->Value(); |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 void RunRemoteDebugger(int port) { | 161 void RunRemoteDebugger(int port) { |
162 RemoteDebugger debugger(port); | 162 RemoteDebugger debugger(i::Isolate::Current(), port); |
163 debugger.Run(); | 163 debugger.Run(); |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 void RemoteDebugger::Run() { | 167 void RemoteDebugger::Run() { |
168 bool ok; | 168 bool ok; |
169 | 169 |
170 // Make sure that socket support is initialized. | 170 // Make sure that socket support is initialized. |
171 ok = i::Socket::Setup(); | 171 ok = i::Socket::Setup(); |
172 if (!ok) { | 172 if (!ok) { |
173 printf("Unable to initialize socket support %d\n", i::Socket::LastError()); | 173 printf("Unable to initialize socket support %d\n", i::Socket::LastError()); |
174 return; | 174 return; |
175 } | 175 } |
176 | 176 |
177 // Connect to the debugger agent. | 177 // Connect to the debugger agent. |
178 conn_ = i::OS::CreateSocket(); | 178 conn_ = i::OS::CreateSocket(); |
179 static const int kPortStrSize = 6; | 179 static const int kPortStrSize = 6; |
180 char port_str[kPortStrSize]; | 180 char port_str[kPortStrSize]; |
181 i::OS::SNPrintF(i::Vector<char>(port_str, kPortStrSize), "%d", port_); | 181 i::OS::SNPrintF(i::Vector<char>(port_str, kPortStrSize), "%d", port_); |
182 ok = conn_->Connect("localhost", port_str); | 182 ok = conn_->Connect("localhost", port_str); |
183 if (!ok) { | 183 if (!ok) { |
184 printf("Unable to connect to debug agent %d\n", i::Socket::LastError()); | 184 printf("Unable to connect to debug agent %d\n", i::Socket::LastError()); |
185 return; | 185 return; |
186 } | 186 } |
187 | 187 |
188 // Start the receiver thread. | 188 // Start the receiver thread. |
189 ReceiverThread receiver(this); | 189 ReceiverThread receiver(isolate_, this); |
190 receiver.Start(); | 190 receiver.Start(); |
191 | 191 |
192 // Start the keyboard thread. | 192 // Start the keyboard thread. |
193 KeyboardThread keyboard(this); | 193 KeyboardThread keyboard(isolate_, this); |
194 keyboard.Start(); | 194 keyboard.Start(); |
195 PrintPrompt(); | 195 PrintPrompt(); |
196 | 196 |
197 // Process events received from debugged VM and from the keyboard. | 197 // Process events received from debugged VM and from the keyboard. |
198 bool terminate = false; | 198 bool terminate = false; |
199 while (!terminate) { | 199 while (!terminate) { |
200 event_available_->Wait(); | 200 event_available_->Wait(); |
201 RemoteDebuggerEvent* event = GetEvent(); | 201 RemoteDebuggerEvent* event = GetEvent(); |
202 switch (event->type()) { | 202 switch (event->type()) { |
203 case RemoteDebuggerEvent::kMessage: | 203 case RemoteDebuggerEvent::kMessage: |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 358 } |
359 | 359 |
360 // Pass the keyboard command to the main thread. | 360 // Pass the keyboard command to the main thread. |
361 remote_debugger_->KeyboardCommand( | 361 remote_debugger_->KeyboardCommand( |
362 i::SmartPointer<char>(i::StrDup(command))); | 362 i::SmartPointer<char>(i::StrDup(command))); |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 } // namespace v8 | 367 } // namespace v8 |
OLD | NEW |