[Lldb-commits] [lldb] r279208 - add all missing gtest tests to the Xcode lldb-gtest target

2016-08-18 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Fri Aug 19 00:26:40 2016
New Revision: 279208

URL: http://llvm.org/viewvc/llvm-project?rev=279208=rev
Log:
add all missing gtest tests to the Xcode lldb-gtest target

Exclusions:
ModuleCacheTest: https://llvm.org/bugs/show_bug.cgi?id=29045
SymbolFilePDBTests: https://llvm.org/bugs/show_bug.cgi?id=29046

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=279208=279207=279208=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Aug 19 00:26:40 2016
@@ -77,7 +77,6 @@
2370A3861D66C594000E7BE6 /* GDBRemoteClientBaseTest.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 2370A37D1D66C587000E7BE6 /* 
GDBRemoteClientBaseTest.cpp */; };
2370A3871D66C594000E7BE6 /* 
GDBRemoteCommunicationClientTest.cpp in Sources */ = {isa = PBXBuildFile; 
fileRef = 2370A37E1D66C587000E7BE6 /* GDBRemoteCommunicationClientTest.cpp */; 
};
2370A3881D66C594000E7BE6 /* GDBRemoteTestUtils.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2370A37F1D66C587000E7BE6 /* 
GDBRemoteTestUtils.cpp */; };
-   2370A3891D66C7E9000E7BE6 /* StringExtractor.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2660D9F611922A1300958FBD /* StringExtractor.cpp 
*/; };
2374D7461D4BAA1D005C9575 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 2374D7431D4BAA1D005C9575 /* CMakeLists.txt */; };
2374D7521D4BB299005C9575 /* GDBRemoteClientBase.h in CopyFiles 
*/ = {isa = PBXBuildFile; fileRef = 2374D74F1D4BB299005C9575 /* 
GDBRemoteClientBase.h */; };
2374D7531D4BB2FF005C9575 /* GDBRemoteClientBase.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2374D74E1D4BB299005C9575 /* 
GDBRemoteClientBase.cpp */; };
@@ -97,6 +96,16 @@
239504E41BDD454B00963CEA /* TaskPoolTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */; 
};
239504E51BDD454B00963CEA /* UriParserTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2321F9461BDD346100BA9A93 /* UriParserTest.cpp 
*/; };
23CB14E41D66CA2200EDDDE1 /* libxml2.2.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 23CB14E31D66CA2200EDDDE1 /* libxml2.2.dylib */; 
};
+   23CB14EE1D66CC1400EDDDE1 /* BroadcasterTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 23CB14E61D66CC0E00EDDDE1 /* BroadcasterTest.cpp 
*/; };
+   23CB14EF1D66CC1F00EDDDE1 /* DataExtractorTest.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 23CB14E81D66CC0E00EDDDE1 /* 
DataExtractorTest.cpp */; };
+   23CB14F01D66CC2300EDDDE1 /* ScalarTest.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 23CB14E91D66CC0E00EDDDE1 /* ScalarTest.cpp */; };
+   23CB14F21D66CC9000EDDDE1 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 23CB14F11D66CC9000EDDDE1 /* CMakeLists.txt */; };
+   23CB14F41D66CC9B00EDDDE1 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 23CB14F31D66CC9B00EDDDE1 /* CMakeLists.txt */; };
+   23CB14F71D66CCD600EDDDE1 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 23CB14F61D66CCD600EDDDE1 /* CMakeLists.txt */; };
+   23CB14FB1D66CCF100EDDDE1 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 23CB14F91D66CCF100EDDDE1 /* CMakeLists.txt */; };
+   23CB14FF1D66CD2900EDDDE1 /* FileSpecTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 23CB14FD1D66CD2400EDDDE1 /* FileSpecTest.cpp */; 
};
+   23CB15001D66CD3900EDDDE1 /* CPlusPlusLanguageTest.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 23CB14FA1D66CCF100EDDDE1 /* 
CPlusPlusLanguageTest.cpp */; };
+   23CB150F1D66CF5D00EDDDE1 /* TestClangASTContext.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 23CB150C1D66CF5600EDDDE1 /* 
TestClangASTContext.cpp */; };
23D065881D4A7BDA0008EDE6 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 23D065811D4A7BDA0008EDE6 /* CMakeLists.txt */; };
23D0658A1D4A7BDA0008EDE6 /* RenderScriptExpressionOpts.h in 
CopyFiles */ = {isa = PBXBuildFile; fileRef = 23D065831D4A7BDA0008EDE6 /* 
RenderScriptExpressionOpts.h */; };
23D0658C1D4A7BDA0008EDE6 /* RenderScriptRuntime.h in CopyFiles 
*/ = {isa = PBXBuildFile; fileRef = 23D065851D4A7BDA0008EDE6 /* 
RenderScriptRuntime.h */; };
@@ -1166,9 +1175,11 @@
dstSubfolderSpec = 0;
files = (
23D0658E1D4A7BDA0008EDE6 /* 
RenderScriptx86ABIFixups.h in CopyFiles */,
+   23CB14FB1D66CCF100EDDDE1 /* CMakeLists.txt in 
CopyFiles */,
 

[Lldb-commits] [lldb] r279205 - fixup macOS gtest running

2016-08-18 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Thu Aug 18 23:55:12 2016
New Revision: 279205

URL: http://llvm.org/viewvc/llvm-project?rev=279205=rev
Log:
fixup macOS gtest running

Needed to explicitly turn off RTTI (since lldb-core builds
with -fno-rtti) and specify -DGTEST_HAVE_RTTI=0.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=279205=279204=279205=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Aug 18 23:55:12 2016
@@ -77,6 +77,7 @@
2370A3861D66C594000E7BE6 /* GDBRemoteClientBaseTest.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 2370A37D1D66C587000E7BE6 /* 
GDBRemoteClientBaseTest.cpp */; };
2370A3871D66C594000E7BE6 /* 
GDBRemoteCommunicationClientTest.cpp in Sources */ = {isa = PBXBuildFile; 
fileRef = 2370A37E1D66C587000E7BE6 /* GDBRemoteCommunicationClientTest.cpp */; 
};
2370A3881D66C594000E7BE6 /* GDBRemoteTestUtils.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2370A37F1D66C587000E7BE6 /* 
GDBRemoteTestUtils.cpp */; };
+   2370A3891D66C7E9000E7BE6 /* StringExtractor.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2660D9F611922A1300958FBD /* StringExtractor.cpp 
*/; };
2374D7461D4BAA1D005C9575 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 2374D7431D4BAA1D005C9575 /* CMakeLists.txt */; };
2374D7521D4BB299005C9575 /* GDBRemoteClientBase.h in CopyFiles 
*/ = {isa = PBXBuildFile; fileRef = 2374D74F1D4BB299005C9575 /* 
GDBRemoteClientBase.h */; };
2374D7531D4BB2FF005C9575 /* GDBRemoteClientBase.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2374D74E1D4BB299005C9575 /* 
GDBRemoteClientBase.cpp */; };
@@ -95,6 +96,7 @@
239504E31BDD454B00963CEA /* StringExtractorTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2321F9441BDD346100BA9A93 /* 
StringExtractorTest.cpp */; };
239504E41BDD454B00963CEA /* TaskPoolTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */; 
};
239504E51BDD454B00963CEA /* UriParserTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2321F9461BDD346100BA9A93 /* UriParserTest.cpp 
*/; };
+   23CB14E41D66CA2200EDDDE1 /* libxml2.2.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 23CB14E31D66CA2200EDDDE1 /* libxml2.2.dylib */; 
};
23D065881D4A7BDA0008EDE6 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 23D065811D4A7BDA0008EDE6 /* CMakeLists.txt */; };
23D0658A1D4A7BDA0008EDE6 /* RenderScriptExpressionOpts.h in 
CopyFiles */ = {isa = PBXBuildFile; fileRef = 23D065831D4A7BDA0008EDE6 /* 
RenderScriptExpressionOpts.h */; };
23D0658C1D4A7BDA0008EDE6 /* RenderScriptRuntime.h in CopyFiles 
*/ = {isa = PBXBuildFile; fileRef = 23D065851D4A7BDA0008EDE6 /* 
RenderScriptRuntime.h */; };
@@ -1270,6 +1272,7 @@
23AB0530199FF639003B8084 /* ProcessFreeBSD.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProcessFreeBSD.h; 
sourceTree = ""; };
23AB0531199FF639003B8084 /* ProcessMonitor.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
ProcessMonitor.cpp; sourceTree = ""; };
23AB0532199FF639003B8084 /* ProcessMonitor.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProcessMonitor.h; 
sourceTree = ""; };
+   23CB14E31D66CA2200EDDDE1 /* libxml2.2.dylib */ = {isa = 
PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = 
libxml2.2.dylib; path = usr/lib/libxml2.2.dylib; sourceTree = SDKROOT; };
23D065811D4A7BDA0008EDE6 /* CMakeLists.txt */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 
CMakeLists.txt; sourceTree = ""; };
23D065821D4A7BDA0008EDE6 /* RenderScriptExpressionOpts.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = RenderScriptExpressionOpts.cpp; sourceTree = 
""; };
23D065831D4A7BDA0008EDE6 /* RenderScriptExpressionOpts.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = RenderScriptExpressionOpts.h; sourceTree = ""; };
@@ -3002,6 +3005,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+   23CB14E41D66CA2200EDDDE1 /* libxml2.2.dylib in 
Frameworks */,
2326CF4F1BDD687800A5CEAC /* libpanel.dylib in 
Frameworks */,
2326CF4D1BDD684B00A5CEAC /* libedit.dylib in 
Frameworks */,

