[lldb] Fix JSON parser to allow empty arrays
authorAlex Cameron <ascottcameron@gmail.com>
Mon, 18 Nov 2019 14:11:29 +0000 (15:11 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Mon, 18 Nov 2019 14:12:55 +0000 (15:12 +0100)
commit10b851434324f82e9ad11d39f501f2d8b921642a
treebc5be67a4f53c56adcb6eb1e283509a94f1eb62f
parent8c8c941844080625fd2989bd4045cdd5db4bb908
[lldb] Fix JSON parser to allow empty arrays

Summary:
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=39405
```
alexc@kitty:~/work/wiredtiger/build_posix$ cat breakpoint.json
[{"Breakpoint" : {"BKPTOptions" : {"AutoContinue" : false,"ConditionText" : "","EnabledState" : true,"IgnoreCount" : 0,"OneShotState" : false},"BKPTResolver" : {"Options" : {"NameMask" : [56],"Offset" : 0,"SkipPrologue" : true,"SymbolNames" : ["__wt_btcur_search"]},"Type" : "SymbolName"},"Hardware" : false,"SearchFilter" : {"Options" : {},"Type" : "Unconstrained","Foo" : []}}}]
```
**Before**
```
(lldb) breakpoint read --file breakpoint.json
error: Invalid JSON from input file: /home/alexc/work/wiredtiger/build_posix/breakpoint.json.
```
**After**
```
(lldb) breakpoint read --file breakpoint.json
New breakpoints:
Breakpoint 1: where = libwiredtiger-3.2.2.so`__wt_btcur_search + 15 at bt_cursor.c:522:5, address = 0x00007ffff576ab2f
```

Reviewers: xbolva00, davide, labath

Reviewed By: davide, labath

Subscribers: mgorny, jingham, labath, davide, JDevlieghere, lldb-commits

Tags: #llvm, #lldb

Differential Revision: https://reviews.llvm.org/D68179
lldb/tools/debugserver/source/JSON.cpp
lldb/tools/debugserver/source/JSON.h
lldb/unittests/debugserver/CMakeLists.txt
lldb/unittests/debugserver/JSONTest.cpp [new file with mode: 0644]