本文整理汇总了C++中TargetSP::UpdateInstanceName方法的典型用法代码示例。如果您正苦于以下问题:C++ TargetSP::UpdateInstanceName方法的具体用法?C++ TargetSP::UpdateInstanceName怎么用?C++ TargetSP::UpdateInstanceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TargetSP
的用法示例。
在下文中一共展示了TargetSP::UpdateInstanceName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scoped_timer
Error
TargetList::CreateTarget
(
Debugger &debugger,
const FileSpec& file,
const ArchSpec& specified_arch,
bool get_dependent_files,
PlatformSP &platform_sp,
TargetSP &target_sp
)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
"TargetList::CreateTarget (file = '%s/%s', arch = '%s')",
file.GetDirectory().AsCString(),
file.GetFilename().AsCString(),
specified_arch.GetArchitectureName());
Error error;
ArchSpec arch(specified_arch);
if (platform_sp)
{
if (arch.IsValid())
{
if (!platform_sp->IsCompatibleArchitecture(arch))
platform_sp = Platform::GetPlatformForArchitecture(specified_arch, &arch);
}
}
else if (arch.IsValid())
{
platform_sp = Platform::GetPlatformForArchitecture(specified_arch, &arch);
}
if (!platform_sp)
platform_sp = debugger.GetPlatformList().GetSelectedPlatform();
if (!arch.IsValid())
arch = specified_arch;
if (file)
{
ModuleSP exe_module_sp;
FileSpec resolved_file(file);
if (platform_sp)
{
FileSpecList executable_search_paths (Target::GetDefaultExecutableSearchPaths());
error = platform_sp->ResolveExecutable (file,
arch,
exe_module_sp,
executable_search_paths.GetSize() ? &executable_search_paths : NULL);
}
if (error.Success() && exe_module_sp)
{
if (exe_module_sp->GetObjectFile() == NULL)
{
if (arch.IsValid())
{
error.SetErrorStringWithFormat("\"%s%s%s\" doesn't contain architecture %s",
file.GetDirectory().AsCString(),
file.GetDirectory() ? "/" : "",
file.GetFilename().AsCString(),
arch.GetArchitectureName());
}
else
{
error.SetErrorStringWithFormat("unsupported file type \"%s%s%s\"",
file.GetDirectory().AsCString(),
file.GetDirectory() ? "/" : "",
file.GetFilename().AsCString());
}
return error;
}
target_sp.reset(new Target(debugger, arch, platform_sp));
target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
}
}
else
{
// No file was specified, just create an empty target with any arch
// if a valid arch was specified
target_sp.reset(new Target(debugger, arch, platform_sp));
}
if (target_sp)
{
target_sp->UpdateInstanceName();
Mutex::Locker locker(m_target_list_mutex);
m_selected_target_idx = m_target_list.size();
m_target_list.push_back(target_sp);
}
return error;
}