[Lldb-commits] [lldb] r279203 - fix broken gdb-remote gtest

2016-08-18 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Thu Aug 18 23:38:44 2016
New Revision: 279203

URL: http://llvm.org/viewvc/llvm-project?rev=279203=rev
Log:
fix broken gdb-remote gtest

This change adds the Process/gdb-remote gtests to the Xcode
build.  It also adds a virtual method impl to the continuation
delegate that I added with the StructuredDataPlugin change.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=279203=279202=279203=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Aug 18 23:38:44 2016
@@ -74,6 +74,9 @@
233B007F1960CB280090E598 /* ProcessLaunchInfo.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 233B007E1960CB280090E598 /* 
ProcessLaunchInfo.cpp */; };
236124A41986B4E2004EFC37 /* IOObject.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 236124A21986B4E2004EFC37 /* IOObject.cpp */; };
236124A51986B4E2004EFC37 /* Socket.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 236124A31986B4E2004EFC37 /* Socket.cpp */; };
+   2370A3861D66C594000E7BE6 /* GDBRemoteClientBaseTest.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 2370A37D1D66C587000E7BE6 /* 
GDBRemoteClientBaseTest.cpp */; };
+   2370A3871D66C594000E7BE6 /* 
GDBRemoteCommunicationClientTest.cpp in Sources */ = {isa = PBXBuildFile; 
fileRef = 2370A37E1D66C587000E7BE6 /* GDBRemoteCommunicationClientTest.cpp */; 
};
+   2370A3881D66C594000E7BE6 /* GDBRemoteTestUtils.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2370A37F1D66C587000E7BE6 /* 
GDBRemoteTestUtils.cpp */; };
2374D7461D4BAA1D005C9575 /* CMakeLists.txt in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 2374D7431D4BAA1D005C9575 /* CMakeLists.txt */; };
2374D7521D4BB299005C9575 /* GDBRemoteClientBase.h in CopyFiles 
*/ = {isa = PBXBuildFile; fileRef = 2374D74F1D4BB299005C9575 /* 
GDBRemoteClientBase.h */; };
2374D7531D4BB2FF005C9575 /* GDBRemoteClientBase.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2374D74E1D4BB299005C9575 /* 
GDBRemoteClientBase.cpp */; };
@@ -1241,6 +1244,12 @@
236124A31986B4E2004EFC37 /* Socket.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = Socket.cpp; sourceTree = ""; };
236124A61986B50E004EFC37 /* IOObject.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IOObject.h; path = 
include/lldb/Host/IOObject.h; sourceTree = ""; };
236124A71986B50E004EFC37 /* Socket.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Socket.h; path = 
include/lldb/Host/Socket.h; sourceTree = ""; };
+   2370A37A1D66C57B000E7BE6 /* CMakeLists.txt */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 
CMakeLists.txt; sourceTree = ""; };
+   2370A37C1D66C587000E7BE6 /* CMakeLists.txt */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 
CMakeLists.txt; sourceTree = ""; };
+   2370A37D1D66C587000E7BE6 /* GDBRemoteClientBaseTest.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = GDBRemoteClientBaseTest.cpp; sourceTree = ""; 
};
+   2370A37E1D66C587000E7BE6 /* 
GDBRemoteCommunicationClientTest.cpp */ = {isa = PBXFileReference; fileEncoding 
= 4; lastKnownFileType = sourcecode.cpp.cpp; path = 
GDBRemoteCommunicationClientTest.cpp; sourceTree = ""; };
+   2370A37F1D66C587000E7BE6 /* GDBRemoteTestUtils.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = GDBRemoteTestUtils.cpp; sourceTree = ""; };
+   2370A3801D66C587000E7BE6 /* GDBRemoteTestUtils.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
GDBRemoteTestUtils.h; sourceTree = ""; };
2374D7431D4BAA1D005C9575 /* CMakeLists.txt */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 
CMakeLists.txt; sourceTree = ""; };
2374D74E1D4BB299005C9575 /* GDBRemoteClientBase.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = GDBRemoteClientBase.cpp; sourceTree = ""; };
2374D74F1D4BB299005C9575 /* GDBRemoteClientBase.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
GDBRemoteClientBase.h; sourceTree = ""; };
@@ -3153,12 +3162,13 @@
2321F9331BDD326500BA9A93 /* unittests */ = {
isa = PBXGroup;
children = (
+ 

Re: [Lldb-commits] [PATCH] D23406: Fix a race in Broadcaster/Listener interaction

2016-08-18 Thread Argyrios Kyrtzidis via lldb-commits

> On Aug 11, 2016, at 4:00 PM, Enrico Granata  wrote:
> 
> 
>> On Aug 11, 2016, at 3:55 PM, Jim Ingham via lldb-commits 
>> > wrote:
>> 
>> jingham added a comment.
>> 
>> The patch seems correct to me.
>> 
>> I don't have a strong opinion about std::vector vrs. SmallVector.  These are 
>> temporary objects, so the size of the container doesn't matter, and I doubt 
>> this code is hot enough in normal lldb sessions that the difference between 
>> in performance between the two will matter.  Maybe the SmallVector data 
>> formatter (llvm/utils/lldbDataFormatters.py) works, or if it doesn't we 
>> should fix it?
> 
> IIRC, Argyrios wrote those formatters a few years ago, so +Argyrios to 
> comment on whether it's expected to work

I haven’t touch those for a long time, I’m not sure if they are still working.

> 
>> 
>> 
>> https://reviews.llvm.org/D23406 
>> 
>> 
>> 
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 
> 
> Thanks,
> - Enrico
>  egranata@.com ☎️ 27683
> 

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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Dimitar Vlahovski via lldb-commits
dvlahovski added inline comments.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:260
@@ +259,3 @@
+
+uint8_t number_of_processors;
+uint8_t product_type;

amccarth wrote:
> I'll concede that the static_assert is useful.  Given that, showing the 
> arithmetic explicitly will be helpful when one of these assertions trips, 
> because you'll be able to see how it's supposed to correspond to the struct.
Yes that was my inital insentive to write explicitly the arithmetic


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:133
@@ +132,3 @@
+// This matches the Linux kernel definitions from 
+enum MinidumpPCPUInformationARMElfHwCaps
+{

dvlahovski wrote:
> amccarth wrote:
> > zturner wrote:
> > > Should this be `enum class`?
> > These look like individual bits that will be bitwise-ORed together, which 
> > is trickier to do with an enum class.
> > 
> > But you may still want to specify the underlying type, like `uint32_t`.
> Yes, forgot to change it ...
Yea, see my earlier comment.  This enum uses `LLVM_MARK_AS_BITMASK_ENUM()` 
which makes this possible.


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Dimitar Vlahovski via lldb-commits
dvlahovski added inline comments.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.cpp:21
@@ +20,3 @@
+
+llvm::Optional
+MinidumpHeader::Parse(llvm::ArrayRef )

zturner wrote:
> I think these can all just return the pointer instead of `llvm::Optional<>`.  
> return `nullptr` to indicate failure.  Optionally, make the signature be 
> something like `Error MinidumpHeader::Parse(llvm::ArrayRef , 
> const MinidumpHeader *)` which would allow you to propagate the error 
> up (if you wanted to).
> 
> At the very least though, there's no point using `llvm::Optional<>` if 
> `nullptr` can be used to indicate failure.
Yes, fair point. Now that I'm returning pointers, `nullptr` is better for 
indicating failure.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.cpp:30
@@ +29,3 @@
+const MinidumpHeaderConstants version =
+static_cast(static_cast(header->version) & 0x);
+

zturner wrote:
> Where does the `0x` come from?
There is a comment in the header, but probably it should be here. The higher 16 
bit of the version field are implementation specific.
The lower 16 bits are the version number (which is always the same constant 
number)


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Adrian McCarthy via lldb-commits
amccarth added a comment.

In https://reviews.llvm.org/D23545#519675, @dvlahovski wrote:

> In https://reviews.llvm.org/D23545#516808, @amccarth wrote:
>
> > Are we putting this code in the right place?  I wouldn't expect minidump 
> > parsing to fall under Plugins/Process.
> >
> > I assume the eventual intent is to turn the Windows-specific code into a 
> > user of your new code?  I look forward to seeing that happen.
>
>
> My idea was that the new plugin will live in Plugins/Process/minidump.
>  Do you have a suggestion where the parsing code to be, if not in the same 
> directory?


The parsing code will end up being used by multiple plugins--the new one you're 
building for Linux and the existing one that's Windows-specific.

What I thought would happen would be that you'd write the parsing code first, 
hook up the Windows-minidump plugin to use it (since the Windows-minidump 
plugin tests would help validate that your parsing is correct/complete) and 
then either add a new plugin for non-Windows.  That would argue for the 
minidump parsing to be in a common location that could be used by both plugins. 
 I don't have a good idea of where that would go.

Another approach is to make the Windows plugin platform agnostic once you 
replace the limited use of the minidump APIs with your own parsing code.

Food for thought.  No need to hold up this patch for that.  The code can be 
moved later if appropriate.



Comment at: source/Plugins/Process/minidump/MinidumpTypes.cpp:22
@@ +21,3 @@
+llvm::Optional
+MinidumpHeader::Parse(llvm::ArrayRef )
+{

I find it amusing that all these `Parse` methods are in MinidumpTypes.cpp 
rather than MinidumpParser.cpp.  Just an observation--not a request to change 
it.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:133
@@ +132,3 @@
+// This matches the Linux kernel definitions from 
+enum MinidumpPCPUInformationARMElfHwCaps
+{

zturner wrote:
> Should this be `enum class`?
These look like individual bits that will be bitwise-ORed together, which is 
trickier to do with an enum class.

But you may still want to specify the underlying type, like `uint32_t`.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:258
@@ +257,3 @@
+llvm::support::ulittle16_t processor_level;
+llvm::support::ulittle16_t processor_revision;
+

dvlahovski wrote:
> The idea of this is to be sure that the compiler didn't align stuff 
> wrongly/not in the way we expect.
OK.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:260
@@ +259,3 @@
+
+uint8_t number_of_processors;
+uint8_t product_type;

I'll concede that the static_assert is useful.  Given that, showing the 
arithmetic explicitly will be helpful when one of these assertions trips, 
because you'll be able to see how it's supposed to correspond to the struct.


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Dimitar Vlahovski via lldb-commits
dvlahovski added a comment.

Also FYI I copied the implementation of `consumeObject` to my header.


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: source/Plugins/Process/minidump/MinidumpParser.h:67
@@ +66,3 @@
+bool m_valid_data;
+llvm::DenseMap m_directory_map;
+};

dvlahovski wrote:
> zturner wrote:
> > Can this be `llvm::DenseMap > MinidumpLocationDescriptor>`?
> > 
> > No point erasing the type information of the enum.
> If I use MinidumpStreamType as the keys type then I think I have to specify 
> the getEmptyKey() and getTombstoneKey() functions via DenseMapInfo.
> And in the "unsigned" template specialisation of DenseMapInfo:
> 
> 
> ```
> // Provide DenseMapInfo for unsigned ints.
> template<> struct DenseMapInfo {
>   static inline unsigned getEmptyKey() { return ~0U; }
>   static inline unsigned getTombstoneKey() { return ~0U - 1; }
>   static unsigned getHashValue(const unsigned& Val) { return Val * 37U; }
>   static bool isEqual(const unsigned& LHS, const unsigned& RHS) {
> return LHS == RHS;
>   }
> };
> ```
> 
> So I should probably add there "special" values in the enum as well in order 
> for it to work?
That's unfortunate, but it looks like you're right.  It's probably not worth 
going to that much effort.  It could probably be done by partially specializing 
`DenseMapInfo` for all enums, but I don't think it's worth it.  So I suppose 
it's fine to leave as a `uint32_t`.


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Dimitar Vlahovski via lldb-commits
dvlahovski added inline comments.


Comment at: source/Plugins/Process/minidump/MinidumpParser.h:67
@@ +66,3 @@
+bool m_valid_data;
+llvm::DenseMap m_directory_map;
+};

zturner wrote:
> Can this be `llvm::DenseMap`?
> 
> No point erasing the type information of the enum.
If I use MinidumpStreamType as the keys type then I think I have to specify the 
getEmptyKey() and getTombstoneKey() functions via DenseMapInfo.
And in the "unsigned" template specialisation of DenseMapInfo:


```
// Provide DenseMapInfo for unsigned ints.
template<> struct DenseMapInfo {
  static inline unsigned getEmptyKey() { return ~0U; }
  static inline unsigned getTombstoneKey() { return ~0U - 1; }
  static unsigned getHashValue(const unsigned& Val) { return Val * 37U; }
  static bool isEqual(const unsigned& LHS, const unsigned& RHS) {
return LHS == RHS;
  }
};
```

So I should probably add there "special" values in the enum as well in order 
for it to work?


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:133
@@ +132,3 @@
+// This matches the Linux kernel definitions from 
+enum MinidumpPCPUInformationARMElfHwCaps
+{

zturner wrote:
> Should this be `enum class`?
Yes, forgot to change it ...


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:259
@@ +258,3 @@
+static_assert(sizeof(MinidumpSystemInfo) == MINIDUMP_SYSTEM_INFO_SIZE, "sizeof 
MinidumpSystemInfo is not correct!");
+
+struct MinidumpMiscInfo

I think the `static_assert` is a good idea.  Since this corresponds to an on 
disk format where the size of the structure is fixed and known, the static 
assert is a good idea.  But the calculation is unnecessary I think.  It's more 
readable if someone can just look at it and say "ok it has to be 32 bytes" or 
whatever, rather than doing this math in their head.


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: source/Plugins/Process/minidump/MinidumpParser.h:67
@@ +66,3 @@
+bool m_valid_data;
+llvm::DenseMap m_directory_map;
+};

Can this be `llvm::DenseMap`?

No point erasing the type information of the enum.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.cpp:21
@@ +20,3 @@
+
+llvm::Optional
+MinidumpHeader::Parse(llvm::ArrayRef )

I think these can all just return the pointer instead of `llvm::Optional<>`.  
return `nullptr` to indicate failure.  Optionally, make the signature be 
something like `Error MinidumpHeader::Parse(llvm::ArrayRef , 
const MinidumpHeader *)` which would allow you to propagate the error up 
(if you wanted to).

At the very least though, there's no point using `llvm::Optional<>` if 
`nullptr` can be used to indicate failure.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.cpp:30
@@ +29,3 @@
+const MinidumpHeaderConstants version =
+static_cast(static_cast(header->version) & 0x);
+

Where does the `0x` come from?


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:133
@@ +132,3 @@
+// This matches the Linux kernel definitions from 
+enum MinidumpPCPUInformationARMElfHwCaps
+{

Should this be `enum class`?


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Dimitar Vlahovski via lldb-commits
dvlahovski added a comment.

In https://reviews.llvm.org/D23545#516808, @amccarth wrote:

> Are we putting this code in the right place?  I wouldn't expect minidump 
> parsing to fall under Plugins/Process.
>
> I assume the eventual intent is to turn the Windows-specific code into a user 
> of your new code?  I look forward to seeing that happen.


My idea was that the new plugin will live in Plugins/Process/minidump.
Do you have a suggestion where the parsing code to be, if not in the same 
directory?


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Dimitar Vlahovski via lldb-commits
dvlahovski added inline comments.


Comment at: source/Plugins/Process/minidump/MinidumpTypes.h:258
@@ +257,3 @@
+llvm::support::ulittle16_t processor_level;
+llvm::support::ulittle16_t processor_revision;
+

The idea of this is to be sure that the compiler didn't align stuff wrongly/not 
in the way we expect.


https://reviews.llvm.org/D23545



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


Re: [Lldb-commits] [PATCH] D23545: Minidump parsing

2016-08-18 Thread Dimitar Vlahovski via lldb-commits
dvlahovski updated this revision to Diff 68557.
dvlahovski added a comment.

Update of the code, regarding the remarks

of zturner and amccarth.


https://reviews.llvm.org/D23545

Files:
  cmake/LLDBDependencies.cmake
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/minidump/CMakeLists.txt
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/Process/minidump/MinidumpParser.h
  source/Plugins/Process/minidump/MinidumpTypes.cpp
  source/Plugins/Process/minidump/MinidumpTypes.h
  unittests/Process/CMakeLists.txt
  unittests/Process/minidump/CMakeLists.txt
  unittests/Process/minidump/Inputs/linux-x86_64.dmp
  unittests/Process/minidump/MinidumpParserTest.cpp

Index: unittests/Process/minidump/MinidumpParserTest.cpp
===
--- /dev/null
+++ unittests/Process/minidump/MinidumpParserTest.cpp
@@ -0,0 +1,87 @@
+//===-- MinidumpTypesTest.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+// Project includes
+#include "Plugins/Process/minidump/MinidumpParser.h"
+#include "Plugins/Process/minidump/MinidumpTypes.h"
+
+// Other libraries and framework includes
+#include "gtest/gtest.h"
+
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/DataExtractor.h"
+#include "lldb/Host/FileSpec.h"
+
+#include "llvm/ADT/Optional.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+
+// C includes
+
+// C++ includes
+#include 
+
+extern const char *TestMainArgv0;
+
+using namespace lldb_private;
+using namespace minidump;
+
+class MinidumpParserTest : public testing::Test
+{
+public:
+void
+SetUp() override
+{
+llvm::StringRef dmp_folder = llvm::sys::path::parent_path(TestMainArgv0);
+inputs_folder = dmp_folder;
+llvm::sys::path::append(inputs_folder, "Inputs");
+}
+
+void
+SetUpData(const char *minidump_filename)
+{
+llvm::SmallString<128> filename = inputs_folder;
+llvm::sys::path::append(filename, minidump_filename);
+FileSpec minidump_file(filename.c_str(), false);
+lldb::DataBufferSP data_sp(minidump_file.MemoryMapFileContents());
+parser.reset(new MinidumpParser(data_sp));
+ASSERT_GT(parser->GetByteSize(), 0UL);
+ASSERT_TRUE(static_cast(parser));
+}
+
+llvm::SmallString<128> inputs_folder;
+std::unique_ptr parser;
+};
+
+TEST_F(MinidumpParserTest, GetThreads)
+{
+SetUpData("linux-x86_64.dmp");
+llvm::Optional thread_list;
+
+thread_list = parser->GetThreads();
+ASSERT_TRUE(thread_list.hasValue());
+ASSERT_EQ(1UL, thread_list->size());
+
+const MinidumpThread *thread = thread_list.getValue()[0];
+ASSERT_EQ(16001UL, thread->thread_id);
+}
+
+TEST_F(MinidumpParserTest, GetArchitecture)
+{
+SetUpData("linux-x86_64.dmp");
+ASSERT_EQ(llvm::Triple::ArchType::x86_64, parser->GetArchitecture().GetTriple().getArch());
+}
+
+TEST_F(MinidumpParserTest, GetMiscInfo)
+{
+SetUpData("linux-x86_64.dmp");
+llvm::Optional misc_info = parser->GetMiscInfo();
+ASSERT_FALSE(misc_info.hasValue());
+// linux breakpad generated minidump files don't have misc info stream
+}
Index: unittests/Process/minidump/CMakeLists.txt
===
--- /dev/null
+++ unittests/Process/minidump/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_lldb_unittest(LLDBMinidumpTests
+  MinidumpParserTest.cpp
+  )
+
+set(test_inputs
+   linux-x86_64.dmp)
+
+add_unittest_inputs(LLDBMinidumpTests "${test_inputs}")
Index: unittests/Process/CMakeLists.txt
===
--- unittests/Process/CMakeLists.txt
+++ unittests/Process/CMakeLists.txt
@@ -1 +1,2 @@
 add_subdirectory(gdb-remote)
+add_subdirectory(minidump)
Index: source/Plugins/Process/minidump/MinidumpTypes.h
===
--- /dev/null
+++ source/Plugins/Process/minidump/MinidumpTypes.h
@@ -0,0 +1,298 @@
+//===-- MinidumpTypes.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_MinidumpTypes_h_
+#define liblldb_MinidumpTypes_h_
+
+// Project includes
+
+// Other libraries and framework includes
+#include "lldb/Core/Error.h"
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/BitmaskEnum.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/Support/Endian.h"
+
+// C includes
+// C++ includes
+
+// Reference:
+// 

[Lldb-commits] LLVM buildmaster will be restarted tonight

2016-08-18 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 6 PM Pacific time
today.

Thanks

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


[Lldb-commits] [lldb] r279070 - gdb-remote: Remove manual locking from GetShlibInfoAddr

2016-08-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Aug 18 09:33:55 2016
New Revision: 279070

URL: http://llvm.org/viewvc/llvm-project?rev=279070=rev
Log:
gdb-remote: Remove manual locking from GetShlibInfoAddr

The function can simply call the non-NoLock version of the SendPacket function 
and let it do the
locking.

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=279070=279069=279070=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Thu Aug 18 09:33:55 2016
@@ -2998,22 +2998,10 @@ GDBRemoteCommunicationClient::GetCurrent
 lldb::addr_t
 GDBRemoteCommunicationClient::GetShlibInfoAddr()
 {
-Lock lock(*this, false);
-if (lock)
-{
-StringExtractorGDBRemote response;
-if (SendPacketAndWaitForResponse("qShlibInfoAddr", ::strlen 
("qShlibInfoAddr"), response, false) == PacketResult::Success)
-{
-if (response.IsNormalResponse())
-return response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
-}
-}
-else if (Log *log = 
ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS | 
GDBR_LOG_PACKETS))
-{
-log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence 
mutex for qShlibInfoAddr packet.",
-__FUNCTION__);
-}
-return LLDB_INVALID_ADDRESS;
+StringExtractorGDBRemote response;
+if (SendPacketAndWaitForResponse("qShlibInfoAddr", response, false) != 
PacketResult::Success || !response.IsNormalResponse())
+return LLDB_INVALID_ADDRESS;
+return response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
 }
 
 lldb_private::Error


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


[Lldb-commits] [PATCH] D23659: Remove the last manually constructed packet from gdb-remote register context + small refactor

2016-08-18 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: clayborg.
labath added a subscriber: lldb-commits.

The tricky part here was that the exisiting implementation of WriteAllRegisters 
was expecting
hex-encoded data (as that was what the first implementation I replaced was 
using, but here we had
binary data to begin with. I thought the read/write register functions would be 
more useful if
they handled the hex-encoding themselves (all the other client functions 
provide the responses in
a more-or-less digested form). The read functions return a DataBuffer, so they 
can allocate as
much memory as they need to, while the write functions functions take an 
llvm::ArrayRef, as that
can be constructed from pretty much anything.

https://reviews.llvm.org/D23659

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Index: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -18,6 +18,9 @@
 #include "gtest/gtest.h"
 
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
+#include "lldb/Core/DataBuffer.h"
+
+#include "llvm/ADT/ArrayRef.h"
 
 using namespace lldb_private::process_gdb_remote;
 using namespace lldb_private;
@@ -54,7 +57,10 @@
 ASSERT_EQ(PacketResult::Success, server.SendPacket(response));
 }
 
-const char all_registers[] = "404142434445464748494a4b4c4d4e4f";
+uint8_t all_registers[] = {'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'};
+std::string all_registers_hex = "404142434445464748494a4b4c4d4e4f";
+uint8_t one_register[] = {'A', 'B', 'C', 'D'};
+std::string one_register_hex = "41424344";
 
 } // end anonymous namespace
 
@@ -73,16 +79,16 @@
 const lldb::tid_t tid = 0x47;
 const uint32_t reg_num = 4;
 std::future write_result =
-std::async(std::launch::async, [&] { return client.WriteRegister(tid, reg_num, "ABCD"); });
+std::async(std::launch::async, [&] { return client.WriteRegister(tid, reg_num, one_register); });
 
 Handle_QThreadSuffixSupported(server, true);
 
-HandlePacket(server, "P4=41424344;thread:0047;", "OK");
+HandlePacket(server, "P4=" + one_register_hex + ";thread:0047;", "OK");
 ASSERT_TRUE(write_result.get());
 
 write_result = std::async(std::launch::async, [&] { return client.WriteAllRegisters(tid, all_registers); });
 
-HandlePacket(server, std::string("G") + all_registers + ";thread:0047;", "OK");
+HandlePacket(server, "G" + all_registers_hex + ";thread:0047;", "OK");
 ASSERT_TRUE(write_result.get());
 }
 
@@ -97,16 +103,16 @@
 const lldb::tid_t tid = 0x47;
 const uint32_t reg_num = 4;
 std::future write_result =
-std::async(std::launch::async, [&] { return client.WriteRegister(tid, reg_num, "ABCD"); });
+std::async(std::launch::async, [&] { return client.WriteRegister(tid, reg_num, one_register); });
 
 Handle_QThreadSuffixSupported(server, false);
 HandlePacket(server, "Hg47", "OK");
-HandlePacket(server, "P4=41424344", "OK");
+HandlePacket(server, "P4=" + one_register_hex, "OK");
 ASSERT_TRUE(write_result.get());
 
 write_result = std::async(std::launch::async, [&] { return client.WriteAllRegisters(tid, all_registers); });
 
-HandlePacket(server, std::string("G") + all_registers, "OK");
+HandlePacket(server, "G" + all_registers_hex, "OK");
 ASSERT_TRUE(write_result.get());
 }
 
