[Lldb-commits] [PATCH] D32585: Implementation of remote packets for Trace data.

2017-05-29 Thread Ravitheja Addepally via Phabricator via lldb-commits
ravitheja added a comment.

Hello, the reason I switched to allocating with new (std::nothrow) 
uint8_t[byte_count]; was because the byte_count is actually user defined and I 
do want to catch cases where lldb is not able to allocate the requested buffer 
size.


https://reviews.llvm.org/D32585



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


[Lldb-commits] [lldb] r304138 - Added new API to SBStructuredData class

2017-05-29 Thread Abhishek Aggarwal via lldb-commits
Author: abhishek
Date: Mon May 29 03:25:46 2017
New Revision: 304138

URL: http://llvm.org/viewvc/llvm-project?rev=304138&view=rev
Log:
Added new API to SBStructuredData class

Summary:
 - Added API to access data types
-- integer, double, array, string, boolean and dictionary data types
-- Earlier user had to parse through the string output to get these
   values

 - Added Test cases for API testing

 - Added new StructuredDataType enum in public include file
   -- Replaced locally-defined enum in StructuredData.h with this new
  one   
   -- Modified other internal files using this locally-defined enum

Signed-off-by: Abhishek Aggarwal 

Reviewers: clayborg, lldb-commits

Reviewed By: clayborg

Subscribers: labath

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

Added:
lldb/trunk/packages/Python/lldbsuite/test/python_api/sbstructureddata/

lldb/trunk/packages/Python/lldbsuite/test/python_api/sbstructureddata/TestStructuredDataAPI.py
Modified:
lldb/trunk/include/lldb/API/SBStructuredData.h
lldb/trunk/include/lldb/Core/StructuredData.h
lldb/trunk/include/lldb/Core/StructuredDataImpl.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/scripts/interface/SBStructuredData.i
lldb/trunk/source/API/SBStructuredData.cpp
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/StructuredData.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Modified: lldb/trunk/include/lldb/API/SBStructuredData.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStructuredData.h?rev=304138&r1=304137&r2=304138&view=diff
==
--- lldb/trunk/include/lldb/API/SBStructuredData.h (original)
+++ lldb/trunk/include/lldb/API/SBStructuredData.h Mon May 29 03:25:46 2017
@@ -37,11 +37,70 @@ public:
 
   lldb::SBError GetDescription(lldb::SBStream &stream) const;
 
+  //--
+  /// Return the type of data in this data structure
+  //--
+  lldb::StructuredDataType GetType() const;
+
+  //--
+  /// Return the size (i.e. number of elements) in this data structure
+  /// if it is an array or dictionary type. For other types, 0 will be
+  //  returned.
+  //--
+  size_t GetSize() const;
+
+  //--
+  /// Return the value corresponding to a key if this data structure
+  /// is a dictionary type.
+  //--
+  lldb::SBStructuredData GetValueForKey(const char *key) const;
+
+  //--
+  /// Return the value corresponding to an index if this data structure
+  /// is array.
+  //--
+  lldb::SBStructuredData GetItemAtIndex(size_t idx) const;
+
+  //--
+  /// Return the integer value if this data structure is an integer type.
+  //--
+  uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
+
+  //--
+  /// Return the floating point value if this data structure is a floating
+  /// type.
+  //--
+  double GetFloatValue(double fail_value = 0.0) const;
+
+  //--
+  /// Return the boolean value if this data structure is a boolean type.
+  //--
+  bool GetBooleanValue(bool fail_value = false) const;
+
+  //--
+  /// Provides the string value if this data structure is a string type.
+  ///
+  /// @param[out] dst
+  /// pointer where the string value will be written. In case it is null,
+  /// nothing will be written at @dst.
+  ///
+  /// @param[in] dst_len
+  /// max number of characters that can be written at @dst. In case it is
+  /// zero, nothing will be written at @dst. If this length is not enough
+  /// to write the complete string value, (dst_len-1) bytes of the string
+  /// value will be written at @dst followed by a null character.
+  ///
+  /// @return
+  /// Returns the byte size needed to completely write the string value at
+  /// @dst in all cases.
+  //--
+  size_t GetStringValue(char *dst, size_t dst_len) const;
+
 protected:
   fri

[Lldb-commits] [lldb] r304142 - More StructuredData::Type::eTypeDictionary -> lldb::eStructuredDataTypeDictionary

