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

Side by Side Diff: src/d8-debug.cc

Issue 23484014: Cleanup Socket class and remove it from the platform files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup leftover junk, and rename test-sockets to test-socket. Created 7 years, 3 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 | « no previous file | src/debug.cc » ('j') | src/platform.h » ('J')
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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifdef ENABLE_DEBUGGER_SUPPORT 28 #ifdef ENABLE_DEBUGGER_SUPPORT
29 29
30 #include "d8.h" 30 #include "d8.h"
31 #include "d8-debug.h" 31 #include "d8-debug.h"
32 #include "debug-agent.h"
32 #include "platform.h" 33 #include "platform.h"
33 #include "debug-agent.h" 34 #include "platform/socket.h"
34 35
35 36
36 namespace v8 { 37 namespace v8 {
37 38
38 static bool was_running = true; 39 static bool was_running = true;
39 40
40 void PrintPrompt(bool is_running) { 41 void PrintPrompt(bool is_running) {
41 const char* prompt = is_running? "> " : "dbg> "; 42 const char* prompt = is_running? "> " : "dbg> ";
42 was_running = is_running; 43 was_running = is_running;
43 printf("%s", prompt); 44 printf("%s", prompt);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 165
165 void RunRemoteDebugger(Isolate* isolate, int port) { 166 void RunRemoteDebugger(Isolate* isolate, int port) {
166 RemoteDebugger debugger(isolate, port); 167 RemoteDebugger debugger(isolate, port);
167 debugger.Run(); 168 debugger.Run();
168 } 169 }
169 170
170 171
171 void RemoteDebugger::Run() { 172 void RemoteDebugger::Run() {
172 bool ok; 173 bool ok;
173 174
174 // Make sure that socket support is initialized.
175 ok = i::Socket::SetUp();
176 if (!ok) {
177 printf("Unable to initialize socket support %d\n", i::Socket::LastError());
178 return;
179 }
180
181 // Connect to the debugger agent. 175 // Connect to the debugger agent.
182 conn_ = i::OS::CreateSocket(); 176 conn_ = new i::Socket;
183 static const int kPortStrSize = 6; 177 static const int kPortStrSize = 6;
184 char port_str[kPortStrSize]; 178 char port_str[kPortStrSize];
185 i::OS::SNPrintF(i::Vector<char>(port_str, kPortStrSize), "%d", port_); 179 i::OS::SNPrintF(i::Vector<char>(port_str, kPortStrSize), "%d", port_);
186 ok = conn_->Connect("localhost", port_str); 180 ok = conn_->Connect("localhost", port_str);
187 if (!ok) { 181 if (!ok) {
188 printf("Unable to connect to debug agent %d\n", i::Socket::LastError()); 182 printf("Unable to connect to debug agent %d\n", i::Socket::GetLastError());
189 return; 183 return;
190 } 184 }
191 185
192 // Start the receiver thread. 186 // Start the receiver thread.
193 ReceiverThread receiver(this); 187 ReceiverThread receiver(this);
194 receiver.Start(); 188 receiver.Start();
195 189
196 // Start the keyboard thread. 190 // Start the keyboard thread.
197 KeyboardThread keyboard(this); 191 KeyboardThread keyboard(this);
198 keyboard.Start(); 192 keyboard.Start();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // Pass the keyboard command to the main thread. 359 // Pass the keyboard command to the main thread.
366 remote_debugger_->KeyboardCommand( 360 remote_debugger_->KeyboardCommand(
367 i::SmartArrayPointer<char>(i::StrDup(command))); 361 i::SmartArrayPointer<char>(i::StrDup(command)));
368 } 362 }
369 } 363 }
370 364
371 365
372 } // namespace v8 366 } // namespace v8
373 367
374 #endif // ENABLE_DEBUGGER_SUPPORT 368 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « no previous file | src/debug.cc » ('j') | src/platform.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698