本文整理汇总了C++中StringExtractorGDBRemote::Peek方法的典型用法代码示例。如果您正苦于以下问题:C++ StringExtractorGDBRemote::Peek方法的具体用法?C++ StringExtractorGDBRemote::Peek怎么用?C++ StringExtractorGDBRemote::Peek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringExtractorGDBRemote
的用法示例。
在下文中一共展示了StringExtractorGDBRemote::Peek方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
示例2: SendOKResponse
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServer::Handle_QEnvironment (StringExtractorGDBRemote &packet)
{
packet.SetFilePos(::strlen ("QEnvironment:"));
const uint32_t bytes_left = packet.GetBytesLeft();
if (bytes_left > 0)
{
m_process_launch_info.GetEnvironmentEntries ().AppendArgument (packet.Peek());
return SendOKResponse ();
}
return SendErrorResponse (12);
}
示例3: arch_spec
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerCommon::Handle_QLaunchArch(
StringExtractorGDBRemote &packet) {
packet.SetFilePos(::strlen("QLaunchArch:"));
const uint32_t bytes_left = packet.GetBytesLeft();
if (bytes_left > 0) {
const char *arch_triple = packet.Peek();
ArchSpec arch_spec(arch_triple, NULL);
m_process_launch_info.SetArchitecture(arch_spec);
return SendOKResponse();
}
return SendErrorResponse(13);
}