@@ -122,19 +128,21 @@
 const uint32_t reg_num = 4;
 std::future async_result = std::async(std::launch::async, [&] { return client.GetpPacketSupported(tid); });
 Handle_QThreadSuffixSupported(server, true);
-HandlePacket(server, "p0;thread:0047;", "41424344");
+HandlePacket(server, "p0;thread:0047;", one_register_hex);
 ASSERT_TRUE(async_result.get());
 
-StringExtractorGDBRemote response;
-async_result = std::async(std::launch::async, [&] { return client.ReadRegister(tid, reg_num, response); });
+std::future read_result =
+std::async(std::launch::async, [&] { return client.ReadRegister(tid, reg_num); });
 HandlePacket(server, "p4;thread:0047;", "41424344");
-ASSERT_TRUE(async_result.get());
-ASSERT_EQ("41424344", response.GetStringRef());
-
-async_result = std::async(std::launch::async, [&] { return client.ReadAllRegisters(tid, response); });
-HandlePacket(server, "g;thread:0047;", all_registers);

[Lldb-commits] [lldb] r279057 - Move QSyncThreadState packet generation to the gdb-remote client

2016-08-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Aug 18 07:32:41 2016
New Revision: 279057

URL: http://llvm.org/viewvc/llvm-project?rev=279057=rev
Log:
Move QSyncThreadState packet generation to the gdb-remote client

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=279057=279056=279057=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Thu Aug 18 07:32:41 2016
@@ -3582,9 +3582,22 @@ GDBRemoteCommunicationClient::RestoreReg
 }
 
 bool