2017-05-29 Thread Stephan Bergmann via lldb-commits
Author: sberg
Date: Mon May 29 03:51:58 2017
New Revision: 304142

URL: http://llvm.org/viewvc/llvm-project?rev=304142&view=rev
Log:
More StructuredData::Type::eTypeDictionary -> 
lldb::eStructuredDataTypeDictionary

...missing from previous r304138 "Added new API to SBStructuredData class"

Modified:

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

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.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=304142&r1=304141&r2=304142&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Mon May 29 03:51:58 2017
@@ -3278,7 +3278,7 @@ GDBRemoteCommunicationClient::SendGetTra
   auto json_object = StructuredData::ParseJSON(response.Peek());
 
   if (!json_object ||
-  json_object->GetType() != StructuredData::Type::eTypeDictionary) {
+  json_object->GetType() != lldb::eStructuredDataTypeDictionary) {
 error.SetErrorString("Invalid Configuration obtained");
 return error;
   }
@@ -3299,7 +3299,7 @@ GDBRemoteCommunicationClient::SendGetTra
   json_dict->GetValueForKey("params");
   if (custom_params_sp) {
 if (custom_params_sp->GetType() !=
-StructuredData::Type::eTypeDictionary) {
+lldb::eStructuredDataTypeDictionary) {
   error.SetErrorString("Invalid Configuration obtained");
   return error;
 } else

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=304142&r1=304141&r2=304142&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 Mon May 29 03:51:58 2017
@@ -1120,7 +1120,7 @@ GDBRemoteCommunicationServerLLGS::Handle
   auto json_object = StructuredData::ParseJSON(packet.Peek());
 
   if (!json_object ||
-  json_object->GetType() != StructuredData::Type::eTypeDictionary)
+  json_object->GetType() != lldb::eStructuredDataTypeDictionary)
 return SendIllFormedResponse(packet, "jTraceStart: Ill formed packet ");
 
   auto json_dict = json_object->GetAsDictionary();
@@ -1140,7 +1140,7 @@ GDBRemoteCommunicationServerLLGS::Handle
   StructuredData::ObjectSP custom_params_sp =
   json_dict->GetValueForKey("params");
   if (custom_params_sp &&
-  custom_params_sp->GetType() != StructuredData::Type::eTypeDictionary)
+  custom_params_sp->GetType() != lldb::eStructuredDataTypeDictionary)
 return SendIllFormedResponse(packet, "jTraceStart: Ill formed packet ");
 
   options.setTraceParams(
@@ -1182,7 +1182,7 @@ GDBRemoteCommunicationServerLLGS::Handle
   auto json_object = StructuredData::ParseJSON(packet.Peek());
 
   if (!json_object ||
-  json_object->GetType() != StructuredData::Type::eTypeDictionary)
+  json_object->GetType() != lldb::eStructuredDataTypeDictionary)
 return SendIllFormedResponse(packet, "jTraceStop: Ill formed packet ");
 
   auto json_dict = json_object->GetAsDictionary();
@@ -1219,7 +1219,7 @@ GDBRemoteCommunicationServerLLGS::Handle
   auto json_object = StructuredData::ParseJSON(packet.Peek());
 
   if (!json_object ||
-  json_object->GetType() != StructuredData::Type::eTypeDictionary)
+  json_object->GetType() != lldb::eStructuredDataTypeDictionary)
 return SendIllFormedResponse(packet,
  "jTraceConfigRead: Ill formed packet ");
 
@@ -1287,7 +1287,7 @@ GDBRemoteCommunicationServerLLGS::Handle
   auto json_object = StructuredData::ParseJSON(packet.Peek());
 
   if (!json_object ||
-  json_object->GetType() != StructuredData::Type::eTypeDictionary)
+  json_object->GetType() != lldb::eStructuredDataTypeDictionary)
 return SendIllFormedResponse(packet, "jTrace: Ill formed packet ");
 
   auto json_dict = json_object->GetAsDictionary();


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


[Lldb-commits] [lldb] r304147 - Replaced StructuredData::Type with eStructuredDataType

2017-05-29 Thread Abhishek Aggarwal via lldb-commits
Author: abhishek
Date: Mon May 29 06:13:30 2017
New Revision: 304147

URL: http://llvm.org/viewvc/llvm-project?rev=304147&view=rev
Log:
Replaced StructuredData::Type with eStructuredDataType 

...missing from r304138 "Added new API to SBStructuredData class"


Modified:
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Modified: 
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp?rev=304147&r1=304146&r2=304147&view=diff
==
--- 
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp 
(original)
+++ 
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp 
Mon May 29 06:13:30 2017
@@ -11,6 +11,7 @@
 #include "GDBRemoteTestUtils.h"
 
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
+#include "lldb/lldb-enumerations.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/StructuredData.h"
 #include "lldb/Core/TraceOptions.h"
@@ -554,7 +555,7 @@ TEST_F(GDBRemoteCommunicationClientTest,
   llvm::StringRef trace_tech_value;
 
   ASSERT_TRUE(custom_params);
-  ASSERT_EQ(custom_params->GetType(), StructuredData::Type::eTypeDictionary);
+  ASSERT_EQ(custom_params->GetType(), eStructuredDataTypeDictionary);
   ASSERT_TRUE(
   custom_params->GetValueForKeyAsInteger("psb", psb_value));
   ASSERT_EQ(psb_value, 1);
@@ -594,4 +595,4 @@ TEST_F(GDBRemoteCommunicationClientTest,
   HandlePacket(server, expected_packet, incorrect_custom_params1+
   incorrect_custom_params2);
   ASSERT_FALSE(result4.get().Success());
-}
\ No newline at end of file
+}


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


[Lldb-commits] [PATCH] D33035: Tool for using Intel(R) Processor Trace hardware feature

2017-05-29 Thread Abhishek via Phabricator via lldb-commits
abhishek.aggarwal added a comment.

In https://reviews.llvm.org/D33035#754640, @labath wrote:

> I don't really like that we are adding a public shared library for every tiny 
> intel feature. Could we at least merge this "plugin" with the existing 
> "intel-mpx plugin" to create one "intel support" library?
>
> Also, adding an external dependency probably deserves a discussion on 
> lldb-dev.


Hi Paval ... Before starting the development of this whole feature, we had 
submitted the full proposal to lldb dev list 1.5 years ago. During the 
discussions, it was proposed to keep the external dependency outside LLDB (i.e. 
not to be bundled in liblldb shared library). The External dependency required 
for this tool is not and will never be a part of lldb repository. Users who are 
interested to use this tool, will download this external dependency separately.




