[Lldb-commits] [lldb] r311483 - [lldb] Correctly escape newlines and backslashes in the JSON serializer

2017-08-22 Thread Kuba Mracek via lldb-commits
Author: kuba.brecka
Date: Tue Aug 22 11:36:12 2017
New Revision: 311483

URL: http://llvm.org/viewvc/llvm-project?rev=311483&view=rev
Log:
[lldb] Correctly escape newlines and backslashes in the JSON serializer

JSON serializer fails to escape newlines and backslashes. Let's fix that.

Differential Revision: https://reviews.llvm.org/D34322


Added:
lldb/trunk/unittests/Utility/JSONTest.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Utility/JSON.cpp
lldb/trunk/unittests/Utility/CMakeLists.txt

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=311483&r1=311482&r2=311483&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Aug 22 11:36:12 2017
@@ -768,6 +768,7 @@
8C26C4261C3EA5F90031DF7C /* TSanRuntime.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 8C26C4241C3EA4340031DF7C /* TSanRuntime.cpp */; 
};
8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp 
*/; };
8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* 
MemoryHistoryASan.cpp */; };
+   8C3BD9A01EF5D1FF0016C343 /* JSONTest.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */; };
8C3BD9961EF45DA50016C343 /* MainThreadCheckerRuntime.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 8C3BD9951EF45D9B0016C343 /* 
MainThreadCheckerRuntime.cpp */; };
8CCB017E19BA28A80009FD44 /* ThreadCollection.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 8CCB017A19BA283D0009FD44 /* 
ThreadCollection.cpp */; };
8CCB018219BA4E270009FD44 /* SBThreadCollection.h in Headers */ 
= {isa = PBXBuildFile; fileRef = 8CCB018119BA4E210009FD44 /* 
SBThreadCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -2653,6 +2654,7 @@
8C2D6A54197A1EBE006989C9 /* MemoryHistory.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MemoryHistory.h; 
path = include/lldb/Target/MemoryHistory.h; sourceTree = ""; };
8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = MemoryHistoryASan.cpp; sourceTree = ""; };
8C2D6A5B197A1FDC006989C9 /* MemoryHistoryASan.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
MemoryHistoryASan.h; sourceTree = ""; };
+   8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSONTest.cpp; 
sourceTree = ""; };
8C3BD9931EF45D9B0016C343 /* MainThreadCheckerRuntime.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
MainThreadCheckerRuntime.h; sourceTree = ""; };
8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
MainThreadCheckerRuntime.cpp; sourceTree = ""; };
8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = ThreadCollection.cpp; path = source/Target/ThreadCollection.cpp; 
sourceTree = ""; };
@@ -3392,6 +3394,7 @@
23CB15041D66CD9200EDDDE1 /* Inputs */,
2321F9441BDD346100BA9A93 /* 
StringExtractorTest.cpp */,
2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */,
+   8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */,
2321F9461BDD346100BA9A93 /* UriParserTest.cpp 
*/,
);
path = Utility;
@@ -7177,6 +7180,7 @@
9A2057121F3B824B00F6C293 /* 
SymbolFileDWARFTests.cpp in Sources */,
9A20573A1F3B8E7E00F6C293 /* MainLoopTest.cpp in 
Sources */,
23CB15351D66DA9300EDDDE1 /* UriParserTest.cpp 
in Sources */,
+   8C3BD9A01EF5D1FF0016C343 /* JSONTest.cpp in 
Sources */,
23CB15361D66DA9300EDDDE1 /* FileSpecTest.cpp in 
Sources */,
23E2E5251D90373D006F38BB /* ArchSpecTest.cpp in 
Sources */,
9A2057081F3B819100F6C293 /* 
MemoryRegionInfoTest.cpp in Sources */,

Modified: lldb/trunk/source/Utility/JSON.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/JSON.cpp?rev=311483&r1=311482&r2=311483&view=diff
===

[Lldb-commits] [PATCH] D34322: [lldb] Correctly escape newlines and backslashes in the JSON serializer

2017-08-22 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL311483: [lldb] Correctly escape newlines and backslashes in 
the JSON serializer (authored by kuba.brecka).

