virtual bool DoExecute (lldb::SBDebugger debugger, char** arguments, lldb::SBCommandReturnObject &result) { if (arguments[0] == NULL) { result.Printf("Load path for sos/dac/dbi: '%s'\n", g_coreclrDirectory == NULL ? "<none>" : g_coreclrDirectory); } else { if (g_coreclrDirectory != NULL) { free(g_coreclrDirectory); } std::string path(arguments[0]); if (path[path.length() - 1] != '/') { path.append("/"); } g_coreclrDirectory = strdup(path.c_str()); result.Printf("Set load path for sos/dac/dbi to '%s'\n", g_coreclrDirectory); } return result.Succeeded(); }
virtual bool DoExecute (lldb::SBDebugger debugger, char** arguments, lldb::SBCommandReturnObject &result) { LLDBServices* services = new LLDBServices(debugger, result); LoadSos(services); if (m_sosHandle) { const char* sosCommand = m_command; if (sosCommand == NULL) { if (arguments == NULL || *arguments == NULL) { sosCommand = "Help"; } else { sosCommand = *arguments++; } } CommandFunc commandFunc = (CommandFunc)dlsym(m_sosHandle, sosCommand); if (commandFunc) { std::string str; if (arguments != NULL) { for (const char* arg = *arguments; arg; arg = *(++arguments)) { str.append(arg); str.append(" "); } } const char* sosArgs = str.c_str(); HRESULT hr = commandFunc(services, sosArgs); if (hr != S_OK) { services->Output(DEBUG_OUTPUT_ERROR, "%s %s failed\n", sosCommand, sosArgs); } } else { services->Output(DEBUG_OUTPUT_ERROR, "SOS command '%s' not found %s\n", sosCommand, dlerror()); } } services->Release(); return result.Succeeded(); }
virtual bool DoExecute (lldb::SBDebugger debugger, char** arguments, lldb::SBCommandReturnObject &result) { if (arguments) { int argc = 0; char **argv = arguments; for (const char* arg = *arguments; arg; arg = *(++arguments)) { ++argc; } int exitcode = corerun((const int)argc, (const char**)argv); if (exitcode != 0) { result.SetError("corerun failed"); } } return result.Succeeded(); }
virtual bool DoExecute(lldb::SBDebugger debugger, char** arguments, lldb::SBCommandReturnObject &result) { if (arguments[0] == NULL) { if (g_currentThreadSystemId == -1 || g_currentThreadIndex == -1) { result.Printf("sos OS tid not mapped\n"); } else { result.Printf("sos OS tid 0x%x mapped to lldb thread index %d\n", g_currentThreadSystemId, g_currentThreadIndex); } } else if (strcmp(arguments[0], "-clear") == 0) { g_currentThreadIndex = -1; g_currentThreadSystemId = -1; result.Printf("Cleared sos OS tid/index\n"); } else if (arguments[1] == NULL) { result.Printf("Need thread index parameter that maps to the OS tid\n"); } else { ULONG tid = strtoul(arguments[0], NULL, 16); g_currentThreadSystemId = tid; ULONG index = strtoul(arguments[1], NULL, 16); g_currentThreadIndex = index; result.Printf("Mapped sos OS tid 0x%x to lldb thread index %d\n", tid, index); } return result.Succeeded(); }