summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Utility')
-rw-r--r--lldb/source/Utility/StringExtractorGDBRemote.cpp50
-rw-r--r--lldb/source/Utility/StringExtractorGDBRemote.h28
2 files changed, 59 insertions, 19 deletions
diff --git a/lldb/source/Utility/StringExtractorGDBRemote.cpp b/lldb/source/Utility/StringExtractorGDBRemote.cpp
index 59d00aac817..fc64b275e55 100644
--- a/lldb/source/Utility/StringExtractorGDBRemote.cpp
+++ b/lldb/source/Utility/StringExtractorGDBRemote.cpp
@@ -16,8 +16,8 @@
-StringExtractorGDBRemote::Type
-StringExtractorGDBRemote::GetType () const
+StringExtractorGDBRemote::ResponseType
+StringExtractorGDBRemote::GetResponseType () const
{
if (m_packet.empty())
return eUnsupported;
@@ -49,29 +49,57 @@ StringExtractorGDBRemote::GetType () const
return eResponse;
}
+StringExtractorGDBRemote::ServerPacketType
+StringExtractorGDBRemote::GetServerPacketType () const
+{
+ // Empty is not a supported packet...
+ if (m_packet.empty())
+ return eServerPacketType_invalid;
+
+ const char *packet_cstr = m_packet.c_str();
+ switch (m_packet[0])
+ {
+ case '-':
+ if (m_packet.size() == 1)
+ return eServerPacketType_nack;
+ break;
+
+ case '+':
+ if (m_packet.size() == 1)
+ return eServerPacketType_ack;
+ break;
+
+ case 'q':
+ if (strcmp (packet_cstr, "qHostInfo") == 0)
+ return eServerPacketType_qHostInfo;
+ break;
+ }
+ return eServerPacketType_unimplemented;
+}
+
bool
-StringExtractorGDBRemote::IsOKPacket() const
+StringExtractorGDBRemote::IsOKResponse() const
{
- return GetType () == eOK;
+ return GetResponseType () == eOK;
}
bool
-StringExtractorGDBRemote::IsUnsupportedPacket() const
+StringExtractorGDBRemote::IsUnsupportedResponse() const
{
- return GetType () == eUnsupported;
+ return GetResponseType () == eUnsupported;
}
bool
-StringExtractorGDBRemote::IsNormalPacket() const
+StringExtractorGDBRemote::IsNormalResponse() const
{
- return GetType () == eResponse;
+ return GetResponseType () == eResponse;
}
bool
-StringExtractorGDBRemote::IsErrorPacket() const
+StringExtractorGDBRemote::IsErrorResponse() const
{
- return GetType () == eError &&
+ return GetResponseType () == eError &&
m_packet.size() == 3 &&
isxdigit(m_packet[1]) &&
isxdigit(m_packet[2]);
@@ -80,7 +108,7 @@ StringExtractorGDBRemote::IsErrorPacket() const
uint8_t
StringExtractorGDBRemote::GetError ()
{
- if (GetType() == eError)
+ if (GetResponseType() == eError)
{
SetFilePos(1);
return GetHexU8(255);
diff --git a/lldb/source/Utility/StringExtractorGDBRemote.h b/lldb/source/Utility/StringExtractorGDBRemote.h
index 6002b8bddce..e8c41778ec0 100644
--- a/lldb/source/Utility/StringExtractorGDBRemote.h
+++ b/lldb/source/Utility/StringExtractorGDBRemote.h
@@ -39,30 +39,42 @@ public:
{
}
- enum Type
+ enum ServerPacketType
+ {
+ eServerPacketType_nack = 0,
+ eServerPacketType_ack,
+ eServerPacketType_invalid,
+ eServerPacketType_unimplemented,
+ eServerPacketType_qHostInfo
+ };
+
+ ServerPacketType
+ GetServerPacketType () const;
+
+ enum ResponseType
{
eUnsupported = 0,
eAck,
eNack,
eError,
eOK,
- eResponse
+ eResponse,
};
- StringExtractorGDBRemote::Type
- GetType () const;
+ ResponseType
+ GetResponseType () const;
bool
- IsOKPacket() const;
+ IsOKResponse() const;
bool
- IsUnsupportedPacket() const;
+ IsUnsupportedResponse() const;
bool
- IsNormalPacket () const;
+ IsNormalResponse () const;
bool
- IsErrorPacket() const;
+ IsErrorResponse() const;
// Returns zero if the packet isn't a EXX packet where XX are two hex
// digits. Otherwise the error encoded in XX is returned.
OpenPOWER on IntegriCloud