本文整理汇总了C++中LLDBCommand::GetEnvArray方法的典型用法代码示例。如果您正苦于以下问题:C++ LLDBCommand::GetEnvArray方法的具体用法?C++ LLDBCommand::GetEnvArray怎么用?C++ LLDBCommand::GetEnvArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLDBCommand
的用法示例。
在下文中一共展示了LLDBCommand::GetEnvArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunDebugger
void CodeLiteLLDBApp::RunDebugger(const LLDBCommand& command)
{
if(m_debuggeePid != wxNOT_FOUND) {
wxPrintf("codelite-lldb: another session is already in progress\n");
return;
}
if(m_debugger.IsValid()) {
m_variables.clear();
m_watches.clear();
// Construct char** arrays
clCommandLineParser parser(command.GetCommandArguments());
const char** argv = (const char**)_wxArrayStringToCharPtrPtr(parser.ToArray());
char** penv = command.GetEnvArray();
std::string tty_c;
std::string workingDirectory;
if(!command.GetRedirectTTY().IsEmpty()) {
tty_c = command.GetRedirectTTY().mb_str(wxConvUTF8).data();
}
if(!command.GetWorkingDirectory().IsEmpty()) {
workingDirectory = command.GetWorkingDirectory().mb_str(wxConvUTF8).data();
}
const char* ptty = tty_c.empty() ? NULL : tty_c.c_str();
wxPrintf("codelite-lldb: running debugger. tty=%s\n", ptty);
const char* pwd = workingDirectory.empty() ? NULL : workingDirectory.c_str();
wxPrintf("codelite-lldb: target working directory is set to: %s\n", pwd ? pwd : "NULL");
// wxPrintf("codelite-lldb: Environment is set to:\n");
// print_c_array( (const char**)penv );
wxPrintf("codelite-lldb: Arguments are set to:\n");
print_c_array(argv);
// Execute startup commands
wxArrayString startupCommands = ::wxStringTokenize(command.GetStartupCommands(), "\n", wxTOKEN_STRTOK);
for(size_t i = 0; i < startupCommands.GetCount(); ++i) {
lldb::SBCommandReturnObject ret;
std::string c_command = startupCommands.Item(i).Trim().mb_str(wxConvUTF8).data();
wxPrintf("codelite-lldb: executing: '%s'\n", c_command.c_str());
m_debugger.GetCommandInterpreter().HandleCommand(c_command.c_str(), ret);
}
lldb::SBError lldbError;
lldb::SBListener listener = m_debugger.GetListener();
lldb::SBProcess process =
m_target.Launch(listener,
argv,
(const char**)penv,
ptty,
ptty,
ptty,
pwd,
lldb::eLaunchFlagLaunchInSeparateProcessGroup | lldb::eLaunchFlagStopAtEntry,
true,
lldbError);
// bool isOk = m_target.LaunchSimple(argv, envp, wd).IsValid();
DELETE_CHAR_PTR_PTR(const_cast<char**>(argv));
DELETE_CHAR_PTR_PTR(penv);
if(!process.IsValid() || !lldbError.Success()) {
wxPrintf("codelite-lldb: error while launching process. %s\n", lldbError.GetCString());
NotifyExited();
} else {
m_debuggeePid = process.GetProcessID();
NotifyRunning();
}
}
}