[Lldb-commits] [PATCH] D20509: Skip leading spaces when decoding hex values

Francis Ricci via lldb-commits lldb-commits at lists.llvm.org
Sat May 21 08:17:08 PDT 2016


fjricci created this revision.
fjricci added reviewers: vharron, clayborg, jasonmolenda.
fjricci added a subscriber: lldb-commits.

The StringExtractor functions using stroull will already
skip leading whitespace (ie GetU64). Make sure that the manual
hex parsing functions also skip leading whitespace.

This is important for members of the gdb protocol which are defined
as using whitespace separators (ie qfThreadInfo, qC, etc). While
lldb-server does not use the whitespace separators, gdb-remotes
should work if they do, as the whitespace is defined by the gdb-remote
protocol.

http://reviews.llvm.org/D20509

Files:
  source/Utility/StringExtractor.cpp

Index: source/Utility/StringExtractor.cpp
===================================================================
--- source/Utility/StringExtractor.cpp
+++ source/Utility/StringExtractor.cpp
@@ -104,6 +104,7 @@
 int
 StringExtractor::DecodeHexU8()
 {
+    SkipSpaces();
     if (GetBytesLeft() < 2)
     {
         return -1;
@@ -230,6 +231,7 @@
     uint32_t result = 0;
     uint32_t nibble_count = 0;
 
+    SkipSpaces();
     if (little_endian)
     {
         uint32_t shift_amount = 0;
@@ -292,6 +294,7 @@
     uint64_t result = 0;
     uint32_t nibble_count = 0;
 
+    SkipSpaces();
     if (little_endian)
     {
         uint32_t shift_amount = 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20509.58041.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160521/2b117a39/attachment.bin>


More information about the lldb-commits mailing list