Changed prior to commit:
  https://reviews.llvm.org/D34322?vs=102950&id=112206#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34322

Files:
  lldb/trunk/lldb.xcodeproj/project.pbxproj
  lldb/trunk/source/Utility/JSON.cpp
  lldb/trunk/unittests/Utility/CMakeLists.txt
  lldb/trunk/unittests/Utility/JSONTest.cpp

Index: lldb/trunk/lldb.xcodeproj/project.pbxproj
===
--- lldb/trunk/lldb.xcodeproj/project.pbxproj
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj
@@ -768,6 +768,7 @@
 		8C26C4261C3EA5F90031DF7C /* TSanRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C26C4241C3EA4340031DF7C /* TSanRuntime.cpp */; };
 		8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */; };
 		8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */; };
+		8C3BD9A01EF5D1FF0016C343 /* JSONTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */; };
 		8C3BD9961EF45DA50016C343 /* MainThreadCheckerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */; };
 		8CCB017E19BA28A80009FD44 /* ThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */; };
 		8CCB018219BA4E270009FD44 /* SBThreadCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CCB018119BA4E210009FD44 /* SBThreadCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -2653,6 +2654,7 @@
 		8C2D6A54197A1EBE006989C9 /* MemoryHistory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MemoryHistory.h; path = include/lldb/Target/MemoryHistory.h; sourceTree = ""; };
 		8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryHistoryASan.cpp; sourceTree = ""; };
 		8C2D6A5B197A1FDC006989C9 /* MemoryHistoryASan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryHistoryASan.h; sourceTree = ""; };
+		8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSONTest.cpp; sourceTree = ""; };
 		8C3BD9931EF45D9B0016C343 /* MainThreadCheckerRuntime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MainThreadCheckerRuntime.h; sourceTree = ""; };
 		8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MainThreadCheckerRuntime.cpp; sourceTree = ""; };
 		8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadCollection.cpp; path = source/Target/ThreadCollection.cpp; sourceTree = ""; };
@@ -3392,6 +3394,7 @@
 23CB15041D66CD9200EDDDE1 /* Inputs */,
 2321F9441BDD346100BA9A93 /* StringExtractorTest.cpp */,
 2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */,
+8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */,
 2321F9461BDD346100BA9A93 /* UriParserTest.cpp */,
 			);
 			path = Utility;
@@ -7177,6 +7180,7 @@
 9A2057121F3B824B00F6C293 /* SymbolFileDWARFTests.cpp in Sources */,
 9A20573A1F3B8E7E00F6C293 /* MainLoopTest.cpp in Sources */,
 23CB15351D66DA9300EDDDE1 /* UriParserTest.cpp in Sources */,
+8C3BD9A01EF5D1FF0016C343 /* JSONTest.cpp in Sources */,
 23CB15361D66DA9300EDDDE1 /* FileSpecTest.cpp in Sources */,
 23E2E5251D90373D006F38BB /* ArchSpecTest.cpp in Sources */,
 9A2057081F3B819100F6C293 /* MemoryRegionInfoTest.cpp in Sources */,
Index: lldb/trunk/unittests/Utility/JSONTest.cpp
===
--- lldb/trunk/unittests/Utility/JSONTest.cpp
+++ lldb/trunk/unittests/Utility/JSONTest.cpp
@@ -0,0 +1,26 @@
+#include "gtest/gtest.h"
+
+#include "lldb/Core/StreamString.h"
+#include "lldb/Utility/JSON.h"
+
+using namespace lldb_private;
+
+TEST(JSONTest, Dictionary) {
+  JSONObject o;
+  o.SetObject("key", std::make_shared("value"));
+
+  StreamString stream;
+  o.Write(stream);
+
+  ASSERT_EQ(stream.GetString(), R"({"key":"value"})");
+}
+
+TEST(JSONTest, Newlines) {
+  JSONObject o;
+  o.SetObject("key", std::make_shared("hello\nworld"));
+
+  StreamString stream;
+  o.Write(stream);
+
+  ASSERT_EQ(stream.GetString(), R"({"key":"hello\nworld"})");
+}
Index: lldb/trunk/unittests/Utility/CMakeLists.txt
===
--- lldb/trunk/unittests/Utility/CMakeLists.txt
+++ lldb/trunk/unittests/Utility/CMake

