|
|
|
@@ -147,22 +147,8 @@ void Debugger::EnableDebugger() { |
|
|
|
} |
|
|
|
|
|
|
|
if (debugger_enabled_) { |
|
|
|
// configure grpc host |
|
|
|
std::string env_host_str = common::GetEnv("MS_DEBUGGER_HOST"); |
|
|
|
std::string host; |
|
|
|
if (!env_host_str.empty()) { |
|
|
|
if (CheckIp(env_host_str)) { |
|
|
|
MS_LOG(INFO) << "Getenv MS_DEBUGGER_HOST: " << env_host_str; |
|
|
|
host = env_host_str; |
|
|
|
} else { |
|
|
|
debugger_enabled_ = false; |
|
|
|
MS_EXCEPTION(ValueError) << "Environment variable MS_DEBUGGER_HOST isn't a valid IP address. " |
|
|
|
"Please set environment variable MS_DEBUGGER_HOST=x.x.x.x to a valid IP"; |
|
|
|
} |
|
|
|
} else { |
|
|
|
MS_LOG(INFO) << "Environment variable MS_DEBUGGER_HOST doesn't exist. Using default debugger host: localhost"; |
|
|
|
host = "localhost"; |
|
|
|
} |
|
|
|
std::string host = "localhost"; |
|
|
|
|
|
|
|
// configure grpc port |
|
|
|
std::string env_port_str = common::GetEnv("MS_DEBUGGER_PORT"); |
|
|
|
std::string port; |
|
|
|
@@ -1134,17 +1120,6 @@ bool Debugger::CheckPort(const std::string &port) const { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
bool Debugger::CheckIp(const std::string &host) const { |
|
|
|
std::regex reg_ip( |
|
|
|
"(25[0-4]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])" |
|
|
|
"[.](25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])" |
|
|
|
"[.](25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])" |
|
|
|
"[.](25[0-4]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])"); |
|
|
|
std::smatch smat; |
|
|
|
std::string host_str = host; |
|
|
|
return std::regex_match(host_str, smat, reg_ip); |
|
|
|
} |
|
|
|
|
|
|
|
uint32_t Debugger::GetFirstRunGraphId() const { return rungraph_id_list_.front(); } |
|
|
|
|
|
|
|
void Debugger::LoadSingleAnfnode(const AnfNodePtr &anf_node, const size_t output_index) { |
|
|
|
|