OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #include <conio.h> | |
5 #include "debugger/core/debug_logger.h" | |
6 #include "debugger/debug_server/debug_server.h" | |
7 | |
8 int main(int argc, char **argv) { | |
9 debug::TextFileLogger log; | |
10 log.Open("debug_log.txt"); | |
11 // log.EnableStdout(true); | |
12 debug::Logger::SetGlobalLogger(&log); | |
13 | |
14 const char* cmd = "D:\\chromuim_648_12\\src\\build\\Debug\\chrome.exe"; | |
15 //TODO(garianov) accept debugee name from command line | |
16 | |
17 int port = 4014; | |
18 //TODO(garianov) accept port from command line | |
19 | |
20 debug::DebugServer debug_server; | |
21 if (!debug_server.ListenOnPort(port)) { | |
22 DBG_LOG("ERR101.01", "msg='debug_server.ListenOnPort failed' port=%d", port)
; | |
23 return 1; | |
24 } | |
25 | |
26 if (!debug_server.StartProcess(cmd, NULL)) { | |
27 DBG_LOG("ERR101.02", "msg='debug_server.StartProcess failed' cmd='%s'", cmd)
; | |
28 return 2; | |
29 } | |
30 | |
31 DBG_LOG("TR101.03", "msg='Debugger started' port=%d cmd='%s'", port, cmd); | |
32 while (true) { | |
33 if (_kbhit()) { | |
34 char cmd[200] = {0}; | |
35 gets_s(cmd, sizeof(cmd)); | |
36 cmd[sizeof(cmd) - 1] = 0; | |
37 DBG_LOG("TR101.04", "user_command='%s'", cmd); | |
38 if (0 == strcmp(cmd, "quit")) { | |
39 debug_server.Quit(); | |
40 break; | |
41 } | |
42 } | |
43 debug_server.DoWork(20); | |
44 } | |
45 DBG_LOG("TR101.05", "msg='Debugger stopped'"); | |
46 return 0; | |
47 } | |
48 | |
OLD | NEW |