Skip leading spaces when decoding hex values

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
This commit is contained in:
Francis Ricci 2016-05-24 18:19:45 +00:00
parent 97276c8be5
commit 15a2165d64
1 changed files with 3 additions and 0 deletions

View File

@ -104,6 +104,7 @@ StringExtractor::GetChar (char fail_value)
int
StringExtractor::DecodeHexU8()
{
SkipSpaces();
if (GetBytesLeft() < 2)
{
return -1;
@ -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;
@ -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;