本文整理汇总了C++中ArchSpec::AsCString方法的典型用法代码示例。如果您正苦于以下问题:C++ ArchSpec::AsCString方法的具体用法?C++ ArchSpec::AsCString怎么用?C++ ArchSpec::AsCString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArchSpec
的用法示例。
在下文中一共展示了ArchSpec::AsCString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scoped_timer
bool
CommandObjectFile::Execute
(
CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result
)
{
const char *file_path = command.GetArgumentAtIndex(0);
Timer scoped_timer(__PRETTY_FUNCTION__, "(dbg) file '%s'", file_path);
const int argc = command.GetArgumentCount();
if (argc == 1)
{
FileSpec file_spec (file_path);
if (! file_spec.Exists())
{
result.AppendErrorWithFormat ("File '%s' does not exist.\n", file_path);
result.SetStatus (eReturnStatusFailed);
return result.Succeeded();
}
TargetSP target_sp;
ArchSpec arch;
if (m_options.m_arch.IsValid())
arch = m_options.m_arch;
else
{
arch = lldb_private::GetDefaultArchitecture ();
if (!arch.IsValid())
arch = LLDB_ARCH_DEFAULT;
}
Debugger &debugger = interpreter.GetDebugger();
Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, arch, NULL, true, target_sp);
if (error.Fail() && !m_options.m_arch.IsValid())
{
if (arch == LLDB_ARCH_DEFAULT_32BIT)
arch = LLDB_ARCH_DEFAULT_64BIT;
else
arch = LLDB_ARCH_DEFAULT_32BIT;
error = debugger.GetTargetList().CreateTarget (debugger, file_spec, arch, NULL, true, target_sp);
}
if (target_sp)
{
debugger.GetTargetList().SetCurrentTarget(target_sp.get());
result.AppendMessageWithFormat ("Current executable set to '%s' (%s).\n", file_path, arch.AsCString());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
{
result.AppendError(error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
}
else
{
result.AppendErrorWithFormat("'%s' takes exactly one executable path argument.\n", m_cmd_name.c_str());
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
}
示例2: scoped_timer
Error
TargetList::CreateTarget
(
Debugger &debugger,
const FileSpec& file,
const ArchSpec& arch,
const UUID *uuid_ptr,
bool get_dependent_files,
TargetSP &target_sp
)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
"TargetList::CreateTarget (file = '%s/%s', arch = '%s', uuid = %p)",
file.GetDirectory().AsCString(),
file.GetFilename().AsCString(),
arch.AsCString(),
uuid_ptr);
ModuleSP exe_module_sp;
FileSpec resolved_file(file);
if (!Host::ResolveExecutableInBundle (&resolved_file))
resolved_file = file;
Error error = ModuleList::GetSharedModule(resolved_file,
arch,
uuid_ptr,
NULL,
0,
exe_module_sp,
NULL,
NULL);
if (exe_module_sp)
{
target_sp.reset(new Target(debugger));
target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
if (target_sp.get())
{
Mutex::Locker locker(m_target_list_mutex);
m_current_target_idx = m_target_list.size();
m_target_list.push_back(target_sp);
}
// target_sp.reset(new Target);
// // Let the target resolve any funky bundle paths before we try and get
// // the object file...
// target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
// if (exe_module_sp->GetObjectFile() == NULL)
// {
// error.SetErrorStringWithFormat("%s%s%s: doesn't contain architecture %s",
// file.GetDirectory().AsCString(),
// file.GetDirectory() ? "/" : "",
// file.GetFilename().AsCString(),
// arch.AsCString());
// }
// else
// {
// if (target_sp.get())
// {
// error.Clear();
// Mutex::Locker locker(m_target_list_mutex);
// m_current_target_idx = m_target_list.size();
// m_target_list.push_back(target_sp);
// }
// }
}
else
{
target_sp.reset();
}
return error;
}