本文整理汇总了C++中StringExtractorGDBRemote::GetHexByteStringFixedLength方法的典型用法代码示例。如果您正苦于以下问题:C++ StringExtractorGDBRemote::GetHexByteStringFixedLength方法的具体用法?C++ StringExtractorGDBRemote::GetHexByteStringFixedLength怎么用?C++ StringExtractorGDBRemote::GetHexByteStringFixedLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringExtractorGDBRemote
的用法示例。
在下文中一共展示了StringExtractorGDBRemote::GetHexByteStringFixedLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendOKResponse
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerCommon::Handle_A(StringExtractorGDBRemote &packet) {
// The 'A' packet is the most over designed packet ever here with
// redundant argument indexes, redundant argument lengths and needed hex
// encoded argument string values. Really all that is needed is a comma
// separated hex encoded argument value list, but we will stay true to the
// documented version of the 'A' packet here...
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
int actual_arg_index = 0;
packet.SetFilePos(1); // Skip the 'A'
bool success = true;
while (success && packet.GetBytesLeft() > 0) {
// Decode the decimal argument string length. This length is the
// number of hex nibbles in the argument string value.
const uint32_t arg_len = packet.GetU32(UINT32_MAX);
if (arg_len == UINT32_MAX)
success = false;
else {
// Make sure the argument hex string length is followed by a comma
if (packet.GetChar() != ',')
success = false;
else {
// Decode the argument index. We ignore this really because
// who would really send down the arguments in a random order???
const uint32_t arg_idx = packet.GetU32(UINT32_MAX);
if (arg_idx == UINT32_MAX)
success = false;
else {
// Make sure the argument index is followed by a comma
if (packet.GetChar() != ',')
success = false;
else {
// Decode the argument string value from hex bytes
// back into a UTF8 string and make sure the length
// matches the one supplied in the packet
std::string arg;
if (packet.GetHexByteStringFixedLength(arg, arg_len) !=
(arg_len / 2))
success = false;
else {
// If there are any bytes left
if (packet.GetBytesLeft()) {
if (packet.GetChar() != ',')
success = false;
}
if (success) {
if (arg_idx == 0)
m_process_launch_info.GetExecutableFile().SetFile(arg.c_str(),
false);
m_process_launch_info.GetArguments().AppendArgument(arg);
if (log)
log->Printf("LLGSPacketHandler::%s added arg %d: \"%s\"",
__FUNCTION__, actual_arg_index, arg.c_str());
++actual_arg_index;
}
}
}
}
}
}
}
if (success) {
m_process_launch_error = LaunchProcess();
if (m_process_launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID) {
return SendOKResponse();
} else {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
if (log)
log->Printf("LLGSPacketHandler::%s failed to launch exe: %s",
__FUNCTION__, m_process_launch_error.AsCString());
}
}
return SendErrorResponse(8);
}