-GDBRemoteCommunicationClient::GetModuleInfo (const FileSpec& module_file_spec,
- const lldb_private::ArchSpec& 
arch_spec,
- ModuleSpec _spec)
+GDBRemoteCommunicationClient::SyncThreadState(lldb::tid_t tid)
+{
+if (!GetSyncThreadStateSupported())
+return false;
+
+StreamString packet;
+StringExtractorGDBRemote response;
+packet.Printf("QSyncThreadState:%4.4" PRIx64 ";", tid);
+return SendPacketAndWaitForResponse(packet.GetString(), response, false) ==
+   GDBRemoteCommunication::PacketResult::Success &&
+   response.IsOKResponse();
+}
+
+bool
+GDBRemoteCommunicationClient::GetModuleInfo(const FileSpec _file_spec, 
const lldb_private::ArchSpec _spec,
+ModuleSpec _spec)
 {
 if (!m_supports_qModuleInfo)
 return false;

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=279057=279056=279057=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h 
Thu Aug 18 07:32:41 2016
@@ -509,6 +509,9 @@ public:
 bool
 RestoreRegisterState (lldb::tid_t tid, uint32_t save_id);
 
+bool
+SyncThreadState(lldb::tid_t tid);
+
 const char *
 GetGDBServerProgramName();
 

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=279057=279056=279057=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp 
Thu Aug 18 07:32:41 2016
@@ -334,28 +334,6 @@ GDBRemoteRegisterContext::SetPrimordialR
 reg_info->byte_size));
 }
 
-void
-GDBRemoteRegisterContext::SyncThreadState(Process *process)
-{
-// NB.  We assume our caller has locked the sequence mutex.
-
-GDBRemoteCommunicationClient _comm (((ProcessGDBRemote *) 
process)->GetGDBRemote());
-if (!gdb_comm.GetSyncThreadStateSupported())
-return;
-
-StreamString packet;
-StringExtractorGDBRemote response;
-packet.Printf ("QSyncThreadState:%4.4" PRIx64 ";", 
m_thread.GetProtocolID());
-if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
-  packet.GetString().size(),
-  response,
-  false) == 
GDBRemoteCommunication::PacketResult::Success)
-{
-if (response.IsOKResponse())
-InvalidateAllRegisters();
-}
-}
-
 bool
 GDBRemoteRegisterContext::WriteRegisterBytes (const RegisterInfo *reg_info, 
DataExtractor , uint32_t data_offset)
 {
@@ -562,7 +540,8 @@ GDBRemoteRegisterContext::ReadAllRegiste
 GDBRemoteClientBase::Lock lock(gdb_comm, false);
 if (lock)
 {
-SyncThreadState(process);
+if (gdb_comm.SyncThreadState(m_thread.GetProtocolID()))
+InvalidateAllRegisters();
 
 if (use_g_packet && 
gdb_comm.ReadAllRegisters(m_thread.GetProtocolID(), response))
 {

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
URL: 

Re: [Lldb-commits] [PATCH] D23604: gdb-remote: Centralize thread specific packet handling

2016-08-18 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279040: gdb-remote: Centralize thread specific packet 
handling (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D23604?vs=68337=68495#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23604

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -633,6 +633,10 @@
 void
 OnRunPacketSent(bool first) override;
 
+PacketResult
+SendThreadSpecificPacketAndWaitForResponse(lldb::tid_t tid, StreamString &,
+   StringExtractorGDBRemote , bool send_async);
+
 private:
 DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationClient);
 };
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -574,6 +574,31 @@
 return false;
 }
 
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunicationClient::SendThreadSpecificPacketAndWaitForResponse(lldb::tid_t tid, StreamString &,
+ StringExtractorGDBRemote ,
+ bool send_async)
+{
+Lock lock(*this, send_async);
+if (!lock)
+{
+if (Log *log = ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS | GDBR_LOG_PACKETS))
+log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence mutex for %s packet.", __FUNCTION__,
+payload.GetString().c_str());
+return PacketResult::ErrorNoSequenceLock;
+}
+
+if (GetThreadSuffixSupported())
+payload.Printf(";thread:%4.4" PRIx64 ";", tid);
+else
+{
+if (!SetCurrentThread(tid))
+return PacketResult::ErrorSendFailed;
+}
+
+return SendPacketAndWaitForResponseNoLock(payload.GetString(), response);
+}
+
 // Check if the target supports 'p' packet. It sends out a 'p'
 // packet and checks the response. A normal packet will tell us
 // that support is available.
