Skip to content

Commit

Permalink
Skip leading spaces when decoding hex values
Browse files Browse the repository at this point in the history
Summary:
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.

Reviewers: vharron, jasonmolenda, clayborg

Subscribers: sas, lldb-commits

Differential Revision: http://reviews.llvm.org/D20509

llvm-svn: 270592
  • Loading branch information
fjricci committed May 24, 2016
1 parent 97276c8 commit 15a2165
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lldb/source/Utility/StringExtractor.cpp
Expand Up @@ -104,6 +104,7 @@ StringExtractor::GetChar (char fail_value)
int
StringExtractor::DecodeHexU8()
{
SkipSpaces();
if (GetBytesLeft() < 2)
{
return -1;
Expand Down Expand Up @@ -230,6 +231,7 @@ StringExtractor::GetHexMaxU32 (bool little_endian, uint32_t fail_value)
uint32_t result = 0;
uint32_t nibble_count = 0;

SkipSpaces();
if (little_endian)
{
uint32_t shift_amount = 0;
Expand Down Expand Up @@ -292,6 +294,7 @@ StringExtractor::GetHexMaxU64 (bool little_endian, uint64_t fail_value)
uint64_t result = 0;
uint32_t nibble_count = 0;

SkipSpaces();
if (little_endian)
{
uint32_t shift_amount = 0;
Expand Down

0 comments on commit 15a2165

Please sign in to comment.