| OLD | NEW |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 #include <conio.h> | 4 #include <conio.h> |
| 5 #include "debugger/base/debug_command_line.h" | 5 #include "debugger/base/debug_command_line.h" |
| 6 #include "debugger/core/debug_logger.h" | 6 #include "debugger/core/debug_logger.h" |
| 7 #include "debugger/nacl-gdb_server/debug_server.h" | 7 #include "debugger/nacl-gdb_server/debug_server.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 const int kErrNoProgramSpecified = 1; | 10 const int kErrNoProgramSpecified = 1; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 DBG_LOG("ERR101.03", | 90 DBG_LOG("ERR101.03", |
| 91 "msg='gdb_server.StartProcess failed' 'cmd=[%s]' err='%s'", | 91 "msg='gdb_server.StartProcess failed' 'cmd=[%s]' err='%s'", |
| 92 cmd.c_str(), | 92 cmd.c_str(), |
| 93 sys_err.c_str()); | 93 sys_err.c_str()); |
| 94 printf("StartProcess failed cmd='[%s]' err='%s'", | 94 printf("StartProcess failed cmd='[%s]' err='%s'", |
| 95 cmd.c_str(), | 95 cmd.c_str(), |
| 96 sys_err.c_str()); | 96 sys_err.c_str()); |
| 97 return kErrStartProcessFailed; | 97 return kErrStartProcessFailed; |
| 98 } | 98 } |
| 99 | 99 |
| 100 DBG_LOG("TR101.04", "msg='Debug server started' port=%d cmd='%s'", port, cmd); | 100 DBG_LOG("TR101.04", "msg='Debug server started' port=%d cmd='%s'", |
| 101 port, |
| 102 cmd.c_str()); |
| 101 while (true) { | 103 while (true) { |
| 102 if (_kbhit()) { | 104 if (_kbhit()) { |
| 103 char cmd[200] = {0}; | 105 char cmd[200] = {0}; |
| 104 gets_s(cmd, sizeof(cmd)); | 106 gets_s(cmd, sizeof(cmd)); |
| 105 cmd[sizeof(cmd) - 1] = 0; | 107 cmd[sizeof(cmd) - 1] = 0; |
| 106 DBG_LOG("TR101.05", "user_command='%s'", cmd); | 108 DBG_LOG("TR101.05", "user_command='%s'", cmd); |
| 107 if (0 == strcmp(cmd, "quit")) { | 109 if (0 == strcmp(cmd, "quit")) { |
| 108 debug_server.Quit(); | 110 debug_server.Quit(); |
| 109 break; | 111 break; |
| 110 } | 112 } |
| 111 } | 113 } |
| 112 debug_server.DoWork(kWaitForDebugEventMilliseconds); | 114 debug_server.DoWork(kWaitForDebugEventMilliseconds); |
| 113 if (debug_server.ProcessExited()) { | 115 if (debug_server.ProcessExited()) { |
| 114 printf("Exit?"); | 116 printf("Exit?"); |
| 115 getchar(); | 117 getchar(); |
| 116 break; | 118 break; |
| 117 } | 119 } |
| 118 } | 120 } |
| 119 DBG_LOG("TR101.06", "msg='Debugger stopped'"); | 121 DBG_LOG("TR101.06", "msg='Debugger stopped'"); |
| 120 return 0; | 122 return 0; |
| 121 } | 123 } |
| 122 | 124 |
| OLD | NEW |