Re: [Lldb-commits] [PATCH] D15182: [MIPS] Fix TestCrashDuringStep.py for MIPS

2015-12-04 Thread Pavel Labath via lldb-commits
labath accepted this revision.
labath added a reviewer: labath.
labath added a comment.
This revision is now accepted and ready to land.

Thanks.
If you wish, you can link it to the same bug as the arm xfail above, as that is 
the same underlying issue.


Repository:
  rL LLVM

http://reviews.llvm.org/D15182



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


[Lldb-commits] [lldb] r254710 - [LLDB][MIPS] XFAIL TestCrashDuringStep.py for MIPS

2015-12-04 Thread Jaydeep Patil via lldb-commits
Author: jaydeep
Date: Fri Dec  4 03:56:36 2015
New Revision: 254710

URL: http://llvm.org/viewvc/llvm-project?rev=254710&view=rev
Log:
[LLDB][MIPS] XFAIL TestCrashDuringStep.py for MIPS
SUMMARY:
Marked TestCrashDuringStep.py as XFAIL for MIPS. The test generates IO 
error due to breakpoint at invalid address.

Reviewers: clayborg, labath
Subscribers: nitesh.jain, mohit.bhakkad, sagar, bhushan and lldb-commits
Differential Revision: http://reviews.llvm.org/D15182

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py?rev=254710&r1=254709&r2=254710&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
 Fri Dec  4 03:56:36 2015
@@ -21,6 +21,7 @@ class CreateDuringStepTestCase(TestBase)
 
 @expectedFailureWindows("llvm.org/pr24778")
 @expectedFailureAndroid("llvm.org/pr24497", archs=['arm', 'aarch64'])
+@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])# 
IO error due to breakpoint at invalid address
 def test_step_inst_with(self):
 """Test thread creation during step-inst handling."""
 self.build(dictionary=self.getBuildFlags())


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


Re: [Lldb-commits] [PATCH] D15182: [MIPS] Fix TestCrashDuringStep.py for MIPS

2015-12-04 Thread Jaydeep Patil via lldb-commits
jaydeep closed this revision.
jaydeep added a comment.

Closed by commit http://reviews.llvm.org/rL254710


Repository:
  rL LLVM

http://reviews.llvm.org/D15182



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


[Lldb-commits] [lldb] r254711 - [LLDB][MIPS] Fix gdbremote_testcase.py

2015-12-04 Thread Mohit K. Bhakkad via lldb-commits
Author: mohit.bhakkad
Date: Fri Dec  4 03:58:07 2015
New Revision: 254711

URL: http://llvm.org/viewvc/llvm-project?rev=254711&view=rev
Log:
[LLDB][MIPS] Fix gdbremote_testcase.py
Patch by Nitesh Jain

Reviewers: clayborg, ovyalov.
Subscribers: jaydeep, bhushan, mohit.bhakkad, sagar.
Differential Revision: http://reviews.llvm.org/D15103

Modified:

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

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py?rev=254711&r1=254710&r2=254711&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
 Fri Dec  4 03:58:07 2015
@@ -1273,19 +1273,25 @@ class GdbRemoteTestCaseBase(TestBase):
 args["expected_g_c2"] = "0"
 (state_reached, step_count) = 
self.count_single_steps_until_true(main_thread_id, self.g_c1_c2_contents_are, 
args, max_step_count=5, use_Hc_packet=use_Hc_packet, 
step_instruction=step_instruction)
 self.assertTrue(state_reached)
-self.assertEqual(step_count, 1)
+expected_step_count = 1
+arch = self.getArchitecture()
+
+#MIPS required "3" (ADDIU, SB, LD) machine instructions for updation 
of variable value
+if re.match("mips",arch):
+   expected_step_count = 3
+self.assertEqual(step_count, expected_step_count)
 
 # Verify we hit the next state.
 args["expected_g_c1"] = "0"
 args["expected_g_c2"] = "0"
 (state_reached, step_count) = 
self.count_single_steps_until_true(main_thread_id, self.g_c1_c2_contents_are, 
args, max_step_count=5, use_Hc_packet=use_Hc_packet, 
step_instruction=step_instruction)
 self.assertTrue(state_reached)
-self.assertEqual(step_count, 1)
+self.assertEqual(step_count, expected_step_count)
 
 # Verify we hit the next state.
 args["expected_g_c1"] = "0"
 args["expected_g_c2"] = "1"
 (state_reached, step_count) = 
self.count_single_steps_until_true(main_thread_id, self.g_c1_c2_contents_are, 
args, max_step_count=5, use_Hc_packet=use_Hc_packet, 
step_instruction=step_instruction)
 self.assertTrue(state_reached)
-self.assertEqual(step_count, 1)
+self.assertEqual(step_count, expected_step_count)
 


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


Re: [Lldb-commits] [PATCH] D14952: Modify "platform connect" to connect to processes as well

2015-12-04 Thread Tamas Berghammer via lldb-commits
tberghammer retitled this revision from "Create new "platform process connect" 
command" to "Modify "platform connect" to connect to processes as well".
tberghammer updated the summary for this revision.
tberghammer updated this revision to Diff 41867.

http://reviews.llvm.org/D14952

Files:
  docs/lldb-gdb-remote.txt
  include/lldb/Target/Platform.h
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  
packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/Makefile
  
packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
  
packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/main.cpp
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
  source/Target/Platform.cpp
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h
  tools/lldb-server/lldb-platform.cpp

Index: tools/lldb-server/lldb-platform.cpp
===
--- tools/lldb-server/lldb-platform.cpp
+++ tools/lldb-server/lldb-platform.cpp
@@ -285,6 +285,12 @@
 exit(option_error);
 }
 
+// Skip any options we consumed with getopt_long_only.
+argc -= optind;
+argv += optind;
+lldb_private::Args inferior_arguments;
+inferior_arguments.SetArguments(argc, const_cast(argv));
+
 const bool children_inherit_listen_socket = false;
 // the test suite makes many connections in parallel, let's not miss any.
 // The highest this should get reasonably is a function of the number