@@ -584,18 +609,15 @@
 {
 if (m_supports_p == eLazyBoolCalculate)
 {
-StringExtractorGDBRemote response;
 m_supports_p = eLazyBoolNo;
-char packet[256];
-if (GetThreadSuffixSupported())
-snprintf(packet, sizeof(packet), "p0;thread:%" PRIx64 ";", tid);
-else
-snprintf(packet, sizeof(packet), "p0");
-
-if (SendPacketAndWaitForResponse(packet, response, false) == PacketResult::Success)
+StreamString payload;
+payload.PutCString("p0");
+StringExtractorGDBRemote response;
+if (SendThreadSpecificPacketAndWaitForResponse(tid, std::move(payload), response, false) ==
+PacketResult::Success &&
+response.IsNormalResponse())
 {
-if (response.IsNormalResponse())
-m_supports_p = eLazyBoolYes;
+m_supports_p = eLazyBoolYes;
 }
 }
 return m_supports_p;
@@ -3473,108 +3495,42 @@
 bool
 GDBRemoteCommunicationClient::ReadRegister(lldb::tid_t tid, uint32_t reg, StringExtractorGDBRemote )
 {
-Lock lock(*this, false);
-if (lock)
-{
-const bool thread_suffix_supported = GetThreadSuffixSupported();
-
-if (thread_suffix_supported || SetCurrentThread(tid))
-{
-char packet[64];
-int packet_len = 0;
-if (thread_suffix_supported)
-packet_len = ::snprintf (packet, sizeof(packet), "p%x;thread:%4.4" PRIx64 ";", reg, tid);
-else
-packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg);
-assert (packet_len < ((int)sizeof(packet) - 1));
-return SendPacketAndWaitForResponse(packet, response, false) == PacketResult::Success;
-}
-}
-else if (Log *log = ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS | GDBR_LOG_PACKETS))
-{
-log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence mutex for p packet.", __FUNCTION__);
-}
-return false;
-
+StreamString payload;
+payload.Printf("p%x", reg);
+return SendThreadSpecificPacketAndWaitForResponse(tid, std::move(payload), response, false) ==
+   

[Lldb-commits] [lldb] r279040 - gdb-remote: Centralize thread specific packet handling