[Lldb-commits] [PATCH] D36804: Add initial support to PowerPC64 little endian (POWER8)

2017-08-22 Thread Gustavo Serra Scalet via Phabricator via lldb-commits
gut added a comment.

In https://reviews.llvm.org/D36804#845286, @gut wrote:

> Can I please get some review on this?
>
> ps: check comments on phabricator as it was not being published on 
> lldb-commits mailing list.


Nobody? It's a very small change.

We hope to port LLDB to PowerPC64le if patches are welcome. Are you interested 
in such a port? It's an architecture already supported by LLVM.


https://reviews.llvm.org/D36804



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D36804: Add initial support to PowerPC64 little endian (POWER8)

2017-08-22 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added reviewers: labath, clayborg.
krytarowski added a comment.

+ Linux and general LLDB maintainers


https://reviews.llvm.org/D36804



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r311484 - Fixup for r311483: Use correct path to StreamString.h

2017-08-22 Thread Kuba Mracek via lldb-commits
Author: kuba.brecka
Date: Tue Aug 22 12:09:39 2017
New Revision: 311484

URL: http://llvm.org/viewvc/llvm-project?rev=311484&view=rev
Log:
Fixup for r311483: Use correct path to StreamString.h


Modified:
lldb/trunk/unittests/Utility/JSONTest.cpp

Modified: lldb/trunk/unittests/Utility/JSONTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/JSONTest.cpp?rev=311484&r1=311483&r2=311484&view=diff
==
--- lldb/trunk/unittests/Utility/JSONTest.cpp (original)
+++ lldb/trunk/unittests/Utility/JSONTest.cpp Tue Aug 22 12:09:39 2017
@@ -1,7 +1,7 @@
 #include "gtest/gtest.h"
 
-#include "lldb/Core/StreamString.h"
 #include "lldb/Utility/JSON.h"
+#include "lldb/Utility/StreamString.h"
 
 using namespace lldb_private;
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D36804: Add initial support to PowerPC64 little endian (POWER8)

2017-08-22 Thread Hal Finkel via Phabricator via lldb-commits
hfinkel added inline comments.



Comment at: source/Core/ArchSpec.cpp:375
  SUBTYPE_MASK},
+{ArchSpec::eCore_ppc64le_generic, llvm::MachO::CPU_TYPE_POWERPC64, CPU_ANY,
+ UINT32_MAX, SUBTYPE_MASK},

I doubt this is needed. There's no Darwin support to speak of.


https://reviews.llvm.org/D36804



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D36804: Add initial support to PowerPC64 little endian (POWER8)

2017-08-22 Thread Gustavo Serra Scalet via Phabricator via lldb-commits
gut added inline comments.



Comment at: source/Core/ArchSpec.cpp:375
  SUBTYPE_MASK},
+{ArchSpec::eCore_ppc64le_generic, llvm::MachO::CPU_TYPE_POWERPC64, CPU_ANY,
+ UINT32_MAX, SUBTYPE_MASK},

hfinkel wrote:
> I doubt this is needed. There's no Darwin support to speak of.
Oh, I see. The MachO object type is only used by MacOS, right? Then I can 
remove, you are right.


https://reviews.llvm.org/D36804



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D36804: Add initial support to PowerPC64 little endian (POWER8)

2017-08-22 Thread Hal Finkel via Phabricator via lldb-commits
hfinkel accepted this revision.
hfinkel added inline comments.
This revision is now accepted and ready to land.



Comment at: source/Core/ArchSpec.cpp:375
  SUBTYPE_MASK},
+{ArchSpec::eCore_ppc64le_generic, llvm::MachO::CPU_TYPE_POWERPC64, CPU_ANY,
+ UINT32_MAX, SUBTYPE_MASK},

gut wrote:
> hfinkel wrote:
> > I doubt this is needed. There's no Darwin support to speak of.
> Oh, I see. The MachO object type is only used by MacOS, right? Then I can 
> remove, you are right.
I'm pretty sure that's correct.

Otherwise, this LGTM.



https://reviews.llvm.org/D36804



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits