本文整理汇总了C++中structureddata::Dictionary::GetValueForKeyAsString方法的典型用法代码示例。如果您正苦于以下问题:C++ Dictionary::GetValueForKeyAsString方法的具体用法?C++ Dictionary::GetValueForKeyAsString怎么用?C++ Dictionary::GetValueForKeyAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类structureddata::Dictionary
的用法示例。
在下文中一共展示了Dictionary::GetValueForKeyAsString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateThreadFromThreadInfo
ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo(
StructuredData::Dictionary &thread_dict, ThreadList &core_thread_list,
ThreadList &old_thread_list, std::vector<bool> &core_used_map,
bool *did_create_ptr) {
ThreadSP thread_sp;
tid_t tid = LLDB_INVALID_THREAD_ID;
if (!thread_dict.GetValueForKeyAsInteger("tid", tid))
return ThreadSP();
uint32_t core_number;
addr_t reg_data_addr;
llvm::StringRef name;
llvm::StringRef queue;
thread_dict.GetValueForKeyAsInteger("core", core_number, UINT32_MAX);
thread_dict.GetValueForKeyAsInteger("register_data_addr", reg_data_addr,
LLDB_INVALID_ADDRESS);
thread_dict.GetValueForKeyAsString("name", name);
thread_dict.GetValueForKeyAsString("queue", queue);
// See if a thread already exists for "tid"
thread_sp = old_thread_list.FindThreadByID(tid, false);
if (thread_sp) {
// A thread already does exist for "tid", make sure it was an operating
// system
// plug-in generated thread.
if (!IsOperatingSystemPluginThread(thread_sp)) {
// We have thread ID overlap between the protocol threads and the
// operating system threads, clear the thread so we create an operating
// system thread for this.
thread_sp.reset();
}
}
if (!thread_sp) {
if (did_create_ptr)
*did_create_ptr = true;
thread_sp = std::make_shared<ThreadMemory>(*m_process, tid, name, queue,
reg_data_addr);
}
if (core_number < core_thread_list.GetSize(false)) {
ThreadSP core_thread_sp(
core_thread_list.GetThreadAtIndex(core_number, false));
if (core_thread_sp) {
// Keep track of which cores were set as the backing thread for memory
// threads...
if (core_number < core_used_map.size())
core_used_map[core_number] = true;
ThreadSP backing_core_thread_sp(core_thread_sp->GetBackingThread());
if (backing_core_thread_sp) {
thread_sp->SetBackingThread(backing_core_thread_sp);
} else {
thread_sp->SetBackingThread(core_thread_sp);
}
}
}
return thread_sp;
}
示例2: ThreadSpec
std::unique_ptr<ThreadSpec> ThreadSpec::CreateFromStructuredData(
const StructuredData::Dictionary &spec_dict, Status &error) {
uint32_t index = UINT32_MAX;
lldb::tid_t tid = LLDB_INVALID_THREAD_ID;
llvm::StringRef name;
llvm::StringRef queue_name;
std::unique_ptr<ThreadSpec> thread_spec_up(new ThreadSpec());
bool success = spec_dict.GetValueForKeyAsInteger(
GetKey(OptionNames::ThreadIndex), index);
if (success)
thread_spec_up->SetIndex(index);
success =
spec_dict.GetValueForKeyAsInteger(GetKey(OptionNames::ThreadID), tid);
if (success)
thread_spec_up->SetTID(tid);
success =
spec_dict.GetValueForKeyAsString(GetKey(OptionNames::ThreadName), name);
if (success)
thread_spec_up->SetName(name);
success = spec_dict.GetValueForKeyAsString(GetKey(OptionNames::ThreadName),
queue_name);
if (success)
thread_spec_up->SetQueueName(queue_name);
return thread_spec_up;
}
示例3: SendErrorResponse
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerCommon::Handle_jModulesInfo(
StringExtractorGDBRemote &packet) {
packet.SetFilePos(::strlen("jModulesInfo:"));
StructuredData::ObjectSP object_sp = StructuredData::ParseJSON(packet.Peek());
if (!object_sp)
return SendErrorResponse(1);
StructuredData::Array *packet_array = object_sp->GetAsArray();
if (!packet_array)
return SendErrorResponse(2);
JSONArray::SP response_array_sp = std::make_shared<JSONArray>();
for (size_t i = 0; i < packet_array->GetSize(); ++i) {
StructuredData::Dictionary *query =
packet_array->GetItemAtIndex(i)->GetAsDictionary();
if (!query)
continue;
std::string file, triple;
if (!query->GetValueForKeyAsString("file", file) ||
!query->GetValueForKeyAsString("triple", triple))
continue;
ModuleSpec matched_module_spec = GetModuleInfo(file, triple);
if (!matched_module_spec.GetFileSpec())
continue;
const auto file_offset = matched_module_spec.GetObjectOffset();
const auto file_size = matched_module_spec.GetObjectSize();
const auto uuid_str = matched_module_spec.GetUUID().GetAsString("");
if (uuid_str.empty())
continue;
JSONObject::SP response = std::make_shared<JSONObject>();
response_array_sp->AppendObject(response);
response->SetObject("uuid", std::make_shared<JSONString>(uuid_str));
response->SetObject(
"triple",
std::make_shared<JSONString>(
matched_module_spec.GetArchitecture().GetTriple().getTriple()));
response->SetObject("file_path",
std::make_shared<JSONString>(
matched_module_spec.GetFileSpec().GetPath()));
response->SetObject("file_offset",
std::make_shared<JSONNumber>(file_offset));
response->SetObject("file_size", std::make_shared<JSONNumber>(file_size));
}
StreamString response;
response_array_sp->Write(response);
StreamGDBRemote escaped_response;
escaped_response.PutEscapedBytes(response.GetData(), response.GetSize());
return SendPacketNoLock(escaped_response.GetString());
}
示例4: CreateFromStructuredData
SearchFilterSP SearchFilter::CreateFromStructuredData(
Target &target, const StructuredData::Dictionary &filter_dict,
Status &error) {
SearchFilterSP result_sp;
if (!filter_dict.IsValid()) {
error.SetErrorString("Can't deserialize from an invalid data object.");
return result_sp;
}
llvm::StringRef subclass_name;
bool success = filter_dict.GetValueForKeyAsString(
GetSerializationSubclassKey(), subclass_name);
if (!success) {
error.SetErrorStringWithFormat("Filter data missing subclass key");
return result_sp;
}
FilterTy filter_type = NameToFilterTy(subclass_name);
if (filter_type == UnknownFilter) {
error.SetErrorStringWithFormatv("Unknown filter type: {0}.", subclass_name);
return result_sp;
}
StructuredData::Dictionary *subclass_options = nullptr;
success = filter_dict.GetValueForKeyAsDictionary(
GetSerializationSubclassOptionsKey(), subclass_options);
if (!success || !subclass_options || !subclass_options->IsValid()) {
error.SetErrorString("Filter data missing subclass options key.");
return result_sp;
}
switch (filter_type) {
case Unconstrained:
result_sp = SearchFilterForUnconstrainedSearches::CreateFromStructuredData(
target, *subclass_options, error);
break;
case ByModule:
result_sp = SearchFilterByModule::CreateFromStructuredData(
target, *subclass_options, error);
break;
case ByModules:
result_sp = SearchFilterByModuleList::CreateFromStructuredData(
target, *subclass_options, error);
break;
case ByModulesAndCU:
result_sp = SearchFilterByModuleListAndCU::CreateFromStructuredData(
target, *subclass_options, error);
break;
case Exception:
error.SetErrorString("Can't serialize exception breakpoints yet.");
break;
default:
llvm_unreachable("Should never get an uresolvable filter type.");
}
return result_sp;
}
示例5: CreateFromStructuredData
BreakpointResolverSP BreakpointResolver::CreateFromStructuredData(
const StructuredData::Dictionary &resolver_dict, Status &error) {
BreakpointResolverSP result_sp;
if (!resolver_dict.IsValid()) {
error.SetErrorString("Can't deserialize from an invalid data object.");
return result_sp;
}
llvm::StringRef subclass_name;
bool success = resolver_dict.GetValueForKeyAsString(
GetSerializationSubclassKey(), subclass_name);
if (!success) {
error.SetErrorStringWithFormat(
"Resolver data missing subclass resolver key");
return result_sp;
}
ResolverTy resolver_type = NameToResolverTy(subclass_name);
if (resolver_type == UnknownResolver) {
error.SetErrorStringWithFormatv("Unknown resolver type: {0}.",
subclass_name);
return result_sp;
}
StructuredData::Dictionary *subclass_options = nullptr;
success = resolver_dict.GetValueForKeyAsDictionary(
GetSerializationSubclassOptionsKey(), subclass_options);
if (!success || !subclass_options || !subclass_options->IsValid()) {
error.SetErrorString("Resolver data missing subclass options key.");
return result_sp;
}
lldb::addr_t offset;
success = subclass_options->GetValueForKeyAsInteger(
GetKey(OptionNames::Offset), offset);
if (!success) {
error.SetErrorString("Resolver data missing offset options key.");
return result_sp;
}
BreakpointResolver *resolver;
switch (resolver_type) {
case FileLineResolver:
resolver = BreakpointResolverFileLine::CreateFromStructuredData(
nullptr, *subclass_options, error);
break;
case AddressResolver:
resolver = BreakpointResolverAddress::CreateFromStructuredData(
nullptr, *subclass_options, error);
break;
case NameResolver:
resolver = BreakpointResolverName::CreateFromStructuredData(
nullptr, *subclass_options, error);
break;
case FileRegexResolver:
resolver = BreakpointResolverFileRegex::CreateFromStructuredData(
nullptr, *subclass_options, error);
break;
case PythonResolver:
resolver = BreakpointResolverScripted::CreateFromStructuredData(
nullptr, *subclass_options, error);
break;
case ExceptionResolver:
error.SetErrorString("Exception resolvers are hard.");
break;
default:
llvm_unreachable("Should never get an unresolvable resolver type.");
}
if (!error.Success()) {
return result_sp;
} else {
// Add on the global offset option:
resolver->SetOffset(offset);
return BreakpointResolverSP(resolver);
}
}