2016-08-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Aug 18 03:30:03 2016
New Revision: 279040

URL: http://llvm.org/viewvc/llvm-project?rev=279040=rev
Log:
gdb-remote: Centralize thread specific packet handling

Summary:
Before this, each function had a copy of the code which handled appending of 
the thread suffix to
the packet (or using $Hg instead). I have moved that code into a single 
function and made
everyone else use that. The function takes the partial packet as a StreamString 
rvalue reference,
to avoid a copy and to remind the users that the packet will have undeterminate 
contents after
the call.

This also fixes the incorrect formatting of the QRestoreRegisterState packet in 
case thread
suffix is not supported.

Reviewers: clayborg

Subscribers: lldb-commits

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

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=279040=279039=279040=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Thu Aug 18 03:30:03 2016
@@ -574,6 +574,31 @@ GDBRemoteCommunicationClient::GetVContSu
 return false;
 }
 
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunicationClient::SendThreadSpecificPacketAndWaitForResponse(lldb::tid_t
 tid, StreamString &,
+ 
StringExtractorGDBRemote ,
+ bool 
send_async)
+{
+Lock lock(*this, send_async);
+if (!lock)
+{
+if (Log *log = 
ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS | 
GDBR_LOG_PACKETS))
+log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence 
mutex for %s packet.", __FUNCTION__,
+payload.GetString().c_str());
+return PacketResult::ErrorNoSequenceLock;
+}
+
+if (GetThreadSuffixSupported())
+payload.Printf(";thread:%4.4" PRIx64 ";", tid);
+else
+{
+if (!SetCurrentThread(tid))
+return PacketResult::ErrorSendFailed;
+}
+
+return SendPacketAndWaitForResponseNoLock(payload.GetString(), response);
+}
+
 // Check if the target supports 'p' packet. It sends out a 'p'
 // packet and checks the response. A normal packet will tell us
 // that support is available.
@@ -584,18 +609,15 @@ GDBRemoteCommunicationClient::GetpPacket
 {
 if (m_supports_p == eLazyBoolCalculate)
 {
-StringExtractorGDBRemote response;
 m_supports_p = eLazyBoolNo;
-char packet[256];
-if (GetThreadSuffixSupported())
-snprintf(packet, sizeof(packet), "p0;thread:%" PRIx64 ";", tid);
-else
-snprintf(packet, sizeof(packet), "p0");
-
-if (SendPacketAndWaitForResponse(packet, response, false) == 
PacketResult::Success)
+StreamString payload;
+payload.PutCString("p0");
+StringExtractorGDBRemote response;
+if (SendThreadSpecificPacketAndWaitForResponse(tid, 
std::move(payload), response, false) ==
+PacketResult::Success &&
+response.IsNormalResponse())
 {
-if (response.IsNormalResponse())
-m_supports_p = eLazyBoolYes;
+m_supports_p = eLazyBoolYes;
 }
 }
 return m_supports_p;
@@ -3473,108 +3495,42 @@ GDBRemoteCommunicationClient::AvoidGPack
 bool
 GDBRemoteCommunicationClient::ReadRegister(lldb::tid_t tid, uint32_t reg, 
StringExtractorGDBRemote )
 {
-Lock lock(*this, false);
-if (lock)
-{
-const bool thread_suffix_supported = GetThreadSuffixSupported();
-
-if (thread_suffix_supported || SetCurrentThread(tid))
-{
-char packet[64];
-int packet_len = 0;
-if (thread_suffix_supported)
-packet_len = ::snprintf (packet, sizeof(packet), 
"p%x;thread:%4.4" PRIx64 ";", reg, tid);
-else
-packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg);
-assert (packet_len < ((int)sizeof(packet) - 1));
-return SendPacketAndWaitForResponse(packet, response, false) == 
PacketResult::Success;
-}
-}
-else if (Log *log = 
ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS | 
GDBR_LOG_PACKETS))
-{
-log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence 
mutex for p packet.", __FUNCTION__);
-}
-

Re: [Lldb-commits] [PATCH] D23608: Fix parsing of complicated C++ names

2016-08-18 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279038: Fix parsing of complicated C++ names (authored by 
labath).

Changed prior to commit:
  https://reviews.llvm.org/D23608?vs=68344=68493#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23608

Files:
  lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/trunk/unittests/CMakeLists.txt
  lldb/trunk/unittests/Language/CMakeLists.txt
  lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt
  lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

Index: lldb/trunk/unittests/Language/CMakeLists.txt
===
--- lldb/trunk/unittests/Language/CMakeLists.txt
+++ lldb/trunk/unittests/Language/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(CPlusPlus)
Index: lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
===
--- lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -0,0 +1,41 @@
+//===-- CPlusPlusLanguageTest.cpp ---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+
+using namespace lldb_private;
+
+TEST(CPlusPlusLanguage, MethodName)
+{
+struct TestCase {
+std::string input;
+std::string context, basename, arguments, qualifiers, 
scope_qualified_name;
+};
+
+TestCase test_cases[] = {{"foo::bar(baz)", "foo", "bar", "(baz)", "", 
"foo::bar"},
+ {"std::basic_ostream& "
+  "std::operator<<"
+  "(std::basic_ostream&, char const*)",
+  "std", "operator<<",
+  "(std::basic_ostream&, char const*)", "",
+  "std::operator<<"}};
+
+for (const auto : test_cases)
+{
+CPlusPlusLanguage::MethodName method(ConstString(test.input));
+EXPECT_TRUE(method.IsValid());
+EXPECT_EQ(test.context, method.GetContext());
+EXPECT_EQ(test.basename, method.GetBasename());
+EXPECT_EQ(test.arguments, method.GetArguments());
+EXPECT_EQ(test.qualifiers, method.GetQualifiers());
+EXPECT_EQ(test.scope_qualified_name, method.GetScopeQualifiedName());
+}
+}
Index: lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt
===
--- lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt
+++ lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_lldb_unittest(LanguageCPlusPlusTests
+  CPlusPlusLanguageTest.cpp
+  )
Index: lldb/trunk/unittests/CMakeLists.txt
===
--- lldb/trunk/unittests/CMakeLists.txt
+++ lldb/trunk/unittests/CMakeLists.txt
@@ -43,6 +43,7 @@
 add_subdirectory(Expression)
 add_subdirectory(Host)
 add_subdirectory(Interpreter)
+add_subdirectory(Language)
 add_subdirectory(Process)
 add_subdirectory(ScriptInterpreter)
 add_subdirectory(Symbol)
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -220,6 +220,8 @@
 context_start = full.rfind(' ', template_start);
 if (context_start == llvm::StringRef::npos)
 context_start = 0;
+else
+++context_start;
 
 context_end = full.rfind(':', template_start);
 if (context_end == llvm::StringRef::npos || 
context_end < context_start)
@@ -240,7 +242,7 @@
 else
 {
 if (context_start < context_end)
-m_context = full.substr(context_start, context_end - 
1);
+m_context = full.substr(context_start, context_end - 1 
- context_start);
 const size_t basename_begin = context_end + 1;
 m_basename = full.substr(basename_begin, basename_end - 
basename_begin);
 }


Index: lldb/trunk/unittests/Language/CMakeLists.txt
===
--- 