Comment at: tools/intel-pt/CMakeLists.txt:42
+
+add_library(lldbIntelPT SHARED
+  PTDecoder.cpp

labath wrote:
> any reason you're not using add_lldb_library here?
No. I will try with that.


https://reviews.llvm.org/D33035



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


[Lldb-commits] [lldb] r304158 - Replace forward decl with include to unbreak the build.

2017-05-29 Thread Benjamin Kramer via lldb-commits
Author: d0k
Date: Mon May 29 09:40:07 2017
New Revision: 304158

URL: http://llvm.org/viewvc/llvm-project?rev=304158&view=rev
Log:
Replace forward decl with include to unbreak the build.

Modified:
lldb/trunk/include/lldb/Utility/Log.h

Modified: lldb/trunk/include/lldb/Utility/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Log.h?rev=304158&r1=304157&r2=304158&view=diff
==
--- lldb/trunk/include/lldb/Utility/Log.h (original)
+++ lldb/trunk/include/lldb/Utility/Log.h Mon May 29 09:40:07 2017
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringMap.h" // for StringMap
 #include "llvm/ADT/StringRef.h" // for StringRef, StringLiteral
 #include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/RWMutex.h"
 
 #include 
@@ -30,9 +31,6 @@
 namespace llvm {
 class raw_ostream;
 }
-namespace llvm {
-template  class ManagedStatic;
-}
 //--
 // Logging Options
 //--


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


Re: [Lldb-commits] [lldb] r303907 - Fix bug #28898

2017-05-29 Thread Ulrich Weigand via lldb-commits


Hello,

It appears this commit broke the
EditlineTestFixture.EditlineReceivesSingleLineText
unit test on s390x-linux.  The test now simply hangs (hanging the whole
test suite
execution) ...

Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  STSM, GNU/Linux compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk
Wittkopp
  Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r303907 - Fix bug #28898

2017-05-29 Thread Kamil Rytarowski via lldb-commits
Do you offer shell account? I don't have Linux and/or s390x to debug it.

On 29.05.2017 17:17, Ulrich Weigand via lldb-commits wrote:
> Hello,
> 
> It appears this commit broke the
> EditlineTestFixture.EditlineReceivesSingleLineText
> unit test on s390x-linux.  The test now simply hangs (hanging the whole
> test suite
> execution) ...
> 
> Mit freundlichen Gruessen / Best Regards
> 
> Ulrich Weigand
> 
> -- 
> Dr. Ulrich Weigand | Phone: +49-7031/16-3727
> STSM, GNU/Linux compilers and toolchain
> IBM Deutschland Research & Development GmbH
> Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung:
> Dirk Wittkopp
> Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
> Stuttgart, HRB 243294
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 




signature.asc
Description: OpenPGP digital signature
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D32585: Implementation of remote packets for Trace data.

2017-05-29 Thread Zachary Turner via lldb-commits
I see.  In that case, at least store it in a std::unique_ptr.

On Mon, May 29, 2017 at 12:22 AM Ravitheja Addepally via Phabricator <
revi...@reviews.llvm.org> wrote:

> ravitheja added a comment.
>
> Hello, the reason I switched to allocating with new (std::nothrow)
> uint8_t[byte_count]; was because the byte_count is actually user defined
> and I do want to catch cases where lldb is not able to allocate the
> requested buffer size.
>
>
> https://reviews.llvm.org/D32585
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r303907 - Fix bug #28898

2017-05-29 Thread Ulrich Weigand via lldb-commits
Kamil Rytarowski  wrote on 29.05.2017 18:10:36:

> Do you offer shell account? I don't have Linux and/or s390x to debug it.

Sorry, this is on an internal IBM machine ... I don't have a publically
accessible machine to reproduce this on at the moment.

I managed to debug a bit myself, and I think the problem is this:

After your change, this routine:
int Editline::GetCharacter(EditLineGetCharType *c) {
now has a "wchar_t *" argument, and stores the output character
as a 4-byte wide character on Linux.

However, the caller of this routine does this (this is the Fedora 24
version of libedit - libedit-3.1-14.20150325cvs.fc24.src.rpm):

num_read = (*el->el_read.read_char)(el, cp);
if (num_read < 0)
el->el_errno = errno;
#ifdef WIDECHAR
if (el->el_flags & NARROW_READ)
*cp = *(char *)(void *)cp;
#endif

In my case, the (el->el_flags & NARROW_READ) is true, so it
accesses the wchar_t as a char and extends that to a wchar_t.

On a little-endian machine, this would be a no-op, but on a
big-endian machine, this basically always set the character
to 0.

Now, the question is why is the NARROW_READ flag set.  It
appears this is the case because the EL_GETCFN call that
installs the callback used el_set, not el_wset (that is
what triggers setting vs. clearing NARROW_READ).

The LLDB code does *appear* to use el_wset:
  el_wset(m_editline, EL_GETCFN, (EditlineGetCharCallbackType)([](
 EditLine *editline,
EditLineGetCharType *c) {
return Editline::InstanceFor(editline)->GetCharacter(c);
  }));

but that's not actually true, because of:

#if LLDB_EDITLINE_USE_WCHAR
[...]
#else
[...]
#define el_wset el_set
[...]
#endif // #if LLDB_EDITLINE_USE_WCHAR

at the top of the file.  Note that on Linux, it appears
LLDB_EDITLINE_USE_WCHAR is unconditionally set to 0:

#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) ||
\
defined(__OpenBSD__)
#define LLDB_EDITLINE_USE_WCHAR 1
#include 
#else
#define LLDB_EDITLINE_USE_WCHAR 0
#endif

So in general, it looks like the bug is that LLDB on Linux
always installs the EL_GETFCN callback using el_set, which
causes libedit to assume it actually takes a char *
argument, but LLDB now defines the routine as taking a
wchar_t * argument, which causes the character to be always
read as 0 on all big-endian Linux systems.


Is this enough information for you to fix the problem?
If you'd like me to do more debugging, please let me know.

Bye,
Ulrich

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


[Lldb-commits] How to build lldb-mi

2017-05-29 Thread Laghzaoui Mohammed via lldb-commits
Hello i need your help for building lldb-mi like static library on Mac OS.

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