本文整理汇总了C++中TargetSP类的典型用法代码示例。如果您正苦于以下问题:C++ TargetSP类的具体用法?C++ TargetSP怎么用?C++ TargetSP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TargetSP类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: strtol
ValueObjectSP
GoUserExpression::GoInterpreter::VisitBasicLit(const lldb_private::GoASTBasicLit *e)
{
std::string value = e->GetValue().m_value.str();
if (e->GetValue().m_type != GoLexer::LIT_INTEGER)
{
m_error.SetErrorStringWithFormat("Unsupported literal %s", value.c_str());
return nullptr;
}
errno = 0;
int64_t intvalue = strtol(value.c_str(), nullptr, 0);
if (errno != 0)
{
m_error.SetErrorToErrno();
return nullptr;
}
DataBufferSP buf(new DataBufferHeap(sizeof(intvalue), 0));
TargetSP target = m_exe_ctx.GetTargetSP();
if (!target)
{
m_error.SetErrorString("No target");
return nullptr;
}
ByteOrder order = target->GetArchitecture().GetByteOrder();
uint8_t addr_size = target->GetArchitecture().GetAddressByteSize();
DataEncoder enc(buf, order, addr_size);
enc.PutU64(0, static_cast<uint64_t>(intvalue));
DataExtractor data(buf, order, addr_size);
CompilerType type = LookupType(target, ConstString("int64"));
return ValueObject::CreateValueObjectFromData(nullptr, data, m_exe_ctx, type);
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:32,代码来源:GoUserExpression.cpp
示例2: switch
bool
ProcessKDP::CanDebug(TargetSP target_sp, bool plugin_specified_by_name)
{
if (plugin_specified_by_name)
return true;
// For now we are just making sure the file exists for a given module
Module *exe_module = target_sp->GetExecutableModulePointer();
if (exe_module)
{
const llvm::Triple &triple_ref = target_sp->GetArchitecture().GetTriple();
switch (triple_ref.getOS())
{
case llvm::Triple::Darwin: // Should use "macosx" for desktop and "ios" for iOS, but accept darwin just in case
case llvm::Triple::MacOSX: // For desktop targets
case llvm::Triple::IOS: // For arm targets
if (triple_ref.getVendor() == llvm::Triple::Apple)
{
ObjectFile *exe_objfile = exe_module->GetObjectFile();
if (exe_objfile->GetType() == ObjectFile::eTypeExecutable &&
exe_objfile->GetStrata() == ObjectFile::eStrataKernel)
return true;
}
break;
default:
break;
}
}
return false;
}
开发者ID:k06a,项目名称:lldb,代码行数:31,代码来源:ProcessKDP.cpp
示例3: const_typename
TypeSP
OperatingSystemGo::FindType(TargetSP target_sp, const char *name)
{
ConstString const_typename(name);
SymbolContext sc;
const bool exact_match = false;
const ModuleList &module_list = target_sp->GetImages();
size_t count = module_list.GetSize();
for (size_t idx = 0; idx < count; idx++)
{
ModuleSP module_sp(module_list.GetModuleAtIndex(idx));
if (module_sp)
{
TypeSP type_sp(module_sp->FindFirstType(sc, const_typename, exact_match));
if (type_sp)
return type_sp;
}
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS));
if (log)
log->Printf("OperatingSystemGo::FindType(%s): not found", name);
return TypeSP();
}
开发者ID:2asoft,项目名称:freebsd,代码行数:25,代码来源:OperatingSystemGo.cpp
示例4: GetLLDBNSPairType
static ClangASTType
GetLLDBNSPairType (TargetSP target_sp)
{
ClangASTType clang_type;
ClangASTContext *target_ast_context = target_sp->GetScratchClangASTContext();
if (target_ast_context)
{
ConstString g___lldb_autogen_nspair("__lldb_autogen_nspair");
clang_type = target_ast_context->GetTypeForIdentifier<clang::CXXRecordDecl>(g___lldb_autogen_nspair);
if (!clang_type)
{
clang_type = target_ast_context->CreateRecordType(NULL, lldb::eAccessPublic, g___lldb_autogen_nspair.GetCString(), clang::TTK_Struct, lldb::eLanguageTypeC);
if (clang_type)
{
clang_type.StartTagDeclarationDefinition();
ClangASTType id_clang_type = target_ast_context->GetBasicType (eBasicTypeObjCID);
clang_type.AddFieldToRecordType("key", id_clang_type, lldb::eAccessPublic, 0);
clang_type.AddFieldToRecordType("value", id_clang_type, lldb::eAccessPublic, 0);
clang_type.CompleteTagDeclarationDefinition();
}
}
}
return clang_type;
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:29,代码来源:NSDictionary.cpp
示例5: WINLOG_IFALL
void
ProcessWindowsLive::OnExitProcess(uint32_t exit_code)
{
// No need to acquire the lock since m_session_data isn't accessed.
WINLOG_IFALL(WINDOWS_LOG_PROCESS, "Process %u exited with code %u", GetID(), exit_code);
TargetSP target = m_target_sp.lock();
if (target)
{
ModuleSP executable_module = target->GetExecutableModule();
ModuleList unloaded_modules;
unloaded_modules.Append(executable_module);
target->ModulesDidUnload(unloaded_modules, true);
}
SetProcessExitStatus(nullptr, GetID(), true, 0, exit_code);
SetPrivateState(eStateExited);
}
开发者ID:ATeamMac2014,项目名称:lldb,代码行数:18,代码来源:ProcessWindowsLive.cpp
示例6:
//----------------------------------------------------------------------
// SourceManager constructor
//----------------------------------------------------------------------
SourceManager::SourceManager(const TargetSP &target_sp) :
m_last_file_sp (),
m_last_line (0),
m_last_count (0),
m_default_set(false),
m_target_wp (target_sp),
m_debugger_wp(target_sp->GetDebugger().shared_from_this())
{
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:12,代码来源:SourceManager.cpp
示例7: arch
lldb::TargetSP
Host::GetDummyTarget (lldb_private::Debugger &debugger)
{
static TargetSP g_dummy_target_sp;
// FIXME: Maybe the dummy target should be per-Debugger
if (!g_dummy_target_sp || !g_dummy_target_sp->IsValid())
{
ArchSpec arch(Target::GetDefaultArchitecture());
if (!arch.IsValid())
arch = HostInfo::GetArchitecture();
Error err = debugger.GetTargetList().CreateTarget(debugger,
NULL,
arch.GetTriple().getTriple().c_str(),
false,
NULL,
g_dummy_target_sp);
}
return g_dummy_target_sp;
}
开发者ID:chee-z,项目名称:lldb,代码行数:21,代码来源:Host.cpp
示例8: LookupType
CompilerType LookupType(TargetSP target, ConstString name) {
if (!target)
return CompilerType();
SymbolContext sc;
TypeList type_list;
llvm::DenseSet<SymbolFile *> searched_symbol_files;
uint32_t num_matches = target->GetImages().FindTypes(
sc, name, false, 2, searched_symbol_files, type_list);
if (num_matches > 0) {
return type_list.GetTypeAtIndex(0)->GetFullCompilerType();
}
return CompilerType();
}
开发者ID:krytarowski,项目名称:lldb,代码行数:13,代码来源:GoUserExpression.cpp
示例9: FindPlugin
DisassemblerSP
Disassembler::FindPluginForTarget(const TargetSP target_sp, const ArchSpec &arch, const char *flavor, const char *plugin_name)
{
if (target_sp && flavor == NULL)
{
// FIXME - we don't have the mechanism in place to do per-architecture settings. But since we know that for now
// we only support flavors on x86 & x86_64,
if (arch.GetTriple().getArch() == llvm::Triple::x86
|| arch.GetTriple().getArch() == llvm::Triple::x86_64)
flavor = target_sp->GetDisassemblyFlavor();
}
return FindPlugin(arch, flavor, plugin_name);
}
开发者ID:CODECOMMUNITY,项目名称:lldb,代码行数:13,代码来源:Disassembler.cpp
示例10: GetLLDBNSPairType
static ClangASTType
GetLLDBNSPairType (TargetSP target_sp)
{
ClangASTType clang_type;
ClangASTContext *target_ast_context = target_sp->GetScratchClangASTContext();
if (target_ast_context)
{
clang::ASTContext *ast = target_ast_context->getASTContext();
if (ast)
{
const char* type_name = "__lldb_autogen_nspair";
clang::IdentifierInfo &myIdent = ast->Idents.get(type_name);
clang::DeclarationName myName = ast->DeclarationNames.getIdentifier(&myIdent);
clang::DeclContext::lookup_const_result result = ast->getTranslationUnitDecl()->lookup(myName);
for (clang::NamedDecl *named_decl : result)
{
if (const clang::CXXRecordDecl *record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(named_decl))
{
clang_type.SetClangType(ast, clang::QualType(record_decl->getTypeForDecl(), 0));
break;
}
else
{
// somebody else (the user?) has defined a type with the magic name already - fail!!!
return clang_type;
}
}
if (!clang_type)
{
clang_type = target_ast_context->CreateRecordType(NULL, lldb::eAccessPublic, type_name, clang::TTK_Struct, lldb::eLanguageTypeC);
if (clang_type)
{
clang_type.StartTagDeclarationDefinition();
ClangASTType id_clang_type = target_ast_context->GetBasicType (eBasicTypeObjCID);
clang_type.AddFieldToRecordType("key", id_clang_type, lldb::eAccessPublic, 0);
clang_type.AddFieldToRecordType("value", id_clang_type, lldb::eAccessPublic, 0);
clang_type.CompleteTagDeclarationDefinition();
}
}
}
}
return clang_type;
}
开发者ID:AAZemlyanukhin,项目名称:freebsd,代码行数:51,代码来源:NSDictionary.cpp
示例11: FindGlobalVariable
VariableSP FindGlobalVariable(TargetSP target, llvm::Twine name) {
ConstString fullname(name.str());
VariableList variable_list;
const bool append = true;
if (!target) {
return nullptr;
}
const uint32_t match_count = target->GetImages().FindGlobalVariables(
fullname, append, 1, variable_list);
if (match_count == 1) {
return variable_list.GetVariableAtIndex(0);
}
return nullptr;
}
开发者ID:krytarowski,项目名称:lldb,代码行数:14,代码来源:GoUserExpression.cpp
示例12: Create
ValueObjectSP
OperatingSystemGo::FindGlobal(TargetSP target, const char *name)
{
VariableList variable_list;
const bool append = true;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS));
if (log)
{
log->Printf("exe: %s", target->GetExecutableModule()->GetSpecificationDescription().c_str());
log->Printf("modules: %zu", target->GetImages().GetSize());
}
uint32_t match_count = target->GetImages().FindGlobalVariables(ConstString(name), append, 1, variable_list);
if (match_count > 0)
{
ExecutionContextScope *exe_scope = target->GetProcessSP().get();
if (exe_scope == NULL)
exe_scope = target.get();
return ValueObjectVariable::Create(exe_scope, variable_list.GetVariableAtIndex(0));
}
return ValueObjectSP();
}
开发者ID:2asoft,项目名称:freebsd,代码行数:24,代码来源:OperatingSystemGo.cpp
示例13: locker
bool
TargetList::DeleteTarget (TargetSP &target_sp)
{
Mutex::Locker locker(m_target_list_mutex);
collection::iterator pos, end = m_target_list.end();
for (pos = m_target_list.begin(); pos != end; ++pos)
{
if (pos->get() == target_sp.get())
{
m_target_list.erase(pos);
return true;
}
}
return false;
}
开发者ID:ksarada,项目名称:NyuziToolchain,代码行数:16,代码来源:TargetList.cpp
示例14: 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;
}
开发者ID:ztianjin,项目名称:lldb,代码行数:96,代码来源:TargetList.cpp
示例15: arch
Error
TargetList::CreateTarget (Debugger &debugger,
const FileSpec& file,
const char *triple_cstr,
bool get_dependent_files,
const OptionGroupPlatform *platform_options,
TargetSP &target_sp)
{
Error error;
PlatformSP platform_sp;
// This is purposely left empty unless it is specified by triple_cstr.
// If not initialized via triple_cstr, then the currently selected platform
// will set the architecture correctly.
const ArchSpec arch(triple_cstr);
if (triple_cstr && triple_cstr[0])
{
if (!arch.IsValid())
{
error.SetErrorStringWithFormat("invalid triple '%s'", triple_cstr);
return error;
}
}
ArchSpec platform_arch(arch);
CommandInterpreter &interpreter = debugger.GetCommandInterpreter();
if (platform_options)
{
if (platform_options->PlatformWasSpecified ())
{
const bool select_platform = true;
platform_sp = platform_options->CreatePlatformWithOptions (interpreter,
arch,
select_platform,
error,
platform_arch);
if (!platform_sp)
return error;
}
}
if (!platform_sp)
{
// Get the current platform and make sure it is compatible with the
// current architecture if we have a valid architecture.
platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
if (arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, &platform_arch))
{
platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
}
}
if (!platform_arch.IsValid())
platform_arch = arch;
error = TargetList::CreateTarget (debugger,
file,
platform_arch,
get_dependent_files,
platform_sp,
target_sp);
if (target_sp)
{
if (file.GetDirectory())
{
FileSpec file_dir;
file_dir.GetDirectory() = file.GetDirectory();
target_sp->GetExecutableSearchPaths ().Append (file_dir);
}
}
return error;
}
开发者ID:ztianjin,项目名称:lldb,代码行数:74,代码来源:TargetList.cpp
示例16: scoped_timer
Error
TargetList::CreateTarget (Debugger &debugger,
const char *user_exe_path,
const ArchSpec& specified_arch,
bool get_dependent_files,
PlatformSP &platform_sp,
TargetSP &target_sp)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
"TargetList::CreateTarget (file = '%s', arch = '%s')",
user_exe_path,
specified_arch.GetArchitectureName());
Error error;
ArchSpec arch(specified_arch);
if (platform_sp)
{
if (arch.IsValid())
{
if (!platform_sp->IsCompatibleArchitecture(arch, false, NULL))
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;
FileSpec file (user_exe_path, false);
if (!file.Exists() && user_exe_path && user_exe_path[0] == '~')
{
// we want to expand the tilde but we don't want to resolve any symbolic links
// so we can't use the FileSpec constructor's resolve flag
llvm::SmallString<64> unglobbed_path(user_exe_path);
FileSpec::ResolveUsername(unglobbed_path);
if (unglobbed_path.empty())
file = FileSpec(user_exe_path, false);
else
file = FileSpec(unglobbed_path.c_str(), false);
}
bool user_exe_path_is_bundle = false;
char resolved_bundle_exe_path[PATH_MAX];
resolved_bundle_exe_path[0] = '\0';
if (file)
{
if (file.GetFileType() == FileSpec::eFileTypeDirectory)
user_exe_path_is_bundle = true;
if (file.IsRelativeToCurrentWorkingDirectory())
{
// Ignore paths that start with "./" and "../"
if (!((user_exe_path[0] == '.' && user_exe_path[1] == '/') ||
(user_exe_path[0] == '.' && user_exe_path[1] == '.' && user_exe_path[2] == '/')))
{
char cwd[PATH_MAX];
if (getcwd (cwd, sizeof(cwd)))
{
std::string cwd_user_exe_path (cwd);
cwd_user_exe_path += '/';
cwd_user_exe_path += user_exe_path;
FileSpec cwd_file (cwd_user_exe_path.c_str(), false);
if (cwd_file.Exists())
file = cwd_file;
}
}
}
ModuleSP exe_module_sp;
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\" doesn't contain architecture %s",
file.GetPath().c_str(),
arch.GetArchitectureName());
}
else
{
error.SetErrorStringWithFormat("unsupported file type \"%s\"",
file.GetPath().c_str());
//.........这里部分代码省略.........
开发者ID:zturner0826,项目名称:lldb,代码行数:101,代码来源:TargetList.cpp
示例17: 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;
}
开发者ID:ice799,项目名称:lldb,代码行数:72,代码来源:TargetList.cpp
注:本文中的TargetSP类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论