[Lldb-commits] [lldb] r279038 - Fix parsing of complicated C++ names

2016-08-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Aug 18 03:21:38 2016
New Revision: 279038

URL: http://llvm.org/viewvc/llvm-project?rev=279038=rev
Log:
Fix parsing of complicated C++ names

Summary:
CPlusPlusLanguage::MethodName was not correctly parsing templated functions 
whose demangled name
included the return type -- the space before the function name was included in 
the "context" and
the context itself was not terminated correctly due to a misuse of the substr 
function (second
argument is length, not the end position). Fix that and add a regression test.

Reviewers: clayborg

Subscribers: lldb-commits

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

Added:
lldb/trunk/unittests/Language/
lldb/trunk/unittests/Language/CMakeLists.txt
lldb/trunk/unittests/Language/CPlusPlus/
lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/unittests/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp?rev=279038=279037=279038=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Thu Aug 
18 03:21:38 2016
@@ -220,6 +220,8 @@ CPlusPlusLanguage::MethodName::Parse()
 context_start = full.rfind(' ', template_start);
 if (context_start == llvm::StringRef::npos)
 context_start = 0;
+else
+++context_start;
 
 context_end = full.rfind(':', template_start);
 if (context_end == llvm::StringRef::npos || 
context_end < context_start)
@@ -240,7 +242,7 @@ CPlusPlusLanguage::MethodName::Parse()
 else
 {
 if (context_start < context_end)
-m_context = full.substr(context_start, context_end - 
1);
+m_context = full.substr(context_start, context_end - 1 
- context_start);
 const size_t basename_begin = context_end + 1;
 m_basename = full.substr(basename_begin, basename_end - 
basename_begin);
 }

Modified: lldb/trunk/unittests/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/CMakeLists.txt?rev=279038=279037=279038=diff
==
--- lldb/trunk/unittests/CMakeLists.txt (original)
+++ lldb/trunk/unittests/CMakeLists.txt Thu Aug 18 03:21:38 2016
@@ -43,6 +43,7 @@ add_subdirectory(Editline)
 add_subdirectory(Expression)
 add_subdirectory(Host)
 add_subdirectory(Interpreter)
+add_subdirectory(Language)
 add_subdirectory(Process)
 add_subdirectory(ScriptInterpreter)
 add_subdirectory(Symbol)

Added: lldb/trunk/unittests/Language/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Language/CMakeLists.txt?rev=279038=auto
==
--- lldb/trunk/unittests/Language/CMakeLists.txt (added)
+++ lldb/trunk/unittests/Language/CMakeLists.txt Thu Aug 18 03:21:38 2016
@@ -0,0 +1 @@
+add_subdirectory(CPlusPlus)

Added: lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt?rev=279038=auto
==
--- lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt (added)
+++ lldb/trunk/unittests/Language/CPlusPlus/CMakeLists.txt Thu Aug 18 03:21:38 
2016
@@ -0,0 +1,3 @@
+add_lldb_unittest(LanguageCPlusPlusTests
+  CPlusPlusLanguageTest.cpp
+  )

Added: lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp?rev=279038=auto
==
--- lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp (added)
+++ lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp Thu Aug 
18 03:21:38 2016
@@ -0,0 +1,41 @@
+//===-- CPlusPlusLanguageTest.cpp ---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+
+using namespace lldb_private;
+

[Lldb-commits] [lldb] r279039 - Fix tests for the gdb-remote memory read packets

2016-08-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Aug 18 03:21:42 2016
New Revision: 279039

URL: http://llvm.org/viewvc/llvm-project?rev=279039=rev
Log:
Fix tests for the gdb-remote memory read packets

Part of TestGDBRemoteMemoryRead has been disabled since r259379 because it was 
incompatible with
python3. This changes the test to use the lldb-server test framework, which is 
a more appropriate
method of testing raw stub behaviour anyway (and should avoid the whole python 
3 issue).

Removed:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGDBRemoteMemoryRead.py
Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGDBRemoteMemoryRead.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGDBRemoteMemoryRead.py?rev=279038=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGDBRemoteMemoryRead.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGDBRemoteMemoryRead.py
 (removed)
@@ -1,45 +0,0 @@
-"""
-Tests the binary ($x) and hex ($m) memory read packets of the remote stub
-"""
-
-from __future__ import print_function
-
-
-
-import binascii
-import os
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-from lldbsuite.test import lldbplatformutil
-
-
-class MemoryReadTestCase(TestBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-@skipUnlessPlatform(lldbplatformutil.getDarwinOSTriples()+["linux"])
-def test_memory_read(self):
-self.build()
-exe = os.path.join (os.getcwd(), "a.out")
-
-target = self.dbg.CreateTarget(exe)
-lldbutil.run_break_set_by_symbol(self, "main")
-
-process = target.LaunchSimple (None, None, 
self.get_process_working_directory())
-self.assertTrue(process, PROCESS_IS_VALID)
-self.assertEqual(process.GetState(), lldb.eStateStopped, "Process is 
stopped")
-
-pc = process.GetSelectedThread().GetSelectedFrame().GetPC()
-for size in [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]:
-error = lldb.SBError()
-memory = process.ReadMemory(pc, size, error)
-self.assertTrue(error.Success())
-# Results in trying to write non-printable characters to the 
session log.
-# self.match("process plugin packet send x%x,%x" % (pc, size), 
["response:", memory])
-self.match("process plugin packet send m%x,%x" % (pc, size), 
["response:", binascii.hexlify(memory)])
-
-process.Continue()
-self.assertEqual(process.GetState(), lldb.eStateExited, "Process 
exited")

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py?rev=279039=279038=279039=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
 Thu Aug 18 03:21:42 2016
@@ -1309,11 +1309,20 @@ class LldbGdbServerTestCase(gdbremote_te
 # Hex-encode the test message, adding null termination.
 hex_encoded_message = TEST_MESSAGE.encode("hex")
 
-# Write the message to the inferior.
+# Write the message to the inferior. Verify that we can read it with 
the hex-encoded (m)
+# and binary (x) memory read packets.
 self.reset_test_sequence()
 self.test_sequence.add_log_lines(
-["read packet: $M{0:x},{1:x}:{2}#00".format(message_address, 
len(hex_encoded_message)/2, hex_encoded_message),
+["read packet: $M{0:x},{1:x}:{2}#00".format(message_address, 
len(TEST_MESSAGE), hex_encoded_message),
  "send packet: $OK#00",
+ "read packet: $m{0:x},{1:x}#00".format(message_address, 
len(TEST_MESSAGE)),
+ "send packet: ${0}#00".format(hex_encoded_message),
+ "read packet: $x{0:x},{1:x}#00".format(message_address, 
len(TEST_MESSAGE)),
+ "send packet: ${0}#00".format(TEST_MESSAGE),
+ "read packet: $m{0:x},4#00".format(message_address),
+ "send packet: ${0}#00".format(hex_encoded_message[0:8]),
+ "read packet: $x{0:x},4#00".format(message_address),
+ "send packet: ${0}#00".format(TEST_MESSAGE[0:4]),
  "read packet: $c#63",
  { "type":"output_match", "regex":r"^message: (.+)\r\n$", 
"capture":{ 1:"printed_message"} },
  "send packet: $W00#00",


___
lldb-commits mailing list
lldb-commits@lists.llvm.org