@@ -309,15 +315,15 @@
 error = save_socket_id_to_file(acceptor_up->GetLocalSocketId(), socket_file);
 if (error.Fail())
 {
-fprintf(stderr, "failed to write socket id to %s: %s", socket_file.GetPath().c_str(), error.AsCString());
+fprintf(stderr, "failed to write socket id to %s: %s\n", socket_file.GetPath().c_str(), error.AsCString());
 return 1;
 }
 }
 
 do {
 GDBRemoteCommunicationServerPlatform platform(acceptor_up->GetSocketProtocol(),
   acceptor_up->GetSocketScheme());
-
+
 if (port_offset > 0)
 platform.SetPortOffset(port_offset);
 
@@ -365,6 +371,22 @@
 
 if (platform.IsConnected())
 {
+if (inferior_arguments.GetArgumentCount() > 0)
+{
+lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
+uint16_t port = 0;
+std::string socket_name;
+Error error = platform.LaunchGDBServer(inferior_arguments,
+   "", // hostname
+   pid,
+   port,
+   socket_name);
+if (error.Success())
+platform.SetPendingGdbServer(pid, port, socket_name);
+else
+fprintf(stderr, "failed to start gdbserver: %s\n", error.AsCString());
+}
+
 // After we connected, we need to get an initial ack from...
 if (platform.HandshakeWithClient())
 {
Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -54,6 +54,7 @@
 eServerPacketType_qGroupName,
 eServerPacketType_qHostInfo,
 eServerPacketType_qLaunchGDBServer,
+eServerPacketType_qQueryGDBServer,
 eServerPacketType_qKillSpawnedProcess,
 eServerPacketType_qLaunchSuccess,
 eServerPacketType_qModuleInfo,
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtractorGDBRemote.cpp
+++ source/Utility/StringExtractorGDBRemote.cpp
@@ -163,12 +163,12 @@
 case 'K':
 if (PACKET_STARTS_WITH ("qKillSpawnedProcess"))  

[Lldb-commits] [lldb] r254715 - Improve the functionality of JSONNumber

2015-12-04 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Dec  4 07:23:35 2015
New Revision: 254715

URL: http://llvm.org/viewvc/llvm-project?rev=254715&view=rev
Log:
Improve the functionality of JSONNumber

* Add support for representing signed integers
* Add new constructors taking any signed or unsigned integer types

Differential revision: http://reviews.llvm.org/D15187

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

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/trunk/source/Utility/JSON.cpp

Modified: lldb/trunk/include/lldb/Utility/JSON.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/JSON.h?rev=254715&r1=254714&r2=254715&view=diff
==
--- lldb/trunk/include/lldb/Utility/JSON.h (original)
+++ lldb/trunk/include/lldb/Utility/JSON.h Fri Dec  4 07:23:35 2015
@@ -97,9 +97,43 @@ namespace lldb_private {
 class JSONNumber : public JSONValue
 {
 public:
-JSONNumber ();
-explicit JSONNumber (uint64_t i);
-explicit JSONNumber (double d);
+typedef std::shared_ptr SP;
+
+// We cretae a constructor for all integer and floating point type 
with using templates and
+// SFINAE to avoid having ambiguous overloads because of the implicit 
type promotion. If we
+// would have constructors only with int64_t, uint64_t and double 
types then constructing a
+// JSONNumber from an int32_t (or any other similar type) would fail 
to compile.
+
+template ::value &&
+  std::is_unsigned::value>::type* = 
nullptr>
+explicit JSONNumber (T u) :
+JSONValue(JSONValue::Kind::Number),
+m_data_type(DataType::Unsigned)
+{
+m_data.m_unsigned = u;
+}
+
+template ::value &&
+  std::is_signed::value>::type* = 
nullptr>
+explicit JSONNumber (T s) :
+JSONValue(JSONValue::Kind::Number),
+m_data_type(DataType::Signed)
+{
+m_data.m_signed = s;
+}
+
+template ::value>::type* = nullptr>
+explicit JSONNumber (T d) :
+JSONValue(JSONValue::Kind::Number),
+m_data_type(DataType::Double)
+{
+m_data.m_double = d;
+}
+
+~JSONNumber() override = default;
 
 JSONNumber (const JSONNumber& s) = delete;
 JSONNumber&
@@ -107,32 +141,35 @@ namespace lldb_private {
 
 void
 Write(Stream& s) override;
-
-typedef std::shared_ptr SP;
 
 uint64_t
-GetData () { return m_data; }
+GetAsUnsigned() const;
+
+uint64_t
+GetAsSigned() const;
 
 double
-GetAsDouble()
-{
-if (m_is_integer)
-return (double)m_data;
-else
-return m_double;
-}
+GetAsDouble() const;
 
 static bool classof(const JSONValue *V)
 {
 return V->GetKind() == JSONValue::Kind::Number;
 }
-
-~JSONNumber() override = default;
-
+
 private:
-bool m_is_integer;
-uint64_t m_data;
-double m_double;
+enum class DataType : uint8_t
+{
+Unsigned,
+Signed,
+Double
+} m_data_type;
+
+union
+{
+uint64_t m_unsigned;
+int64_t  m_signed;
+double   m_double;
+} m_data;
 };
 
 class JSONTrue : public JSONValue

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=254715&r1=254714&r2=254715&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 Fri Dec  4 07:23:35 2015
@@ -566,7 +566,7 @@ GetJSONThreadsInfo(NativeProcessProtocol
 
 thread_obj_sp->SetObject("tid", std::make_shared(tid));
 if (signum != 0)
-thread_obj_sp->SetObject("signal", 
std::make_shared(uint64_t(signum)));
+thread_obj_sp->SetObject("signal", 
std::make_shared(signum));
 
 const std::string thread_name = thread_sp->GetName ();
 if (! thread_name.empty())

Modified: lldb/trunk/source/Utility/JSON.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/JSON.cpp?rev=254715&r1=254714&r2=254715&view=diff
==
--- lldb/trunk/source/Utility/JSON.cpp (original)
+++ lldb/trunk/source/Utility/JSON.cpp Fri Dec  4 07:23:35 2015
@@ -60,38 +60,63 @@ JSONString::Wri

Re: [Lldb-commits] [PATCH] D15187: Improve the functionality of JSONNumber

2015-12-04 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254715: Improve the functionality of JSONNumber (authored by 
tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D15187?vs=41743&id=41868#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15187

Files:
  lldb/trunk/include/lldb/Utility/JSON.h
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/trunk/source/Utility/JSON.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -566,7 +566,7 @@
 
 thread_obj_sp->SetObject("tid", std::make_shared(tid));
 if (signum != 0)
-thread_obj_sp->SetObject("signal", std::make_shared(uint64_t(signum)));
+thread_obj_sp->SetObject("signal", std::make_shared(signum));
 
 const std::string thread_name = thread_sp->GetName ();
 if (! thread_name.empty())
Index: lldb/trunk/source/Utility/JSON.cpp
===
--- lldb/trunk/source/Utility/JSON.cpp
+++ lldb/trunk/source/Utility/JSON.cpp
@@ -60,38 +60,63 @@
 s.Printf("\"%s\"", json_string_quote_metachars(m_data).c_str());
 }
 
-JSONNumber::JSONNumber () :
-JSONValue(JSONValue::Kind::Number),
-m_is_integer(true),
-m_data(0),
-m_double(0.0)
+uint64_t
+JSONNumber::GetAsUnsigned() const
 {
+switch (m_data_type)
+{
+case DataType::Unsigned:
+return m_data.m_unsigned;
+case DataType::Signed:
+return (uint64_t)m_data.m_signed;
+case DataType::Double:
+return (uint64_t)m_data.m_double;
+}
 }
 
-JSONNumber::JSONNumber (uint64_t i) :
-JSONValue(JSONValue::Kind::Number),
-m_is_integer(true),
-m_data(i),
-m_double(0.0)
+uint64_t
+JSONNumber::GetAsSigned() const
 {
+switch (m_data_type)
+{
+case DataType::Unsigned:
+return (int64_t)m_data.m_unsigned;
+case DataType::Signed:
+return m_data.m_signed;
+case DataType::Double:
+return (int64_t)m_data.m_double;
+}
 }
 
-
-JSONNumber::JSONNumber (double d) :
-JSONValue(JSONValue::Kind::Number),
-m_is_integer(false),
-m_data(0),
-m_double(d)
+double
+JSONNumber::GetAsDouble() const
 {
+switch (m_data_type)
+{
+case DataType::Unsigned:
+return (double)m_data.m_unsigned;
+case DataType::Signed:
+return (double)m_data.m_signed;
+case DataType::Double:
+return m_data.m_double;
+}
 }
 
 void
 JSONNumber::Write (Stream& s)
 {
-if (m_is_integer)
-s.Printf("%" PRIu64, m_data);
-else
-s.Printf("%g", m_double);
+switch (m_data_type)
+{
+case DataType::Unsigned:
+s.Printf("%" PRIu64, m_data.m_unsigned);
+break;
+case DataType::Signed:
+s.Printf("%" PRId64, m_data.m_signed);
+break;
+case DataType::Double:
+s.Printf("%g", m_data.m_double);
+break;
+}
 }
 
 JSONTrue::JSONTrue () :
@@ -617,10 +642,20 @@
 
 case JSONParser::Token::Integer:
 {
-bool success = false;
-uint64_t uval = StringConvert::ToUInt64(value.c_str(), 0, 0, &success);
-if (success)
-return JSONValue::SP(new JSONNumber(uval));
+if (value.front() == '-')
+{
+bool success = false;
+int64_t sval = StringConvert::ToSInt64(value.c_str(), 0, 0, &success);
+if (success)
+return JSONValue::SP(new JSONNumber(sval));
+}
+else
+{
+bool success = false;
+uint64_t uval = StringConvert::ToUInt64(value.c_str(), 0, 0, &success);
+if (success)
+return JSONValue::SP(new JSONNumber(uval));
+}
 }
 break;
 
Index: lldb/trunk/include/lldb/Utility/JSON.h
===
--- lldb/trunk/include/lldb/Utility/JSON.h
+++ lldb/trunk/include/lldb/Utility/JSON.h
@@ -97,42 +97,79 @@
 class JSONNumber : public JSONValue
 {
 public:
-JSONNumber ();
-explicit JSONNumber (uint64_t i);
-explicit JSONNumber (double d);
+typedef std::shared_ptr SP;
+
+// We cretae a constructor for all integer and floating point type with using templates and
+// SFINAE to avoid having ambiguous overloads because of the implicit type promotion. If we
+// would have constructors only with int64_t, uint64_t and double types then constructing a
+// JSONNumber from a

Re: [Lldb-commits] [PATCH] D14952: Modify "platform connect" to connect to processes as well

2015-12-04 Thread Pavel Labath via lldb-commits
labath added a comment.

Just a tiny remark from my side..



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp:184
@@ +183,3 @@
+std::string hostname;
+// TODO: /tmp/ should not be hardcoded. User might want to override /tmp
+// with the TMPDIR environment variable

The TMPDIR and "sleep" comments seem to be obsolete...


http://reviews.llvm.org/D14952



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


Re: [Lldb-commits] [PATCH] D15152: Add a new option to Platform::LoadImage to install the image

2015-12-04 Thread Tamas Berghammer via lldb-commits
tberghammer retitled this revision from "Change Platform::LoadImage to copy the 
file to the remote platform" to "Add a new option to Platform::LoadImage to 
install the image".
tberghammer updated the summary for this revision.
tberghammer updated this revision to Diff 41877.
tberghammer added a comment.

Address review comments

Note: PlatformAndroid::DoLoadImage isn't necessary because of the cleanup done 
in http://reviews.llvm.org/rL254608


http://reviews.llvm.org/D15152

Files:
  include/lldb/API/SBProcess.h
  include/lldb/Target/Platform.h
  packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
  source/API/SBProcess.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Target/Platform.cpp

Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1985,14 +1985,52 @@
 }
 
 uint32_t
-Platform::LoadImage(lldb_private::Process* process, const FileSpec& image_spec, Error& error)
+Platform::LoadImage(lldb_private::Process* process,
+const lldb_private::FileSpec& local_file,
+const lldb_private::FileSpec& remote_file,
+lldb_private::Error& error)
+{
+if (local_file && remote_file)
+{
+// Both local and remote file was specified. Install the local file to the given location.
+error = Install(local_file, remote_file);
+if (error.Fail())
+return LLDB_INVALID_IMAGE_TOKEN;
+return DoLoadImage(process, remote_file, error);
+}
+
+if (local_file)
+{
+// Only local file was specified. Install it to the current working directory.
+FileSpec target_file = GetWorkingDirectory();
+target_file.AppendPathComponent(local_file.GetFilename().AsCString());
+error = Install(local_file, target_file);
+if (error.Fail())
+return LLDB_INVALID_IMAGE_TOKEN;
+return DoLoadImage(process, target_file, error);
+}
+
+if (remote_file)
+{
+// Only remote file was specified so we don't have to do any copying
+return DoLoadImage(process, remote_file, error);
+}
+
+error.SetErrorString("Neither local nor remote file was specified");
+return LLDB_INVALID_IMAGE_TOKEN;
+}
+
+uint32_t
+Platform::DoLoadImage (lldb_private::Process* process,
+   const lldb_private::FileSpec& remote_file,
+   lldb_private::Error& error)
 {
 error.SetErrorString("LoadImage is not supported on the current platform");
 return LLDB_INVALID_IMAGE_TOKEN;
 }
 
 Error
 Platform::UnloadImage(lldb_private::Process* process, uint32_t image_token)
 {
-return Error("UnLoadImage is not supported on the current platform");
+return Error("UnloadImage is not supported on the current platform");
 }
Index: source/Plugins/Platform/POSIX/PlatformPOSIX.h
===
--- source/Plugins/Platform/POSIX/PlatformPOSIX.h
+++ source/Plugins/Platform/POSIX/PlatformPOSIX.h
@@ -174,9 +174,9 @@
 DisconnectRemote () override;
 
 uint32_t
-LoadImage (lldb_private::Process* process,
-   const lldb_private::FileSpec& image_spec,
-   lldb_private::Error& error) override;
+DoLoadImage (lldb_private::Process* process,
+ const lldb_private::FileSpec& remote_file,
+ lldb_private::Error& error) override;
 
 lldb_private::Error
 UnloadImage (lldb_private::Process* process, uint32_t image_token) override;
Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
===
--- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -898,10 +898,12 @@
 }
 
 uint32_t
-PlatformPOSIX::LoadImage(lldb_private::Process* process, const FileSpec& image_spec, Error& error)
+PlatformPOSIX::DoLoadImage(lldb_private::Process* process,
+   const lldb_private::FileSpec& remote_file,
+   lldb_private::Error& error)
 {
 char path[PATH_MAX];
-image_spec.GetPath(path, sizeof(path));
+remote_file.GetPath(path, sizeof(path));
 
 StreamString expr;
 expr.Printf(R"(
Index: source/Commands/CommandObjectProcess.cpp
===
--- source/Commands/CommandObjectProcess.cpp
+++ source/Commands/CommandObjectProcess.cpp
@@ -1174,6 +1174,57 @@
 class CommandObjectProcessLoad : public CommandObjectParsed
 {
 public:
+class CommandOptions : public Options
+{
+public:
+CommandOptions (CommandInterpreter &interpreter) :
+Options(interpreter)
+{
+// Keep default values of all options in one place: OptionParsingStarting ()
+

Re: [Lldb-commits] [PATCH] D15218: Implement GetMemoryRegionInfo for mini dumps.

2015-12-04 Thread Adrian McCarthy via lldb-commits
amccarth marked 2 inline comments as done.
amccarth added a comment.

Addressed comments.


http://reviews.llvm.org/D15218



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


Re: [Lldb-commits] [PATCH] D15218: Implement GetMemoryRegionInfo for mini dumps.

2015-12-04 Thread Adrian McCarthy via lldb-commits
amccarth updated this revision to Diff 41884.
amccarth added a comment.

Address comments.

Factored the decoding of the page protection bits to share that logic between 
the live and mini dump debugging.


http://reviews.llvm.org/D15218

Files:
  source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
  source/Plugins/Process/Windows/Common/ProcessWindows.cpp
  source/Plugins/Process/Windows/Common/ProcessWindows.h
  source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
  source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
  source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h

Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
===
--- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
+++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
@@ -23,7 +23,7 @@
 
 class ProcessWinMiniDump : public lldb_private::ProcessWindows
 {
-public:
+  public:
 static lldb::ProcessSP
 CreateInstance (lldb::TargetSP target_sp,
 lldb_private::Listener &listener,
@@ -84,15 +84,18 @@
 lldb_private::ArchSpec
 GetArchitecture();
 
-protected:
+lldb_private::Error
+GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &range_info) override;
+
+  protected:
 void
 Clear();
 
 bool
 UpdateThreadList(lldb_private::ThreadList &old_thread_list,
  lldb_private::ThreadList &new_thread_list) override;
 
-private:
+  private:
 // Describes a range of memory captured in the mini dump.
 struct Range {
   lldb::addr_t start;  // virtual address of the beginning of the range
Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
===
--- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
+++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
@@ -17,21 +17,22 @@
 #include 
 #include 
 
-#include "lldb/Core/PluginManager.h"
+#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
+#include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/State.h"
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/Log.h"
+#include "lldb/Target/DynamicLoader.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Target.h"
-#include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/UnixSignals.h"
+#include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/ConvertUTF.h"
-#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
 
 #include "ExceptionRecord.h"
 #include "ThreadWinMiniDump.h"
@@ -272,6 +273,51 @@
 return overlap;
 }
 
+Error
+ProcessWinMiniDump::GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &info)
+{
+Error error;
+size_t size;
+const auto list = reinterpret_cast(FindDumpStream(MemoryInfoListStream, &size));
+if (list == nullptr || size < sizeof(MINIDUMP_MEMORY_INFO_LIST))
+{
+error.SetErrorString("the mini dump contains no memory range information");
+return error;
+}
+
+if (list->SizeOfEntry < sizeof(MINIDUMP_MEMORY_INFO))
+{
+error.SetErrorString("the entries in the mini dump memory info list are smaller than expected");
+return error;
+}
+
+if (size < list->SizeOfHeader + list->SizeOfEntry * list->NumberOfEntries)
+{
+error.SetErrorString("the mini dump memory info list is incomplete");
+return error;
+}
+
+for (int i = 0; i < list->NumberOfEntries; ++i)
+{
+const auto entry = reinterpret_cast(reinterpret_cast(list) +
+  list->SizeOfHeader + i * list->SizeOfEntry);
+const auto head = entry->BaseAddress;
+const auto tail = head + entry->RegionSize;
+if (head <= load_addr && load_addr < tail)
+{
+info.SetReadable(IsPageReadable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+info.SetWritable(IsPageWritable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+info.SetExecutable(IsPageExecutable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+return error;
+}
+}
+// Note that the memory info list doesn't seem to contain ranges in kernel space,
+// so if you're walking a stack that has kernel frames, the stack may appear
+// truncated.
+error.SetErrorString("address is not in a known range");
+return error;
+}
+
 void
 ProcessWinMiniDump::Clear()
 {
Index: source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
=

[Lldb-commits] [PATCH] D15233: Make TestThreadStates more stable

2015-12-04 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: clayborg.
labath added a subscriber: lldb-commits.

Because of the large number of XFAILs TestThreadStates has decayed quite a bit. 
This commit does
the following:
- removes the "breakpoint list" expectations. Most tests have been failing on 
this, because the
  command output changed quite a while back. I remove it, because 
run_break_set_by_file_and_line
  already does a decent amount of checking
- fixup test_state_after_expression: this was calling the wrong function by 
mistake. As now the
  function actually tests something (which we know is broken), I needed to 
XFAIL it as well.
- replaces the sleep() with a proper wait-for-event functionality in parts 
which use async mode,
  to stabilize the one function that actually tests something.

http://reviews.llvm.org/D15233

Files:
  
packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py

Index: packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
===
--- packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
+++ packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
@@ -36,10 +36,11 @@
 @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly
 @expectedFailureDarwin('llvm.org/pr23669')
 @expectedFailureWindows("llvm.org/pr24660")
+@unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained
 def test_state_after_expression(self):
 """Test thread state after expression."""
 self.build(dictionary=self.getBuildFlags(use_cpp11=False))
-self.thread_state_after_continue_test()
+self.thread_state_after_expression_test()
 
 @unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained
 @expectedFailureWindows("llvm.org/pr24668") # Breakpoints not resolved correctly
@@ -70,10 +71,6 @@
 # This should create a breakpoint in the main thread.
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoint with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown correctly",
-substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -102,6 +99,12 @@
 # Kill the process
 self.runCmd("process kill")
 
+def wait_for_running_event(self):
+listener = self.dbg.GetListener()
+if lldb.remote_platform:
+lldbutil.expect_state_changes(self, listener, [lldb.eStateConnected])
+lldbutil.expect_state_changes(self, listener, [lldb.eStateRunning])
+
 def thread_state_after_continue_test(self):
 """Test thread state after continue."""
 exe = os.path.join(os.getcwd(), "a.out")
@@ -111,10 +114,6 @@
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoints with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown correctly",
-substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -139,7 +138,7 @@
 # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change.
 self.dbg.SetAsync(True)
 self.runCmd("continue")
-time.sleep(1)
+self.wait_for_running_event()
 
 # Check the thread state. It should be running.
 self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when it should be running.")
@@ -160,10 +159,6 @@
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoints with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown correctly",
-substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -204,10 +199,6 @@
 # This should create a breakpoint in the main thread.
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoints with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown correctly",
-substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
-
 #

Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2015-12-04 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Looking at this now.


http://reviews.llvm.org/D15209



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


Re: [Lldb-commits] [PATCH] D15175: Fix breakpoint language filtering for other C variants (like C99) and Pascal.

2015-12-04 Thread Jim Ingham via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

OK.  It would have been better to make a patch that fixes the specific problem 
with other C variants.  That's just a straight up bug, and mixing it with 
comments on the two separate issues, actually determining the language 
correctly and target language setting vrs. breakpoint language setting, 
confuses the real point of the patch.  Adding in the rename further obscures 
the issue.  We might get into a debate about the name, revert the patch, and 
end up re-introducing the actual bug you fixed...


Repository:
  rL LLVM

http://reviews.llvm.org/D15175



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


Re: [Lldb-commits] [PATCH] D14952: Modify "platform connect" to connect to processes as well

2015-12-04 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

So my main issue with this is the new virtual 
"Platform::GetPendingGdbServerList(...)" function. Can we remove this function 
and just put the functionality into Platform::ContectRemote()?



Comment at: include/lldb/Target/Platform.h:1029-1030
@@ -1021,1 +1028,4 @@
 
+virtual size_t
+GetPendingGdbServerList(std::vector& connection_urls);
+

Why is something GDB server specific in Platform.h? There has to be a better 
way.


Comment at: source/Commands/CommandObjectPlatform.cpp:413-429
@@ -413,1 +412,19 @@
+result.SetStatus (eReturnStatusSuccessFinishResult);
+
+std::vector connection_urls;
+platform_sp->GetPendingGdbServerList (connection_urls);
+for (const auto& url : connection_urls)
+{
+platform_sp->ConnectProcess(url.c_str(),
+nullptr,
+m_interpreter.GetDebugger(),
+nullptr,
+error);
+if (error.Fail())
+{
+result.AppendError(error.AsCString());
+result.SetStatus (eReturnStatusFailed);
+break;
+}
+}
 }

This should just be done inside ConnectRemote so we don't have to expose 
GetPendingGdbServerList() which is GDB remote specific. If we can't do this 
functionality inside ConnectRemote we need to add a more suitable abstract API 
that is protocol agnostic.


Comment at: source/Plugins/Platform/POSIX/PlatformPOSIX.h:191-192
@@ +190,4 @@
+
+size_t
+GetPendingGdbServerList(std::vector& connection_urls) 
override;
+

Remove and move functionality into ConnectRemote()


http://reviews.llvm.org/D14952



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


Re: [Lldb-commits] [PATCH] D15152: Add a new option to Platform::LoadImage to install the image

2015-12-04 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Add header doc for the new LoadImage and make Platform::LoadImage virtual in 
case platforms want to override this and this is good to go.



Comment at: include/lldb/API/SBProcess.h:301-307
@@ +300,9 @@
+
+// Load an image to the currently running process.
+// If both local and remote image is specified then copy the local image 
to the remote image and
+// then load it from thew remote path.
+// If only the local image is specified then the image will be copied to 
the current working
+// directory and opened from there.
+// If only the remote image is specified then open the image from the 
target (no compying done
+// in this case)
+uint32_t

Add correct header doc for this if we are going to add documentation to the 
header file.


Comment at: include/lldb/Target/Platform.h:1023-1027
@@ -1013,6 +1022,7 @@
 //--
-virtual uint32_t
+uint32_t
 LoadImage (lldb_private::Process* process,
-   const lldb_private::FileSpec& image_spec,
+   const lldb_private::FileSpec& local_file,
+   const lldb_private::FileSpec& remote_file,
lldb_private::Error& error);
 

This can still be virtual just in case other platforms want to do something 
completely different that what is supported in the default implementation.


http://reviews.llvm.org/D15152



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


Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2015-12-04 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.
This revision is now accepted and ready to land.

Hey Zachary,

As best as I can tell, we don't need to do anything here, at least not on OS X 
El Capitan, because six is already included in the OS X Python distribution.

I was scratching my head for a while to figure out why, but that seems to be it.

I'd be okay with leaving this as is without any Xcode change.  I will be 
cleaning up the "finish" step of the python script handling, much like I did 
for the front end a few weeks ago.  When I do that, Xcode will switch to the 
finisher, and will pick up the "lldb official" in-repo version of six we're 
using.  I'd rather not create the extra work of addressing "which six" at this 
point given that other pending work.

All the tests run on a clean build after with no new errors.  (OS X right now 
seems to have one error and one failure on a clean public system at this point, 
but that is not a result of this change).  I also exercised the in-lldb script 
handling and that seemed to be working.


http://reviews.llvm.org/D15209



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


Re: [Lldb-commits] [PATCH] D15218: Implement GetMemoryRegionInfo for mini dumps.

2015-12-04 Thread Adrian McCarthy via lldb-commits
amccarth updated this revision to Diff 41898.
amccarth added a comment.

After discussion with Zach, we concluded that his original logic for 
IsPageReadable was better.


http://reviews.llvm.org/D15218

Files:
  source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
  source/Plugins/Process/Windows/Common/ProcessWindows.cpp
  source/Plugins/Process/Windows/Common/ProcessWindows.h
  source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
  source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
  source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h

Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
===
--- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
+++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
@@ -23,7 +23,7 @@
 
 class ProcessWinMiniDump : public lldb_private::ProcessWindows
 {
-public:
+  public:
 static lldb::ProcessSP
 CreateInstance (lldb::TargetSP target_sp,
 lldb_private::Listener &listener,
@@ -84,15 +84,18 @@
 lldb_private::ArchSpec
 GetArchitecture();
 
-protected:
+lldb_private::Error
+GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &range_info) override;
+
+  protected:
 void
 Clear();
 
 bool
 UpdateThreadList(lldb_private::ThreadList &old_thread_list,
  lldb_private::ThreadList &new_thread_list) override;
 
-private:
+  private:
 // Describes a range of memory captured in the mini dump.
 struct Range {
   lldb::addr_t start;  // virtual address of the beginning of the range
Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
===
--- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
+++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
@@ -17,21 +17,22 @@
 #include 
 #include 
 
-#include "lldb/Core/PluginManager.h"
+#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
+#include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/State.h"
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/Log.h"
+#include "lldb/Target/DynamicLoader.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Target.h"
-#include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/UnixSignals.h"
+#include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/ConvertUTF.h"
-#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
 
 #include "ExceptionRecord.h"
 #include "ThreadWinMiniDump.h"
@@ -272,6 +273,51 @@
 return overlap;
 }
 
+Error
+ProcessWinMiniDump::GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &info)
+{
+Error error;
+size_t size;
+const auto list = reinterpret_cast(FindDumpStream(MemoryInfoListStream, &size));
+if (list == nullptr || size < sizeof(MINIDUMP_MEMORY_INFO_LIST))
+{
+error.SetErrorString("the mini dump contains no memory range information");
+return error;
+}
+
+if (list->SizeOfEntry < sizeof(MINIDUMP_MEMORY_INFO))
+{
+error.SetErrorString("the entries in the mini dump memory info list are smaller than expected");
+return error;
+}
+
+if (size < list->SizeOfHeader + list->SizeOfEntry * list->NumberOfEntries)
+{
+error.SetErrorString("the mini dump memory info list is incomplete");
+return error;
+}
+
+for (int i = 0; i < list->NumberOfEntries; ++i)
+{
+const auto entry = reinterpret_cast(reinterpret_cast(list) +
+  list->SizeOfHeader + i * list->SizeOfEntry);
+const auto head = entry->BaseAddress;
+const auto tail = head + entry->RegionSize;
+if (head <= load_addr && load_addr < tail)
+{
+info.SetReadable(IsPageReadable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+info.SetWritable(IsPageWritable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+info.SetExecutable(IsPageExecutable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+return error;
+}
+}
+// Note that the memory info list doesn't seem to contain ranges in kernel space,
+// so if you're walking a stack that has kernel frames, the stack may appear
+// truncated.
+error.SetErrorString("address is not in a known range");
+return error;
+}
+
 void
 ProcessWinMiniDump::Clear()
 {
Index: source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp

[Lldb-commits] [lldb] r254743 - Fill in the generic register kind if in AugmentRegisterInfoViaABI if it is available.

2015-12-04 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Fri Dec  4 12:37:48 2015
New Revision: 254743

URL: http://llvm.org/viewvc/llvm-project?rev=254743&view=rev
Log:
Fill in the generic register kind if in AugmentRegisterInfoViaABI if it is 
available.

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=254743&r1=254742&r2=254743&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Dec  
4 12:37:48 2015
@@ -529,16 +529,21 @@ AugmentRegisterInfoViaABI (RegisterInfo
 RegisterInfo abi_reg_info;
 if (abi_sp->GetRegisterInfoByName (reg_name, abi_reg_info))
 {
-if (reg_info.kinds[eRegisterKindEHFrame] == LLDB_INVALID_REGNUM
-&& abi_reg_info.kinds[eRegisterKindEHFrame] != 
LLDB_INVALID_REGNUM)
+if (reg_info.kinds[eRegisterKindEHFrame] == 
LLDB_INVALID_REGNUM &&
+abi_reg_info.kinds[eRegisterKindEHFrame] != 
LLDB_INVALID_REGNUM)
 {
 reg_info.kinds[eRegisterKindEHFrame] = 
abi_reg_info.kinds[eRegisterKindEHFrame];
 }
-if (reg_info.kinds[eRegisterKindDWARF] == LLDB_INVALID_REGNUM
-&& abi_reg_info.kinds[eRegisterKindDWARF] != 
LLDB_INVALID_REGNUM)
+if (reg_info.kinds[eRegisterKindDWARF] == LLDB_INVALID_REGNUM 
&&
+abi_reg_info.kinds[eRegisterKindDWARF] != 
LLDB_INVALID_REGNUM)
 {
 reg_info.kinds[eRegisterKindDWARF] = 
abi_reg_info.kinds[eRegisterKindDWARF];
 }
+if (reg_info.kinds[eRegisterKindGeneric] == 
LLDB_INVALID_REGNUM &&
+abi_reg_info.kinds[eRegisterKindGeneric] != 
LLDB_INVALID_REGNUM)
+{
+reg_info.kinds[eRegisterKindGeneric] = 
abi_reg_info.kinds[eRegisterKindGeneric];
+}
 }
 }
 }


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


[Lldb-commits] [lldb] r254744 - Fix test error in TestObjCCheckers.py

2015-12-04 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Fri Dec  4 12:40:34 2015
New Revision: 254744

URL: http://llvm.org/viewvc/llvm-project?rev=254744&view=rev
Log:
Fix test error in TestObjCCheckers.py

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py?rev=254744&r1=254743&r2=254744&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py
 Fri Dec  4 12:40:34 2015
@@ -68,7 +68,7 @@ class ObjCCheckerTestCase(TestBase):
 
 # Make sure the call produced no NSLog stdout.
 stdout = process.GetSTDOUT(100)
-self.assertTrue (len(stdout) == 0)
+self.assertTrue (stdout is None or (len(stdout) == 0))
 
 # Make sure the error is helpful:
 err_string = expr_error.GetCString()


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


[Lldb-commits] [lldb] r254746 - Marked TestModulesInlineFunctions.py XFAIL

2015-12-04 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Fri Dec  4 12:52:02 2015
New Revision: 254746

URL: http://llvm.org/viewvc/llvm-project?rev=254746&view=rev
Log:
Marked TestModulesInlineFunctions.py XFAIL

Tracked here:
https://llvm.org/bugs/show_bug.cgi?id=25743

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py?rev=254746&r1=254745&r2=254746&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
 Fri Dec  4 12:52:02 2015
@@ -26,6 +26,7 @@ class ModulesInlineFunctionsTestCase(Tes
 
 @skipUnlessDarwin
 @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') 
> platform.release(), "Only supported on Darwin 12.0.0+")
+@expectedFailureDarwin("llvm.org/pr25743")
 def test_expr(self):
 self.build()
 exe = os.path.join(os.getcwd(), "a.out")


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


Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3

2015-12-04 Thread Zachary Turner via lldb-commits
Thanks, I'll commit this later today then.

On Fri, Dec 4, 2015 at 10:25 AM Todd Fiala  wrote:

> tfiala accepted this revision.
> tfiala added a comment.
> This revision is now accepted and ready to land.
>
> Hey Zachary,
>
> As best as I can tell, we don't need to do anything here, at least not on
> OS X El Capitan, because six is already included in the OS X Python
> distribution.
>
> I was scratching my head for a while to figure out why, but that seems to
> be it.
>
> I'd be okay with leaving this as is without any Xcode change.  I will be
> cleaning up the "finish" step of the python script handling, much like I
> did for the front end a few weeks ago.  When I do that, Xcode will switch
> to the finisher, and will pick up the "lldb official" in-repo version of
> six we're using.  I'd rather not create the extra work of addressing "which
> six" at this point given that other pending work.
>
> All the tests run on a clean build after with no new errors.  (OS X right
> now seems to have one error and one failure on a clean public system at
> this point, but that is not a result of this change).  I also exercised the
> in-lldb script handling and that seemed to be working.
>
>
> http://reviews.llvm.org/D15209
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r254753 - Fix breakpoint language filtering for other C variants (like C99) and Pascal.

2015-12-04 Thread Dawn Perchik via lldb-commits
Author: dperchik
Date: Fri Dec  4 13:34:00 2015
New Revision: 254753

URL: http://llvm.org/viewvc/llvm-project?rev=254753&view=rev
Log:
Fix breakpoint language filtering for other C variants (like C99) and Pascal.

This patch fixes setting breakpoints on symbol for variants of C and
Pascal where the language is "unknown" within the filter-by-language
process added in r252356. It also renames GetLanguageForSymbolByName to
GuessLanguageForSymbolByName and adds comments explaining the pitfalls
of the flawed assumption that the language can be determined solely from
the name and target.

Reviewed by: jingham
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D15175

Modified:
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
lldb/trunk/source/Target/LanguageRuntime.cpp

Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=254753&r1=254752&r2=254753&view=diff
==
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Fri Dec  4 13:34:00 2015
@@ -118,7 +118,7 @@ public:
 }
 
 static lldb::LanguageType
-GetLanguageForSymbolByName (Target &target, const char *symbol_name);
+GuessLanguageForSymbolByName (Target &target, const char *symbol_name);
 
 Target&
 GetTargetRef()

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=254753&r1=254752&r2=254753&view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Fri Dec  4 13:34:00 
2015
@@ -279,8 +279,9 @@ BreakpointResolverName::SearchCallback(S
 const char *name = 
sc.GetFunctionName(Mangled::ePreferMangled).AsCString();
 if (name)
 {
-LanguageType sym_language = 
LanguageRuntime::GetLanguageForSymbolByName(target, name);
-if (m_language == eLanguageTypeC)
+LanguageType sym_language = 
LanguageRuntime::GuessLanguageForSymbolByName(target, name);
+if (Language::LanguageIsC(m_language) ||
+Language::LanguageIsPascal(m_language))
 {
 // We don't currently have a way to say "This symbol 
name is C" so for now, C means
 // not ObjC and not C++, etc...
@@ -293,6 +294,12 @@ BreakpointResolverName::SearchCallback(S
 }
 else if (sym_language != m_language)
 {
+// Note: This code prevents us from being able to find 
symbols
+// like 'printf' if the target language's option is 
set.  It
+// would be better to limit this filtering to only 
when the
+// breakpoint's language option is set (and not the 
target's),
+// but we can't know if m_language was set from the 
target or
+// breakpoint option.
 remove_it = true;
 }
 }

Modified: lldb/trunk/source/Target/LanguageRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=254753&r1=254752&r2=254753&view=diff
==
--- lldb/trunk/source/Target/LanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/LanguageRuntime.cpp Fri Dec  4 13:34:00 2015
@@ -347,15 +347,20 @@ LanguageRuntime::CreateExceptionSearchFi
 }
 
 lldb::LanguageType
-LanguageRuntime::GetLanguageForSymbolByName (Target &target, const char 
*symbol_name)
+LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char 
*symbol_name)
 {
-// This is not the right way to do this.  Different targets could have 
different ways of mangling names
-// from a given language.  So we should ask the various LanguageRuntime 
plugin instances for this target
-// to recognize the name.  But right now the plugin instances depend on 
the process, not the target.
-// That is unfortunate, because I want to use this for filtering 
breakpoints by language, and so I need to know
-// the "language for symbol-name" prior to running.  So we'd have to make 
a "LanguageRuntimeTarget" and
-// "LanguageRuntimeProcess", and direct the questions that don't need a 
running process to the former, and that
-// do to the latter.
+// We "guess" the language because we can't determine a symbol's language 
from it's name.
+// For example, a P

Re: [Lldb-commits] [PATCH] D15175: Fix breakpoint language filtering for other C variants (like C99) and Pascal.

2015-12-04 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254753: Fix breakpoint language filtering for other C 
variants (like C99) and Pascal. (authored by dperchik).

Changed prior to commit:
  http://reviews.llvm.org/D15175?vs=41713&id=41902#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15175

Files:
  lldb/trunk/include/lldb/Target/LanguageRuntime.h
  lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
  lldb/trunk/source/Target/LanguageRuntime.cpp

Index: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
===
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
@@ -279,8 +279,9 @@
 const char *name = 
sc.GetFunctionName(Mangled::ePreferMangled).AsCString();
 if (name)
 {
-LanguageType sym_language = 
LanguageRuntime::GetLanguageForSymbolByName(target, name);
-if (m_language == eLanguageTypeC)
+LanguageType sym_language = 
LanguageRuntime::GuessLanguageForSymbolByName(target, name);
+if (Language::LanguageIsC(m_language) ||
+Language::LanguageIsPascal(m_language))
 {
 // We don't currently have a way to say "This symbol 
name is C" so for now, C means
 // not ObjC and not C++, etc...
@@ -293,6 +294,12 @@
 }
 else if (sym_language != m_language)
 {
+// Note: This code prevents us from being able to find 
symbols
+// like 'printf' if the target language's option is 
set.  It
+// would be better to limit this filtering to only 
when the
+// breakpoint's language option is set (and not the 
target's),
+// but we can't know if m_language was set from the 
target or
+// breakpoint option.
 remove_it = true;
 }
 }
Index: lldb/trunk/source/Target/LanguageRuntime.cpp
===
--- lldb/trunk/source/Target/LanguageRuntime.cpp
+++ lldb/trunk/source/Target/LanguageRuntime.cpp
@@ -347,15 +347,20 @@
 }
 
 lldb::LanguageType
-LanguageRuntime::GetLanguageForSymbolByName (Target &target, const char 
*symbol_name)
+LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char 
*symbol_name)
 {
-// This is not the right way to do this.  Different targets could have 
different ways of mangling names
-// from a given language.  So we should ask the various LanguageRuntime 
plugin instances for this target
-// to recognize the name.  But right now the plugin instances depend on 
the process, not the target.
-// That is unfortunate, because I want to use this for filtering 
breakpoints by language, and so I need to know
-// the "language for symbol-name" prior to running.  So we'd have to make 
a "LanguageRuntimeTarget" and
-// "LanguageRuntimeProcess", and direct the questions that don't need a 
running process to the former, and that
-// do to the latter.
+// We "guess" the language because we can't determine a symbol's language 
from it's name.
+// For example, a Pascal symbol can be mangled using the C++ Itanium 
scheme, and defined
+// in a compilation unit within the same module as other C++ units.
+//
+// In addition, different targets could have different ways of mangling 
names from a given
+// language, likewise compilation units within those targets.  It would 
help to be able to
+// ask the various LanguageRuntime plugin instances for this target to 
recognize the name,
+// but right now the plugin instances depend on the process, not the 
target.  That is
+// unfortunate, because to use this for filtering breakpoints by language, 
we need to know
+// the "language for symbol-name" prior to running.  So we'd have to make a
+// "LanguageRuntimeTarget" and "LanguageRuntimeProcess", and direct the 
questions that don't
+// need a running process to the former, and that do to the latter.
 //
 // That's more work than I want to do for this feature.
 if (CPlusPlusLanguage::IsCPPMangledName (symbol_name))
Index: lldb/trunk/include/lldb/Target/LanguageRuntime.h
===
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h
@@ -118,7 +118,7 @@
 }
 
 static lldb::LanguageType
-GetLanguageForSymbolByName (Target &target, const char *symbol_name);
+GuessLanguageForSymbolByName (Target &target, const char *symbol_name);
 
 Target&
 GetTargetRef()


Index: lldb/trunk/source/Bre

[Lldb-commits] [lldb] r254755 - Add a benchmark that validates how much time LLDB spends trying to fully print a fairly large std::list

2015-12-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Dec  4 13:40:26 2015
New Revision: 254755

URL: http://llvm.org/viewvc/llvm-project?rev=254755&view=rev
Log:
Add a benchmark that validates how much time LLDB spends trying to fully print 
a fairly large std::list

This is meant to help me track optimizations to the libc++ std::list data 
formatter


Added:
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/Makefile

lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/TestBenchmarkLibcxxList.py
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/main.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/Makefile?rev=254755&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/Makefile 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/Makefile 
Fri Dec  4 13:40:26 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/TestBenchmarkLibcxxList.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/TestBenchmarkLibcxxList.py?rev=254755&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/TestBenchmarkLibcxxList.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/TestBenchmarkLibcxxList.py
 Fri Dec  4 13:40:26 2015
@@ -0,0 +1,59 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+
+import os, time
+import lldb
+from lldbsuite.test.lldbbench import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class TestBenchmarkLibcxxList(BenchBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@benchmarks_test
+def test_run_command(self):
+"""Benchmark the std::list data formatter (libc++)"""
+self.build()
+self.data_formatter_commands()
+
+def setUp(self):
+# Call super's setUp().
+BenchBase.setUp(self)
+
+def data_formatter_commands(self):
+"""Benchmark the std::list data formatter (libc++)"""
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+bkpt = 
self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, 
"break here"))
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs = ['stopped',
+   'stop reason = breakpoint'])
+
+# This is the function to remove the custom formats in order to have a
+# clean slate for the next test case.
+def cleanup():
+self.runCmd('type format clear', check=False)
+self.runCmd('type summary clear', check=False)
+self.runCmd('type filter clear', check=False)
+self.runCmd('type synth clear', check=False)
+self.runCmd("settings set target.max-children-count 256", 
check=False)
+
+# Execute the cleanup function during test case tear down.
+self.addTearDownHook(cleanup)
+
+sw = Stopwatch()
+
+sw.start()
+self.expect('frame variable -A list', substrs=['[300]', '300'])
+sw.stop()
+
+print("time to print: %s" % (sw))

Added: lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/main.cpp?rev=254755&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/main.cpp 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxlist/main.cpp 
Fri Dec  4 13:40:26 2015
@@ -0,0 +1,11 @@
+#include 
+
+int main()
+{
+std::list list;
+for (int i = 0;
+i < 1500;
+i++)
+list.push_back(i);
+return list.size(); // break here
+}


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


Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.

2015-12-04 Thread Dawn Perchik via lldb-commits
dawn added a comment.

In http://reviews.llvm.org/D12809#301752, @sivachandra wrote:

> @dawn: Thanks for accepting the patch. I guess I still need to wait for 
> sign-off/comments from a CODE_OWNER.


Yeah.  Maybe add more proactive reviewers?   And definitely be a squeaky wheel 
about it.  Keep adding reviewers and spamming them until someone gets irritated 
enough to have a look :)


http://reviews.llvm.org/D12809



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


[Lldb-commits] [lldb] r254757 - Improve the std::list data formatter to not need to calculate indices for every loop iteration

2015-12-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Dec  4 13:48:08 2015
New Revision: 254757

URL: http://llvm.org/viewvc/llvm-project?rev=254757&view=rev
Log:
Improve the std::list data formatter to not need to calculate indices for every 
loop iteration

This saves about 5 seconds on a 1500 elements list from my local estimates


Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp?rev=254757&r1=254756&r2=254757&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp Fri Dec  4 
13:48:08 2015
@@ -31,6 +31,9 @@ namespace {
 
 class ListEntry
 {
+private:
+static const std::initializer_list __prev_idx;
+static const std::initializer_list __next_idx;
 public:
 ListEntry() = default;
 ListEntry (ValueObjectSP entry_sp) : m_entry_sp(entry_sp) {}
@@ -42,7 +45,7 @@ namespace {
 {
 if (!m_entry_sp)
 return ListEntry();
-return 
ListEntry(m_entry_sp->GetChildMemberWithName(ConstString("__next_"), true));
+return ListEntry(m_entry_sp->GetChildAtIndexPath({0,1}));
 }
 
 ListEntry
@@ -50,7 +53,7 @@ namespace {
 {
 if (!m_entry_sp)
 return ListEntry();
-return 
ListEntry(m_entry_sp->GetChildMemberWithName(ConstString("__prev_"), true));
+return ListEntry(m_entry_sp->GetChildAtIndexPath({0,0}));
 }
 
 uint64_t
@@ -321,7 +324,7 @@ lldb_private::formatters::LibcxxStdListS
 ValueObjectSP current_sp(current.advance(idx));
 if (!current_sp)
 return lldb::ValueObjectSP();
-current_sp = current_sp->GetChildMemberWithName(ConstString("__value_"), 
true);
+current_sp = current_sp->GetChildAtIndex(1, true); // get the __value_ 
child
 if (!current_sp)
 return lldb::ValueObjectSP();
 // we need to copy current_sp into a new object otherwise we will end up 
with all items named __value_


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


[Lldb-commits] [lldb] r254758 - Fix an issue where all tests marked with skip_if_callable would be skipped regardless of the actual callable

2015-12-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Dec  4 13:50:05 2015
New Revision: 254758

URL: http://llvm.org/viewvc/llvm-project?rev=254758&view=rev
Log:
Fix an issue where all tests marked with skip_if_callable would be skipped 
regardless of the actual callable

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py?rev=254758&r1=254757&r2=254758&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py Fri Dec  4 13:50:05 
2015
@@ -985,10 +985,11 @@ class PrintableRegex(object):
 def __repr__(self):
 return "re.compile(%s) -> %s" % (self.text, self.regex)
 
-def skip_if_callable(test, callable, reason):
-if six.callable(test):
-test.skipTest(reason)
-return True
+def skip_if_callable(test, mycallable, reason):
+if six.callable(mycallable):
+if mycallable(test):
+test.skipTest(reason)
+return True
 return False
 
 def skip_if_library_missing(test, target, library):


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


[Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Zachary Turner via lldb-commits
zturner created this revision.
zturner added reviewers: jingham, labath.
zturner added a subscriber: lldb-commits.

This test would fail before if conditional breakpoints weren't
working correctly, and the nature of the test (spinning up 10
threads, etc) opens the door to raciness.

This patch vastly simplifies the test, removes the need for relying
on conditional expression evaluation, and as a result makes the
correctness of the test vastly easier to reason about and reduces
flakiness.

This test also used to pass on Windows only when the inferior was
compiled with a specific version of MSVC, even though I could verify
from inside of LLDB that thread-specific breakpoints don't work.  With
this patch, the test now correctly fails no matter what version of MSVC
the inferior was compiled with.

Jim: Since the test still fails for me even after this patch, can you verify 
that
it does not regress anything on OSX?  I think it's a better test overall, so as
long as it doesn't regress anything anywhere I think it should probably go in.

http://reviews.llvm.org/D15241

Files:
  
packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
  
packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp

Index: packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp
===
--- packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp
+++ packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp
@@ -1,39 +1,20 @@
 #include 
 #include 
-#include 
 
-void *
-thread_function (void *thread_marker)
+void
+thread_function ()
 {
-int keep_going = 1; 
-int my_value = *((int *)thread_marker);
-int counter = 0;
-
-while (counter < 20)
-{
-counter++; // Break here in thread body.
-std::this_thread::sleep_for(std::chrono::microseconds(10));
-}
-return NULL;
+// Set thread-specific breakpoint here.
+std::this_thread::sleep_for(std::chrono::microseconds(100));
 }
 
-
 int 
 main ()
 {
-std::vector threads;
-
-int thread_value = 0;
-int i;
-
-for (i = 0; i < 10; i++)
-{
-thread_value += 1;
-threads.push_back(std::thread(thread_function, &thread_value));
-}
-
-for (i = 0; i < 10; i++)
-threads[i].join();
+// Set main breakpoint here.
+std::thread t(thread_function);
+t.join();
 
+thread_function();
 return 0;
 }
Index: packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
===
--- packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
+++ packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
@@ -19,46 +19,48 @@
 @skipIfFreeBSD # test frequently times out or hangs
 @expectedFailureFreeBSD('llvm.org/pr18522') # hits break in another thread in testrun
 @add_test_categories(['pyapi'])
+@expectedFailureWindows # Thread specific breakpoints cause the inferior to crash
 @expectedFlakeyLinux # this test fails 6/100 dosep runs
 def test_python(self):
 """Test that we obey thread conditioned breakpoints."""
 self.build()
 exe = os.path.join(os.getcwd(), "a.out")
 
-self.dbg.HandleCommand ("log enable -f /tmp/lldb-testsuite-log.txt lldb step breakpoint process") 
 target = self.dbg.CreateTarget(exe)
 self.assertTrue(target, VALID_TARGET)
 
+# This test works by setting a breakpoint in a function conditioned to stop only on
+# the main thread, and then calling this function on a secondary thread, joining,
+# and then calling again on the main thread.  If the thread specific breakpoint works
+# then it should not be hit on the secondary thread, only on the main thread.
+
 main_source_spec = lldb.SBFileSpec ("main.cpp")
 
-# Set a breakpoint in the thread body, and make it active for only the first thread.
-break_thread_body = target.BreakpointCreateBySourceRegex ("Break here in thread body.", main_source_spec)
-self.assertTrue (break_thread_body.IsValid() and break_thread_body.GetNumLocations() > 0, "Failed to set thread body breakpoint.")
+main_breakpoint = target.BreakpointCreateBySourceRegex("Set main breakpoint here", main_source_spec);
+thread_breakpoint = target.BreakpointCreateBySourceRegex("Set thread-specific breakpoint here", main_source_spec)
+
+self.assertTrue(main_breakpoint.IsValid(), "Failed to set main breakpoint.")
+self.assertGreater(main_breakpoint.GetNumLocations(), 0, "main breakpoint has no locations associated with it.")
+self.assertTrue(thread_brea

[Lldb-commits] [lldb] r254762 - Cache the incremental iterators as you traverse the list, so that you don't have to keep recomputing them

2015-12-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Dec  4 14:12:46 2015
New Revision: 254762

URL: http://llvm.org/viewvc/llvm-project?rev=254762&view=rev
Log:
Cache the incremental iterators as you traverse the list, so that you don't 
have to keep recomputing them

If memory turns out to be a problem, which I don't think it will in practice 
because all these ValueObjects, we'd be keeping alive anyway, I can always 
resort to caching the farthest-most iterator only

This gains us an order of magnitude in my benchmark, cutting the time to 
traverse a 1500-elements list from 22 seconds down to 2


Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp?rev=254762&r1=254761&r2=254762&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp Fri Dec  4 
14:12:46 2015
@@ -31,9 +31,6 @@ namespace {
 
 class ListEntry
 {
-private:
-static const std::initializer_list __prev_idx;
-static const std::initializer_list __next_idx;
 public:
 ListEntry() = default;
 ListEntry (ValueObjectSP entry_sp) : m_entry_sp(entry_sp) {}
@@ -102,6 +99,64 @@ namespace {
 private:
 ValueObjectSP m_entry_sp;
 };
+
+class ListIterator
+{
+public:
+ListIterator() = default;
+ListIterator (ListEntry entry) : m_entry(entry) {}
+ListIterator (ValueObjectSP entry) : m_entry(entry) {}
+ListIterator (const ListIterator& rhs) : m_entry(rhs.m_entry) {}
+ListIterator (ValueObject* entry) : m_entry(entry) {}
+
+ValueObjectSP
+value ()
+{
+return m_entry.GetEntry();
+}
+
+ValueObjectSP
+advance (size_t count)
+{
+if (count == 0)
+return m_entry.GetEntry();
+if (count == 1)
+{
+next ();
+return m_entry.GetEntry();
+}
+while (count > 0)
+{
+next ();
+count--;
+if (m_entry.null())
+return lldb::ValueObjectSP();
+}
+return m_entry.GetEntry();
+}
+
+bool
+operator == (const ListIterator& rhs) const
+{
+return (rhs.m_entry == m_entry);
+}
+
+protected:
+void
+next ()
+{
+m_entry = m_entry.next();
+}
+
+void
+prev ()
+{
+m_entry = m_entry.prev();
+}
+
+private:
+ListEntry m_entry;
+};
 
 } // end anonymous namespace
 
@@ -146,68 +201,11 @@ namespace lldb_private {
 CompilerType m_element_type;
 size_t m_count;
 std::map m_children;
+std::map m_iterators;
 };
 } // namespace formatters
 } // namespace lldb_private
 
-class ListIterator
-{
-public:
-ListIterator() = default;
-ListIterator (ListEntry entry) : m_entry(entry) {}
-ListIterator (ValueObjectSP entry) : m_entry(entry) {}
-ListIterator (const ListIterator& rhs) : m_entry(rhs.m_entry) {}
-ListIterator (ValueObject* entry) : m_entry(entry) {}
-
-ValueObjectSP
-value ()
-{
-return m_entry.GetEntry();
-}
-
-ValueObjectSP
-advance (size_t count)
-{
-if (count == 0)
-return m_entry.GetEntry();
-if (count == 1)
-{
-next ();
-return m_entry.GetEntry();
-}
-while (count > 0)
-{
-next ();
-count--;
-if (m_entry.null())
-return lldb::ValueObjectSP();
-}
-return m_entry.GetEntry();
-}
-
-bool
-operator == (const ListIterator& rhs) const
-{
-return (rhs.m_entry == m_entry);
-}
-
-protected:
-void
-next ()
-{
-m_entry = m_entry.next();
-}
-
-void
-prev ()
-{
-m_entry = m_entry.prev();
-}
-
-private:
-ListEntry m_entry;
-};
-
 
lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::LibcxxStdListSyntheticFrontEnd
 (lldb::ValueObjectSP valobj_sp) :
 SyntheticChildrenFrontEnd(*valobj_sp.get()),
 m_list_capping_size(0),
@@ -217,7 +215,8 @@ m_head(NULL),
 m_tail(NULL),
 m_element_type(),
 m_count(UINT32_MAX),
-m_children()
+m_children(),
+m_iterators()
 {
 if (valobj_sp)
 Update();
@@ -319,11 +318,26 @@ lldb_private::formatters::LibcxxStdListS
 
 if (HasLoop(idx+1))
 return lldb::ValueObjectSP();
-
+
+size_t actual_advance = idx;
+
 ListIterator current(m_head);
-ValueObjectSP

Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Jim Ingham via lldb-commits
jingham added a comment.

Oh, wait, in your patch, the line in the test file that sets the thread on the 
supposedly thread specific breakpoint is commented out???

If I uncomment that line, then the test passes.


http://reviews.llvm.org/D15241



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


[Lldb-commits] [lldb] r254763 - Add documentation for SBTarget::CreateValueFromAddress.

2015-12-04 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Dec  4 14:16:51 2015
New Revision: 254763

URL: http://llvm.org/viewvc/llvm-project?rev=254763&view=rev
Log:
Add documentation for SBTarget::CreateValueFromAddress.

Modified:
lldb/trunk/scripts/interface/SBTarget.i

Modified: lldb/trunk/scripts/interface/SBTarget.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTarget.i?rev=254763&r1=254762&r2=254763&view=diff
==
--- lldb/trunk/scripts/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/interface/SBTarget.i Fri Dec  4 14:16:51 2015
@@ -695,6 +695,24 @@ public:
 lldb::SBBroadcaster
 GetBroadcaster () const;
   
+ %feature("docstring", "
+//--
+/// Create an SBValue with the given name by treating the memory starting 
at addr as an entity of type.
+///
+/// @param[in] name
+/// The name of the resultant SBValue
+///
+/// @param[in] addr
+/// The address of the start of the memory region to be used.
+///
+/// @param[in] type
+/// The type to use to interpret the memory starting at addr.
+///
+/// @return
+/// An SBValue of the given type, may be invalid if there was an error 
reading
+/// the underlying memory.
+//--
+") CreateValueFromAddress;
 lldb::SBValue
 CreateValueFromAddress (const char *name, lldb::SBAddress addr, 
lldb::SBType type);
 


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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Zachary Turner via lldb-commits
zturner added a comment.

Ahh, derp.  I commented that out when I was testing something locally, and 
forgot to uncomment it.  So yea, that should be uncommented.

I was having some trouble following the logic of the original test, so it's 
possible this test misses an edge case that I haven't thought of.  Does it look 
to you like it handles everything?


http://reviews.llvm.org/D15241



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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Jim Ingham via lldb-commits
jingham added a comment.

The logic was:

- Set a breakpoint on some loop that will get hit multiple times in some thread 
worker function.
- The first time it is hit, make it specific to the thread that hit it by 
setting a Thread ID on the breakpoint.
- Then add a condition to the breakpoint that all the other threads will pass, 
but the thread that matches the thread specification will fail.
- Then continue, and there should be no more breakpoint hits.

So the original test really tested that the combinations "breakpoint thread ID 
doesn't pass, but condition does" and "breakpoint thread ID passes, but 
breakpoint condition doesn't" work properly.

Making sure such combinations function as expected seems like a good thing to 
test, so I don't think we should remove this test.

But it would also be good to have a test JUST on the thread specification.  So 
I'd be happy to have this as an extra test.


http://reviews.llvm.org/D15241



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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Zachary Turner via lldb-commits
zturner added a comment.

Wouldn't the functionality that's tested by that combination of two things at 
the same be equivalently tested by this test, plus a test that only tests the 
behavior of conditional breakpoints?

In other words, if you had two tests, one which only tests thread specific 
breakpoints, and one which only tests conditional breakpoints, then wouldn't 
the original test which tests both at the same time always pass?  The two 
features are kind of independent of each other aren't they?  So I wouldn't 
imagine that you could have TestConditionalBreakpoint and 
TestThreadspecificBreakpoint both pass, but 
TestConditionalBreakpointWithThreadSpecificBreakpoint fail.


http://reviews.llvm.org/D15241



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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Zachary Turner via lldb-commits
zturner added a comment.

Also the origianl test as written was either flaky or disabled on almost every 
platform, so it doesn't seem like it was providing much value to anyone.


http://reviews.llvm.org/D15241



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


[Lldb-commits] [lldb] r254768 - Fix typo in a comment

2015-12-04 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Fri Dec  4 15:23:24 2015
New Revision: 254768

URL: http://llvm.org/viewvc/llvm-project?rev=254768&view=rev
Log:
Fix typo in a comment

Modified:
lldb/trunk/source/Core/IOHandler.cpp

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=254768&r1=254767&r2=254768&view=diff
==
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Fri Dec  4 15:23:24 2015
@@ -2214,7 +2214,7 @@ type summary add -s "${var.origin%S} ${v
 {
 // Run the action on this menu in case we need to populate the
 // menu with dynamic content and also in case check marks, and
-// any other menu decorations need to be caclulated
+// any other menu decorations need to be calculated
 if (run_menu_sp->Action() == MenuActionResult::Quit)
 return eQuitApplication;
 


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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Jim Ingham via lldb-commits
jingham added a comment.

The test that test "Only breakpoint conditions" will always have 
LLDB_INVALID_ID for the breakpoint thread ID.  That means the thread test is a 
no-op.  So it doesn't test the case "thread passes, condition doesn't" or 
"condition passes, thread doesn't".  I wrote this test because I didn't do 
those combinations correctly at some point and wanted to make sure they didn't 
regress.

Do you have an example of a fail when it is flakey?  This doesn't seem like a 
particularly sensitive test, other than it runs a bunch of threads through a 
bunch of breakpoints so it might just time out overall.

But it is a pretty simple test.  Grab the first thread that hits a breakpoint, 
set a condition and thread ID on the breakpoint, and continue and you should 
just run to exit.

If it is just timing out over-all that's probably just because I made it pass 
too many times through the worker loop.  You could probably either reduce the 
number of threads from 10 to something smaller, or reduce the number of times 
through the loop from 20 to something smaller.


http://reviews.llvm.org/D15241



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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Jim Ingham via lldb-commits
jingham added a comment.

It doesn't require any thread rendezvousing or anything fancy like that.


http://reviews.llvm.org/D15241



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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Zachary Turner via lldb-commits
zturner added a comment.

I don't have any examples, one of the linux guys might.  But you can look at 
the decorators at the top, which say this:

  @skipIfFreeBSD # test frequently times out or hangs
  @expectedFailureFreeBSD('llvm.org/pr18522') # hits break in another thread in 
testrun
  @expectedFlakeyLinux # this test fails 6/100 dosep runs

So the only platform it seems to be robust on is OSX, for whatever reason.  
Sadly I don't have any more info than that though.


http://reviews.llvm.org/D15241



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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Zachary Turner via lldb-commits
zturner added a comment.

For now I'll just make this a separate test in the same file I guess.  But it's 
a bummer to have a test that's broken almost everywhere.  Makes me think 
something is wrong with the test instead of with LLDB.  I agree with you though 
that it's not obvious what might be wrong with the test.


http://reviews.llvm.org/D15241



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


[Lldb-commits] [lldb] r254779 - Add a similar benchmark for our std::map performance

2015-12-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Dec  4 16:16:14 2015
New Revision: 254779

URL: http://llvm.org/viewvc/llvm-project?rev=254779&view=rev
Log:
Add a similar benchmark for our std::map performance


Added:
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/Makefile

lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/main.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/Makefile?rev=254779&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/Makefile 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/Makefile Fri 
Dec  4 16:16:14 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py?rev=254779&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py
 Fri Dec  4 16:16:14 2015
@@ -0,0 +1,59 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+
+import os, time
+import lldb
+from lldbsuite.test.lldbbench import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class TestBenchmarkLibcxxMap(BenchBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@benchmarks_test
+def test_run_command(self):
+"""Benchmark the std::map data formatter (libc++)"""
+self.build()
+self.data_formatter_commands()
+
+def setUp(self):
+# Call super's setUp().
+BenchBase.setUp(self)
+
+def data_formatter_commands(self):
+"""Benchmark the std::map data formatter (libc++)"""
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+bkpt = 
self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, 
"break here"))
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs = ['stopped',
+   'stop reason = breakpoint'])
+
+# This is the function to remove the custom formats in order to have a
+# clean slate for the next test case.
+def cleanup():
+self.runCmd('type format clear', check=False)
+self.runCmd('type summary clear', check=False)
+self.runCmd('type filter clear', check=False)
+self.runCmd('type synth clear', check=False)
+self.runCmd("settings set target.max-children-count 256", 
check=False)
+
+# Execute the cleanup function during test case tear down.
+self.addTearDownHook(cleanup)
+
+sw = Stopwatch()
+
+sw.start()
+self.expect('frame variable -A map', substrs=['[300]', '300'])
+sw.stop()
+
+print("time to print: %s" % (sw))

Added: lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/main.cpp?rev=254779&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/main.cpp 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/benchmarks/libcxxmap/main.cpp Fri 
Dec  4 16:16:14 2015
@@ -0,0 +1,11 @@
+#include 
+
+int main()
+{
+std::map map;
+for (int i = 0;
+i < 1500;
+i++)
+map[i] = i;
+return map.size(); // break here
+}


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


[Lldb-commits] [lldb] r254780 - Implement GetMemoryRegionInfo for mini dumps.

2015-12-04 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Fri Dec  4 16:22:15 2015
New Revision: 254780

URL: http://llvm.org/viewvc/llvm-project?rev=254780&view=rev
Log:
Implement GetMemoryRegionInfo for mini dumps.

Differential Revision: http://reviews.llvm.org/D15218

Modified:
lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h
lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp?rev=254780&r1=254779&r2=254780&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp Fri Dec  4 
16:22:15 2015
@@ -39,7 +39,8 @@ SaveMiniDump(const lldb::ProcessSP &proc
 return false;
 }
 HANDLE file_handle = ::CreateFileW(wide_name.c_str(), GENERIC_WRITE, 
FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-const auto result = ::MiniDumpWriteDump(process_handle, 
process_sp->GetID(), file_handle, MiniDumpNormal, NULL, NULL, NULL);
+const auto result = ::MiniDumpWriteDump(process_handle, 
process_sp->GetID(), file_handle,
+MiniDumpWithFullMemoryInfo, NULL, 
NULL, NULL);
 ::CloseHandle(file_handle);
 ::CloseHandle(process_handle);
 if (!result)

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=254780&r1=254779&r2=254780&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Fri Dec 
 4 16:22:15 2015
@@ -15,6 +15,7 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/State.h"
+#include "lldb/Host/windows/windows.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/Target.h"
@@ -74,4 +75,26 @@ ProcessWindows::GetImageInfoAddress()
 return LLDB_INVALID_ADDRESS;
 }
 
+// The Windows page protection bits are NOT independent masks that can be 
bitwise-ORed
+// together.  For example, PAGE_EXECUTE_READ is not (PAGE_EXECUTE | PAGE_READ).
+// To test for an access type, it's necessary to test for any of the bits that 
provide
+// that access type.
+bool
+ProcessWindows::IsPageReadable(uint32_t protect)
+{
+return (protect & PAGE_NOACCESS) == 0;
+}
+
+bool
+ProcessWindows::IsPageWritable(uint32_t protect)
+{
+return (protect & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY | 
PAGE_READWRITE | PAGE_WRITECOPY)) != 0;
+}
+
+bool
+ProcessWindows::IsPageExecutable(uint32_t protect)
+{
+return (protect & (PAGE_EXECUTE | PAGE_EXECUTE_READ | 
PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY)) != 0;
+}
+
 }

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h?rev=254780&r1=254779&r2=254780&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h Fri Dec  
4 16:22:15 2015
@@ -34,6 +34,17 @@ public:
 size_t PutSTDIN(const char *buf, size_t buf_size, lldb_private::Error 
&error) override;
 
 lldb::addr_t GetImageInfoAddress() override;
+
+protected:
+// These decode the page protection bits.
+static bool
+IsPageReadable(uint32_t protect);
+
+static bool
+IsPageWritable(uint32_t protect);
+
+static bool
+IsPageExecutable(uint32_t protect);
 };
 
 }

Modified: lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp?rev=254780&r1=254779&r2=254780&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp Fri 
Dec  4 16:22:15 2015
@@ -743,12 +743,13 @@ ProcessWindowsLive::GetMemoryRegionInfo(
  error.GetError(), vm_addr);
 return error;
 }
-bool readable = !(mem_info.Protect &

Re: [Lldb-commits] [PATCH] D15218: Implement GetMemoryRegionInfo for mini dumps.

2015-12-04 Thread Adrian McCarthy via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254780: Implement GetMemoryRegionInfo for mini dumps. 
(authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D15218?vs=41898&id=41940#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15218

Files:
  lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
  lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
  lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h
  lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
  lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
  lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h

Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
@@ -17,21 +17,22 @@
 #include 
 #include 
 
-#include "lldb/Core/PluginManager.h"
+#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
+#include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/State.h"
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/Log.h"
+#include "lldb/Target/DynamicLoader.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Target.h"
-#include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/UnixSignals.h"
+#include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/ConvertUTF.h"
-#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
 
 #include "ExceptionRecord.h"
 #include "ThreadWinMiniDump.h"
@@ -272,6 +273,51 @@
 return overlap;
 }
 
+Error
+ProcessWinMiniDump::GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &info)
+{
+Error error;
+size_t size;
+const auto list = reinterpret_cast(FindDumpStream(MemoryInfoListStream, &size));
+if (list == nullptr || size < sizeof(MINIDUMP_MEMORY_INFO_LIST))
+{
+error.SetErrorString("the mini dump contains no memory range information");
+return error;
+}
+
+if (list->SizeOfEntry < sizeof(MINIDUMP_MEMORY_INFO))
+{
+error.SetErrorString("the entries in the mini dump memory info list are smaller than expected");
+return error;
+}
+
+if (size < list->SizeOfHeader + list->SizeOfEntry * list->NumberOfEntries)
+{
+error.SetErrorString("the mini dump memory info list is incomplete");
+return error;
+}
+
+for (int i = 0; i < list->NumberOfEntries; ++i)
+{
+const auto entry = reinterpret_cast(reinterpret_cast(list) +
+  list->SizeOfHeader + i * list->SizeOfEntry);
+const auto head = entry->BaseAddress;
+const auto tail = head + entry->RegionSize;
+if (head <= load_addr && load_addr < tail)
+{
+info.SetReadable(IsPageReadable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+info.SetWritable(IsPageWritable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+info.SetExecutable(IsPageExecutable(entry->Protect) ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo);
+return error;
+}
+}
+// Note that the memory info list doesn't seem to contain ranges in kernel space,
+// so if you're walking a stack that has kernel frames, the stack may appear
+// truncated.
+error.SetErrorString("address is not in a known range");
+return error;
+}
+
 void
 ProcessWinMiniDump::Clear()
 {
Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
===
--- lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
+++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
@@ -23,7 +23,7 @@
 
 class ProcessWinMiniDump : public lldb_private::ProcessWindows
 {
-public:
+  public:
 static lldb::ProcessSP
 CreateInstance (lldb::TargetSP target_sp,
 lldb_private::Listener &listener,
@@ -84,15 +84,18 @@
 lldb_private::ArchSpec
 GetArchitecture();
 
-protected:
+lldb_private::Error
+GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &range_info) override;
+
+  protected:
 void
 Clear();
 
 bool
 UpdateThreadList(lldb_private::ThreadList &old_thread_list,
  lldb_private::ThreadList &new_thread_list) override;
 
-private:
+  private:
 // Describes a range

[Lldb-commits] [lldb] r254781 - Do the same iterator caching optimization for std::map

2015-12-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Dec  4 16:25:52 2015
New Revision: 254781

URL: http://llvm.org/viewvc/llvm-project?rev=254781&view=rev
Log:
Do the same iterator caching optimization for std::map

This brings the timings down for 1500 elements from 166 to 2 seconds on my 
machine - if I can math correctly, that is a 98% improvement


Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp?rev=254781&r1=254780&r2=254781&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp Fri Dec  4 
16:25:52 2015
@@ -27,47 +27,6 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-namespace lldb_private {
-namespace formatters {
-class LibcxxStdMapSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-{
-public:
-LibcxxStdMapSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-~LibcxxStdMapSyntheticFrontEnd() override = default;
-
-size_t
-CalculateNumChildren() override;
-
-lldb::ValueObjectSP
-GetChildAtIndex(size_t idx) override;
-
-bool
-Update() override;
-
-bool
-MightHaveChildren() override;
-
-size_t
-GetIndexOfChildWithName(const ConstString &name) override;
-
-private:
-bool
-GetDataType();
-
-void
-GetValueOffset (const lldb::ValueObjectSP& node);
-
-ValueObject* m_tree;
-ValueObject* m_root_node;
-CompilerType m_element_type;
-uint32_t m_skip_size;
-size_t m_count;
-std::map m_children;
-};
-} // namespace formatters
-} // namespace lldb_private
-
 class MapEntry
 {
 public:
@@ -180,7 +139,7 @@ public:
 }
 return m_entry.GetEntry();
 }
-
+
 protected:
 void
 next ()
@@ -211,7 +170,7 @@ protected:
 }
 m_entry = MapEntry(m_entry.parent());
 }
-
+
 private:
 MapEntry
 tree_min (MapEntry&& x)
@@ -235,7 +194,7 @@ private:
 }
 return x;
 }
-
+
 bool
 is_left_child (const MapEntry& x)
 {
@@ -251,6 +210,48 @@ private:
 bool m_error;
 };
 
+namespace lldb_private {
+namespace formatters {
+class LibcxxStdMapSyntheticFrontEnd : public SyntheticChildrenFrontEnd
+{
+public:
+LibcxxStdMapSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+~LibcxxStdMapSyntheticFrontEnd() override = default;
+
+size_t
+CalculateNumChildren() override;
+
+lldb::ValueObjectSP
+GetChildAtIndex(size_t idx) override;
+
+bool
+Update() override;
+
+bool
+MightHaveChildren() override;
+
+size_t
+GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+bool
+GetDataType();
+
+void
+GetValueOffset (const lldb::ValueObjectSP& node);
+
+ValueObject* m_tree;
+ValueObject* m_root_node;
+CompilerType m_element_type;
+uint32_t m_skip_size;
+size_t m_count;
+std::map m_children;
+std::map m_iterators;
+};
+} // namespace formatters
+} // namespace lldb_private
+
 
lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::LibcxxStdMapSyntheticFrontEnd
 (lldb::ValueObjectSP valobj_sp) :
 SyntheticChildrenFrontEnd(*valobj_sp.get()),
 m_tree(NULL),
@@ -258,7 +259,8 @@ m_root_node(NULL),
 m_element_type(),
 m_skip_size(UINT32_MAX),
 m_count(UINT32_MAX),
-m_children()
+m_children(),
+m_iterators()
 {
 if (valobj_sp)
 Update();
@@ -328,10 +330,22 @@ lldb_private::formatters::LibcxxStdMapSy
 auto cached = m_children.find(idx);
 if (cached != m_children.end())
 return cached->second;
-
-bool need_to_skip = (idx > 0);
+
 MapIterator iterator(m_root_node, CalculateNumChildren());
-ValueObjectSP iterated_sp(iterator.advance(idx));
+
+const bool need_to_skip = (idx > 0);
+size_t actual_advancde = idx;
+if (need_to_skip)
+{
+auto cached_iterator = m_iterators.find(idx-1);
+if (cached_iterator != m_iterators.end())
+{
+iterator = cached_iterator->second;
+actual_advancde = 1;
+}
+}
+
+ValueObjectSP iterated_sp(iterator.advance(actual_advancd

Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Jim Ingham via lldb-commits
jingham added a comment.

The comments in llvm.org/pr18522 seem to me to be bugs that the test is 
uncovering, not bugs in the test itself.  It looks like we hit a breakpoint on 
thread A, and try to run the condition on thread B.  In some cases, thread B 
isn't really alive yet, and so the attempt to add a stack frame to it fails.  
But the whole code path down from StopInfoBreakpoint::PerformAction down to 
UserExpression::Execute etc all take an execution context that specifies the 
thread.  So I'm not sure how this would happen.  It also seems like sometimes 
they were getting spurious interrupts that were being interpreted as breakpoint 
hits.  That's again clearly a bug in the platform layer.

This is a really simple test at the Python level, though it does trigger some 
complex behavior under the hood.  If it is failing just because it is taking 
too long for the test timeout, then that should get fixed once Todd does his 
"run the tests that failed and are marked flakey one by one after the main run 
is over" work.  But in the meantime it wouldn't hurt to reduce the amount of 
work it does, and see if that clears up at least the timeouts.

But some of the comments in that PR make it sound like it is uncovering actual 
bugs in handling breakpoint conditions in multi-threaded programs.  It looked 
like in the discussion, the test is failing AFTER the continue, at which point 
all the test is doing is to wait for the program to stop running.  So that must 
be some real bug in handling breakpoint conditions.  In that case for sure the 
answer is to fix the code not the test.  And of course, those bugs are going to 
make testing "many threads x ANYTHING x breakpoint conditions" fail, regardless 
of what ANYTHING is...

OTOH it makes sense to add a test for JUST breakpoint thread ID's, since that 
we do seem to be able to handle reliably on more systems.


http://reviews.llvm.org/D15241



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


[Lldb-commits] [lldb] r254787 - Reduce memory traffic in ConstString in the std::map formatter

2015-12-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Dec  4 16:49:27 2015
New Revision: 254787

URL: http://llvm.org/viewvc/llvm-project?rev=254787&view=rev
Log:
Reduce memory traffic in ConstString in the std::map formatter

Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp?rev=254787&r1=254786&r2=254787&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp Fri Dec  4 
16:49:27 2015
@@ -269,14 +269,17 @@ m_iterators()
 size_t
 lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::CalculateNumChildren 
()
 {
+static ConstString g___pair3_("__pair3_");
+static ConstString g___first_("__first_");
+
 if (m_count != UINT32_MAX)
 return m_count;
 if (m_tree == NULL)
 return 0;
-ValueObjectSP 
m_item(m_tree->GetChildMemberWithName(ConstString("__pair3_"), true));
+ValueObjectSP m_item(m_tree->GetChildMemberWithName(g___pair3_, true));
 if (!m_item)
 return 0;
-m_item = m_item->GetChildMemberWithName(ConstString("__first_"), true);
+m_item = m_item->GetChildMemberWithName(g___first_, true);
 if (!m_item)
 return 0;
 m_count = m_item->GetValueAsUnsigned(0);
@@ -286,6 +289,8 @@ lldb_private::formatters::LibcxxStdMapSy
 bool
 lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType()
 {
+static ConstString g___value_("__value_");
+
 if (m_element_type.GetOpaqueQualType() && m_element_type.GetTypeSystem())
 return true;
 m_element_type.Clear();
@@ -294,7 +299,7 @@ lldb_private::formatters::LibcxxStdMapSy
 deref = m_root_node->Dereference(error);
 if (!deref || error.Fail())
 return false;
-deref = deref->GetChildMemberWithName(ConstString("__value_"), true);
+deref = deref->GetChildMemberWithName(g___value_, true);
 if (!deref)
 return false;
 m_element_type = deref->GetCompilerType();
@@ -320,6 +325,7 @@ lldb_private::formatters::LibcxxStdMapSy
 {
 static ConstString g___cc("__cc");
 static ConstString g___nc("__nc");
+static ConstString g___value_("__value_");
 
 
 if (idx >= CalculateNumChildren())
@@ -364,7 +370,7 @@ lldb_private::formatters::LibcxxStdMapSy
 return lldb::ValueObjectSP();
 }
 GetValueOffset(iterated_sp);
-iterated_sp = 
iterated_sp->GetChildMemberWithName(ConstString("__value_"), true);
+iterated_sp = iterated_sp->GetChildMemberWithName(g___value_, 
true);
 if (!iterated_sp)
 {
 m_tree = NULL;
@@ -438,14 +444,16 @@ lldb_private::formatters::LibcxxStdMapSy
 bool
 lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::Update()
 {
+static ConstString g___tree_("__tree_");
+static ConstString g___begin_node_("__begin_node_");
 m_count = UINT32_MAX;
 m_tree = m_root_node = NULL;
 m_children.clear();
 m_iterators.clear();
-m_tree = m_backend.GetChildMemberWithName(ConstString("__tree_"), 
true).get();
+m_tree = m_backend.GetChildMemberWithName(g___tree_, true).get();
 if (!m_tree)
 return false;
-m_root_node = m_tree->GetChildMemberWithName(ConstString("__begin_node_"), 
true).get();
+m_root_node = m_tree->GetChildMemberWithName(g___begin_node_, true).get();
 return false;
 }
 


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


[Lldb-commits] [lldb] r254790 - Make it clear how you would get the pointee out of an SBValue with

2015-12-04 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Dec  4 16:51:19 2015
New Revision: 254790

URL: http://llvm.org/viewvc/llvm-project?rev=254790&view=rev
Log:
Make it clear how you would get the pointee out of an SBValue with
GetType().IsPointerType() returns true.

Modified:
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/scripts/interface/SBValue.i

Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=254790&r1=254789&r2=254790&view=diff
==
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Fri Dec  4 16:51:19 2015
@@ -204,7 +204,11 @@ public:
 /// pointer to a 'Point' type, then the child at index zero will be
 /// the 'x' member, and the child at index 1 will be the 'y' member
 /// (the child at index zero won't be a 'Point' instance).
-/// 
+///
+/// If you actually need an SBValue that represents the type pointed
+/// to by a SBValue for which GetType().IsPointeeType() returns true,
+/// regardless of the pointee type, you can do that with 
SBValue::Dereference.
+///
 /// Arrays have a preset number of children that can be accessed by
 /// index and will returns invalid child values for indexes that are
 /// out of bounds unless the \a synthetic_allowed is \b true. In this

Modified: lldb/trunk/scripts/interface/SBValue.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBValue.i?rev=254790&r1=254789&r2=254790&view=diff
==
--- lldb/trunk/scripts/interface/SBValue.i (original)
+++ lldb/trunk/scripts/interface/SBValue.i Fri Dec  4 16:51:19 2015
@@ -210,6 +210,11 @@ public:
 /// the 'x' member, and the child at index 1 will be the 'y' member
 /// (the child at index zero won't be a 'Point' instance).
 /// 
+/// If you actually need an SBValue that represents the type pointed
+/// to by a SBValue for which GetType().IsPointeeType() returns true,
+/// regardless of the pointee type, you can do that with the 
SBValue.Dereference
+/// method (or the equivalent deref property).
+///
 /// Arrays have a preset number of children that can be accessed by
 /// index and will returns invalid child values for indexes that are
 /// out of bounds unless the \a synthetic_allowed is \b true. In this


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


Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-04 Thread Jim Ingham via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Anyway, adding a separate test is fine with me.


http://reviews.llvm.org/D15241



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


[Lldb-commits] [lldb] r254791 - Python 3 - Fix script import --allow-reload.

2015-12-04 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Dec  4 16:59:14 2015
New Revision: 254791

URL: http://llvm.org/viewvc/llvm-project?rev=254791&view=rev
Log:
Python 3 - Fix script import --allow-reload.

Differential Revision: http://reviews.llvm.org/D15209
Reviewed By: Todd Fiala

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=254791&r1=254790&r2=254791&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Fri Dec  4 16:59:14 2015
@@ -286,10 +286,15 @@ ScriptInterpreterPython::ScriptInterpret
 PyRun_SimpleString (run_string.GetData());
 
 run_string.Clear();
-
 run_string.Printf ("run_one_line (%s, 'import copy, keyword, os, re, sys, 
uuid, lldb')", m_dictionary_name.c_str());
 PyRun_SimpleString (run_string.GetData());
 
+// Reloading modules requires a different syntax in Python 2 and Python 3. 
 This provides
+// a consistent syntax no matter what version of Python.
+run_string.Clear();
+run_string.Printf("run_one_line (%s, 'from six.moves import 
reload_module')", m_dictionary_name.c_str());
+PyRun_SimpleString(run_string.GetData());
+
 // WARNING: temporary code that loads Cocoa formatters - this should be 
done on a per-platform basis rather than loading the whole set
 // and letting the individual formatter classes exploit APIs to check 
whether they can/cannot do their task
 run_string.Clear();
@@ -2626,9 +2631,9 @@ ScriptInterpreterPython::LoadScriptingMo
 if (was_imported)
 {
 if (!was_imported_locally)
-command_stream.Printf("import %s ; 
reload(%s)",basename.c_str(),basename.c_str());
+command_stream.Printf("import %s ; 
reload_module(%s)",basename.c_str(),basename.c_str());
 else
-command_stream.Printf("reload(%s)",basename.c_str());
+command_stream.Printf("reload_module(%s)",basename.c_str());
 }
 else
 command_stream.Printf("import %s",basename.c_str());


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


[Lldb-commits] [lldb] r254792 - Make TestThreadSpecificBreakpoint.py more focused.

2015-12-04 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Dec  4 16:59:41 2015
New Revision: 254792

URL: http://llvm.org/viewvc/llvm-project?rev=254792&view=rev
Log:
Make TestThreadSpecificBreakpoint.py more focused.

This test would fail before if conditional breakpoints weren't
working correctly, and the nature of the test (spinning up 10
threads, etc) opens the door to raciness.

This patch vastly simplifies the test, removes the need for relying
on conditional expression evaluation, and as a result makes the
correctness of the test vastly easier to reason about and reduces
flakiness.

Differential Revision: http://reviews.llvm.org/D15241
Reviewed By: Jim Ingham

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
  - copied, changed from r254791, 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/main.cpp
  - copied, changed from r254791, 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py?rev=254792&r1=254791&r2=254792&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
 Fri Dec  4 16:59:41 2015
@@ -16,49 +16,48 @@ class ThreadSpecificBreakTestCase(TestBa
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipIfFreeBSD # test frequently times out or hangs
-@expectedFailureFreeBSD('llvm.org/pr18522') # hits break in another thread 
in testrun
 @add_test_categories(['pyapi'])
-@expectedFlakeyLinux # this test fails 6/100 dosep runs
+@expectedFailureWindows # Thread specific breakpoints cause the inferior 
to crash
 def test_python(self):
 """Test that we obey thread conditioned breakpoints."""
 self.build()
 exe = os.path.join(os.getcwd(), "a.out")
 
-self.dbg.HandleCommand ("log enable -f /tmp/lldb-testsuite-log.txt 
lldb step breakpoint process") 
 target = self.dbg.CreateTarget(exe)
 self.assertTrue(target, VALID_TARGET)
 
+# This test works by setting a breakpoint in a function conditioned to 
stop only on
+# the main thread, and then calling this function on a secondary 
thread, joining,
+# and then calling again on the main thread.  If the thread specific 
breakpoint works
+# then it should not be hit on the secondary thread, only on the main 
thread.
+
 main_source_spec = lldb.SBFileSpec ("main.cpp")
 
-# Set a breakpoint in the thread body, and make it active for only the 
first thread.
-break_thread_body = target.BreakpointCreateBySourceRegex ("Break here 
in thread body.", main_source_spec)
-self.assertTrue (break_thread_body.IsValid() and 
break_thread_body.GetNumLocations() > 0, "Failed to set thread body 
breakpoint.")
+main_breakpoint = target.BreakpointCreateBySourceRegex("Set main 
breakpoint here", main_source_spec);
+thread_breakpoint = target.BreakpointCreateBySourceRegex("Set 
thread-specific breakpoint here", main_source_spec)
+
+self.assertTrue(main_breakpoint.IsValid(), "Failed to set main 
breakpoint.")
+self.assertGreater(main_breakpoint.GetNumLocations(), 0, "main 
breakpoint has no locations associated with it.")
+self.assertTrue(thread_breakpoint.IsValid(), "Failed to set thread 
breakpoint.")
+self.assertGreater(thread_breakpoint.GetNumLocations(), 0, "thread 
breakpoint has no locations associated with it.")
 
 process = target.LaunchSimple (None, None, 
self.get_process_working_directory())
 
 self.assertTrue(process, PROCESS_IS_VALID)
 
-threads = lldbutil.get_threads_stopped_at_breakpoint (process, 
break_thread_body)
-
-victim_thread = threads[0]
-
-# Pick one of the threads, and change the breakpoint so it ONLY stops 
for

[Lldb-commits] LLVM buildmaster will be restarted tonight

2015-12-04 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 7 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