Re: [Lldb-commits] [PATCH] D11519: [MIPS] Use qfThreadID if qC packet is not supported by target

2015-08-12 Thread Jaydeep Patil via lldb-commits
jaydeep updated this revision to Diff 31908.
jaydeep added a comment.

Addressed review comments.


Repository:
  rL LLVM

http://reviews.llvm.org/D11519

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1459,6 +1459,21 @@
 }
 }
 }
+
+// If we don't get a response for $qC, check if $qfThreadID gives us a 
result.
+if (m_curr_pid == LLDB_INVALID_PROCESS_ID)
+{
+std::vector thread_ids;
+bool sequence_mutex_unavailable;
+size_t size;
+size = GetCurrentThreadIDs (thread_ids, 
sequence_mutex_unavailable);
+if (size && sequence_mutex_unavailable == false)
+{
+m_curr_pid = thread_ids.front();
+m_curr_pid_is_valid = eLazyBoolYes;
+return m_curr_pid;
+}
+}
 }
 
 return LLDB_INVALID_PROCESS_ID;


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1459,6 +1459,21 @@
 }
 }
 }
+
+// If we don't get a response for $qC, check if $qfThreadID gives us a result.
+if (m_curr_pid == LLDB_INVALID_PROCESS_ID)
+{
+std::vector thread_ids;
+bool sequence_mutex_unavailable;
+size_t size;
+size = GetCurrentThreadIDs (thread_ids, sequence_mutex_unavailable);
+if (size && sequence_mutex_unavailable == false)
+{
+m_curr_pid = thread_ids.front();
+m_curr_pid_is_valid = eLazyBoolYes;
+return m_curr_pid;
+}
+}
 }
 
 return LLDB_INVALID_PROCESS_ID;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11747: [MIPS] Support standard GDB remote stop reply packet for watchpoint

2015-08-12 Thread Jaydeep Patil via lldb-commits
jaydeep added inline comments.


Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:2498-2500
@@ +2497,5 @@
+reason = "watchpoint";
+std::ostringstream ostr;
+ostr << wp_addr << " " << wp_index;
+description = ostr.str();
+}

clayborg wrote:
> Not sure if you need to do this, try not setting this and see how the 
> description comes out. The watchpoint stop info should set this correctly?
We need "watchpoint" in the description so that SetThreadStopInfo can create 
CreateStopReasonWithWatchpointID.
 


Repository:
  rL LLVM

http://reviews.llvm.org/D11747



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


Re: [Lldb-commits] [lldb] r244308 - [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1 mode support

2015-08-12 Thread via lldb-commits

Hi Ed,

I have updated the patch http://reviews.llvm.org/D10919 to fix failures 
reported by Oleksiy.

error: Couldn't materialize: data for register eax had size 8 but we expected 4
Errored out in Execute, couldn't PrepareToExecuteJITExpression
This failure is similar to the failure I was getting in 
TestLldbGdbServer.py with linux/x86_64.

I have fixed this issue in the updated patch http://reviews.llvm.org/D10919
Could you please check if it works for you as I don't have a FreeBSD 
system to test with ?


Thanks and Regards,
Sagar.

On Monday 10 August 2015 09:23 PM, Ed Maste wrote:

On 7 August 2015 at 02:39, Sagar Thakur via lldb-commits
 wrote:

Author: slthakur
Date: Fri Aug  7 01:39:38 2015
New Revision: 244308

URL: http://llvm.org/viewvc/llvm-project?rev=244308&view=rev
Log:
[LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1 mode 
support

This change introduced a failure on FreeBSD in
test_register_expressions TestRegisters RegisterCommandsTestCase

 From the test log:
python2.7 SBCommandInterpreter(0x804549200)::HandleCommand
(command="expr/x $eax", SBCommandReturnObject(0x8023fe600),
add_to_history=0)
python2.7 SBCommandReturnObject(0x8023fe600)::GetError () => "error:
Couldn't materialize: data for register eax had size 8 but we expected
4
Errored out in Execute, couldn't PrepareToExecuteJITExpression
"
python2.7 SBCommandInterpreter(0x804549200)::HandleCommand
(command="expr/x $eax", SBCommandReturnObject(0x8023fe600): Status:
Fail
Error Message:
error: Couldn't materialize: data for register eax had size 8 but we expected 4
Errored out in Execute, couldn't PrepareToExecuteJITExpression
, add_to_history=0) => 6
python2.7 SBCommandReturnObject(0x8023fe600)::GetError () => "error:
Couldn't materialize: data for register eax had size 8 but we expected
4
Errored out in Execute, couldn't PrepareToExecuteJITExpression
"
runCmd: expr/x $eax
runCmd failed!
error: Couldn't materialize: data for register eax had size 8 but we expected 4
Errored out in Execute, couldn't PrepareToExecuteJITExpression


These tests also started failing in the last few days, but I haven't
yet confirmed they are also introduced by this change.
test_breakpoint_condition_inline_with_dwarf_and_run_command
TestBreakpointConditions BreakpointConditionsTestCase
test_breakpoint_condition_with_dwarf_and_run_command
TestBreakpointConditions BreakpointConditionsTestCase


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


Re: [Lldb-commits] [PATCH] D11747: [MIPS] Support standard GDB remote stop reply packet for watchpoint

2015-08-12 Thread Jaydeep Patil via lldb-commits
jaydeep updated this revision to Diff 31919.
jaydeep added a comment.

Addressed review comments.


Repository:
  rL LLVM

http://reviews.llvm.org/D11747

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2483,6 +2483,21 @@
 }
 }
 }
+else if (key.compare("watch") == 0 || key.compare("rwatch") == 0 || key.compare("awatch") == 0)
+{
+// Support standard GDB remote stop reply packet 'TAAwatch:addr'
+lldb::addr_t wp_addr = StringConvert::ToUInt64 (value.c_str(), LLDB_INVALID_ADDRESS, 16);
+WatchpointSP wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr);
+uint32_t wp_index = LLDB_INVALID_INDEX32;
+
+if (wp_sp)
+wp_index = wp_sp->GetHardwareIndex();
+
+reason = "watchpoint";
+StreamString ostr;
+ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
+description = ostr.GetString().c_str();
+}
 else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1]))
 {
 uint32_t reg = StringConvert::ToUInt32 (key.c_str(), UINT32_MAX, 16);
@@ -3084,7 +3099,7 @@
 Error
 ProcessGDBRemote::GetWatchpointSupportInfo (uint32_t &num, bool& after)
 {
-Error error (m_gdb_comm.GetWatchpointSupportInfo (num, after));
+Error error (m_gdb_comm.GetWatchpointSupportInfo (num, after, GetTarget().GetArchitecture()));
 return error;
 }
 
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -287,10 +287,10 @@
 GetWatchpointSupportInfo (uint32_t &num); 
 
 Error
-GetWatchpointSupportInfo (uint32_t &num, bool& after);
+GetWatchpointSupportInfo (uint32_t &num, bool& after, const ArchSpec &arch);
 
 Error
-GetWatchpointsTriggerAfterInstruction (bool &after);
+GetWatchpointsTriggerAfterInstruction (bool &after, const ArchSpec &arch);
 
 const ArchSpec &
 GetHostArchitecture ();
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2473,26 +2473,45 @@
 }
 
 lldb_private::Error
-GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num, bool& after)
+GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num, bool& after, const ArchSpec &arch)
 {
 Error error(GetWatchpointSupportInfo(num));
 if (error.Success())
-error = GetWatchpointsTriggerAfterInstruction(after);
+error = GetWatchpointsTriggerAfterInstruction(after, arch);
 return error;
 }
 
 lldb_private::Error
-GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction (bool &after)
+GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction (bool &after, const ArchSpec &arch)
 {
 Error error;
+llvm::Triple::ArchType atype = arch.GetMachine();
 
 // we assume watchpoints will happen after running the relevant opcode
 // and we only want to override this behavior if we have explicitly
 // received a qHostInfo telling us otherwise
 if (m_qHostInfo_is_valid != eLazyBoolYes)
-after = true;
+{
+// On targets like MIPS, watchpoint exceptions are always generated 
+// before the instruction is executed. The connected target may not 
+// support qHostInfo or qWatchpointSupportInfo packets.
+if (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel
+|| atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el)
+after = false;
+else
+after = true;
+}
 else
+{
+// For MIPS, set m_watchpoints_trigger_after_instruction to eLazyBoolNo 
+// if it is not calculated before.
+if (m_watchpoints_trigger_after_instruction == eLazyBoolCalculate &&
+(atype == llvm::Triple::mips || atype == llvm::Triple::mipsel
+|| atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el))
+m_watchpoints_trigger_after_instruction = eLazyBoolNo;
+
 after = (m_watchpoints_trigge

Re: [Lldb-commits] [PATCH] D11935: Fetch SDK version from PlatformAndroid

2015-08-12 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244737: Fetch SDK version from PlatformAndroid (authored by 
tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D11935?vs=31822&id=31921#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11935

Files:
  lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
  lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h

Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
===
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
@@ -73,6 +73,12 @@
  const FileSpec& destination,
  uint32_t uid = UINT32_MAX,
  uint32_t gid = UINT32_MAX) override;
+
+uint32_t
+GetSdkVersion();
+
+Error
+DisconnectRemote () override;
 
  protected:
 const char *
@@ -86,6 +92,8 @@
 
 private:
 std::string m_device_id;
+uint32_t m_sdk_version;
+
 DISALLOW_COPY_AND_ASSIGN (PlatformAndroid);
 };
 
Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Host/StringConvert.h"
 #include "Utility/UriParser.h"
 
 // Project includes
@@ -133,7 +134,8 @@
 }
 
 PlatformAndroid::PlatformAndroid (bool is_host) :
-PlatformLinux(is_host)
+PlatformLinux(is_host),
+m_sdk_version(0)
 {
 }
 
@@ -257,3 +259,46 @@
 
 return GetFile (src_file_spec, dst_file_spec);
 }
+
+Error
+PlatformAndroid::DisconnectRemote()
+{
+Error error = PlatformLinux::DisconnectRemote();
+if (error.Success())
+{
+m_device_id.clear();
+m_sdk_version = 0;
+}
+return error;
+}
+
+uint32_t
+PlatformAndroid::GetSdkVersion()
+{
+if (!IsConnected())
+return 0;
+
+if (m_sdk_version != 0)
+return m_sdk_version;
+
+int status = 0;
+std::string version_string;
+Error error = RunShellCommand("getprop ro.build.version.sdk",
+  GetWorkingDirectory(),
+  &status,
+  nullptr,
+  &version_string,
+  1);
+if (error.Fail() || status != 0 || version_string.empty())
+{
+Log* log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM);
+if (log)
+log->Printf("Get SDK version failed. (status: %d, error: %s, 
output: %s)",
+status, error.AsCString(), version_string.c_str());
+return 0;
+}
+version_string.erase(version_string.size() - 1); // Remove trailing new 
line
+
+m_sdk_version = StringConvert::ToUInt32(version_string.c_str());
+return m_sdk_version;
+}


Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
===
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
@@ -73,6 +73,12 @@
  const FileSpec& destination,
  uint32_t uid = UINT32_MAX,
  uint32_t gid = UINT32_MAX) override;
+
+uint32_t
+GetSdkVersion();
+
+Error
+DisconnectRemote () override;
 
  protected:
 const char *
@@ -86,6 +92,8 @@
 
 private:
 std::string m_device_id;
+uint32_t m_sdk_version;
+
 DISALLOW_COPY_AND_ASSIGN (PlatformAndroid);
 };
 
Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Host/StringConvert.h"
 #include "Utility/UriParser.h"
 
 // Project includes
@@ -133,7 +134,8 @@
 }
 
 PlatformAndroid::PlatformAndroid (bool is_host) :
-PlatformLinux(is_host)
+PlatformLinux(is_host),
+m_sdk_version(0)
 {
 }
 
@@ -257,3 +259,46 @@
 
 return GetFile (src_file_spec, dst_file_spec);
 }
+
+Error
+PlatformAndroid::DisconnectRemote()
+{
+Error error = PlatformLinux::DisconnectRemote();
+if (error.Success())
+{
+m_device_id.clear();
+m_sdk_version = 0;
+}
+return error;
+}
+
+uint32_t
+PlatformAndroid::GetSdkVersion()
+{
+if (!IsConnected())
+return 0;
+
+i

[Lldb-commits] [lldb] r244737 - Fetch SDK version from PlatformAndroid

2015-08-12 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Wed Aug 12 06:10:19 2015
New Revision: 244737

URL: http://llvm.org/viewvc/llvm-project?rev=244737&view=rev
Log:
Fetch SDK version from PlatformAndroid

The SDK version implies the features supported by a given android
device. This version number will be used in future changes to execute
the right command on the device.

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

Modified:
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=244737&r1=244736&r2=244737&view=diff
==
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Wed Aug 12 
06:10:19 2015
@@ -13,6 +13,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Host/StringConvert.h"
 #include "Utility/UriParser.h"
 
 // Project includes
@@ -133,7 +134,8 @@ PlatformAndroid::CreateInstance (bool fo
 }
 
 PlatformAndroid::PlatformAndroid (bool is_host) :
-PlatformLinux(is_host)
+PlatformLinux(is_host),
+m_sdk_version(0)
 {
 }
 
@@ -257,3 +259,46 @@ PlatformAndroid::DownloadModuleSlice (co
 
 return GetFile (src_file_spec, dst_file_spec);
 }
+
+Error
+PlatformAndroid::DisconnectRemote()
+{
+Error error = PlatformLinux::DisconnectRemote();
+if (error.Success())
+{
+m_device_id.clear();
+m_sdk_version = 0;
+}
+return error;
+}
+
+uint32_t
+PlatformAndroid::GetSdkVersion()
+{
+if (!IsConnected())
+return 0;
+
+if (m_sdk_version != 0)
+return m_sdk_version;
+
+int status = 0;
+std::string version_string;
+Error error = RunShellCommand("getprop ro.build.version.sdk",
+  GetWorkingDirectory(),
+  &status,
+  nullptr,
+  &version_string,
+  1);
+if (error.Fail() || status != 0 || version_string.empty())
+{
+Log* log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM);
+if (log)
+log->Printf("Get SDK version failed. (status: %d, error: %s, 
output: %s)",
+status, error.AsCString(), version_string.c_str());
+return 0;
+}
+version_string.erase(version_string.size() - 1); // Remove trailing new 
line
+
+m_sdk_version = StringConvert::ToUInt32(version_string.c_str());
+return m_sdk_version;
+}

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h?rev=244737&r1=244736&r2=244737&view=diff
==
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h Wed Aug 12 
06:10:19 2015
@@ -73,6 +73,12 @@ namespace platform_android {
  const FileSpec& destination,
  uint32_t uid = UINT32_MAX,
  uint32_t gid = UINT32_MAX) override;
+
+uint32_t
+GetSdkVersion();
+
+Error
+DisconnectRemote () override;
 
  protected:
 const char *
@@ -86,6 +92,8 @@ namespace platform_android {
 
 private:
 std::string m_device_id;
+uint32_t m_sdk_version;
+
 DISALLOW_COPY_AND_ASSIGN (PlatformAndroid);
 };
 


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


[Lldb-commits] [lldb] r244738 - Download symbol file for .oat files on android

2015-08-12 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Wed Aug 12 06:10:25 2015
New Revision: 244738

URL: http://llvm.org/viewvc/llvm-project?rev=244738&view=rev
Log:
Download symbol file for .oat files on android

On android .oat files (compiled java code) don't have symbol
information but on SDK 23+ it can be generated by the oatdump tool
(based on the dex information).

This CL adds logic to download this information and store it in the
module cache.

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

Modified:
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Utility/ModuleCache.cpp
lldb/trunk/source/Utility/ModuleCache.h

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=244738&r1=244737&r2=244738&view=diff
==
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Wed Aug 12 06:10:25 2015
@@ -1092,6 +1092,10 @@ class ModuleCache;
  const uint64_t src_offset,
  const uint64_t src_size,
  const FileSpec& dst_file_spec);
+
+virtual Error
+DownloadSymbolFile (const lldb::ModuleSP& module_sp,
+const FileSpec& dst_file_spec);
 
 virtual const char *
 GetCacheHostname ();

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=244738&r1=244737&r2=244738&view=diff
==
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Wed Aug 12 
06:10:25 2015
@@ -11,7 +11,9 @@
 // C++ Includes
 // Other libraries and framework includes
 #include "lldb/Core/Log.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Section.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/StringConvert.h"
 #include "Utility/UriParser.h"
@@ -302,3 +304,78 @@ PlatformAndroid::GetSdkVersion()
 m_sdk_version = StringConvert::ToUInt32(version_string.c_str());
 return m_sdk_version;
 }
+
+Error
+PlatformAndroid::DownloadSymbolFile (const lldb::ModuleSP& module_sp,
+ const FileSpec& dst_file_spec)
+{
+// For oat file we can try to fetch additional debug info from the device
+if (module_sp->GetFileSpec().GetFileNameExtension() != ConstString("oat"))
+return Error("Symbol file downloading only supported for oat files");
+
+// If we have no information about the platform file we can't execute 
oatdump
+if (!module_sp->GetPlatformFileSpec())
+return Error("No platform file specified");
+
+// Symbolizer isn't available before SDK version 23
+if (GetSdkVersion() < 23)
+return Error("Symbol file generation only supported on SDK 23+");
+
+// If we already have symtab then we don't have to try and generate one
+if (module_sp->GetSectionList()->FindSectionByName(ConstString(".symtab")) 
!= nullptr)
+return Error("Symtab already available in the module");
+
+int status = 0;
+std::string tmpdir;
+StreamString command;
+command.Printf("mktemp --directory --tmpdir %s", 
GetWorkingDirectory().GetCString());
+Error error = RunShellCommand(command.GetData(),
+  GetWorkingDirectory(),
+  &status,
+  nullptr,
+  &tmpdir,
+  5 /* timeout (s) */);
+
+if (error.Fail() || status != 0 || tmpdir.empty())
+return Error("Failed to generate temporary directory on the device 
(%s)", error.AsCString());
+tmpdir.erase(tmpdir.size() - 1); // Remove trailing new line
+
+// Create file remover for the temporary directory created on the device
+std::unique_ptr> 
tmpdir_remover(
+&tmpdir,
+[this](std::string* s) {
+StreamString command;
+command.Printf("rm -rf %s", s->c_str());
+Error error = this->RunShellCommand(command.GetData(),
+GetWorkingDirectory(),
+nullptr,
+nullptr,
+nullptr,
+5 /* timeout (s) */);
+
+Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
+if (error.Fail())
+lo

Re: [Lldb-commits] [PATCH] D11936: Download symbol file for .oat files on android

2015-08-12 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244738: Download symbol file for .oat files on android 
(authored by tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D11936?vs=31826&id=31922#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11936

Files:
  lldb/trunk/include/lldb/Target/Platform.h
  lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
  lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
  lldb/trunk/source/Target/Platform.cpp
  lldb/trunk/source/Utility/ModuleCache.cpp
  lldb/trunk/source/Utility/ModuleCache.h

Index: lldb/trunk/source/Utility/ModuleCache.h
===
--- lldb/trunk/source/Utility/ModuleCache.h
+++ lldb/trunk/source/Utility/ModuleCache.h
@@ -46,22 +46,25 @@
 class ModuleCache
 {
 public:
-using Downloader = std::function;
+using ModuleDownloader = std::function;
+using SymfileDownloader = std::function;
 
 Error
 GetAndPut(const FileSpec &root_dir_spec,
   const char *hostname,
   const ModuleSpec &module_spec,
-  const Downloader &downloader,
+  const ModuleDownloader &module_downloader,
+  const SymfileDownloader &symfile_downloader,
   lldb::ModuleSP &cached_module_sp,
   bool *did_create_ptr);
 
 private:
 Error
 Put (const FileSpec &root_dir_spec,
  const char *hostname,
  const ModuleSpec &module_spec,
- const FileSpec &tmp_file);
+ const FileSpec &tmp_file,
+ const FileSpec &target_file);
 
 Error
 Get (const FileSpec &root_dir_spec,
Index: lldb/trunk/source/Utility/ModuleCache.cpp
===
--- lldb/trunk/source/Utility/ModuleCache.cpp
+++ lldb/trunk/source/Utility/ModuleCache.cpp
@@ -29,6 +29,8 @@
 const char* kModulesSubdir = ".cache";
 const char* kLockFileName = ".lock";
 const char* kTempFileName = ".temp";
+const char* kTempSymFileName = ".symtemp";
+const char* kSymFileExtension = ".sym";
 
 FileSpec
 JoinPath (const FileSpec &path1, const char* path2)
@@ -74,24 +76,31 @@
 return FileSystem::Hardlink(sysroot_module_path_spec, local_module_spec);
 }
 
+FileSpec
+GetSymbolFileSpec(const FileSpec& module_file_spec)
+{
+return FileSpec((module_file_spec.GetPath() + kSymFileExtension).c_str(), false);
+}
+
 }  // namespace
 
 Error
 ModuleCache::Put (const FileSpec &root_dir_spec,
   const char *hostname,
   const ModuleSpec &module_spec,
-  const FileSpec &tmp_file)
+  const FileSpec &tmp_file,
+  const FileSpec &target_file)
 {
 const auto module_spec_dir = GetModuleDirectory (root_dir_spec, module_spec.GetUUID ());
-const auto module_file_path = JoinPath (module_spec_dir, module_spec.GetFileSpec ().GetFilename ().AsCString ());
+const auto module_file_path = JoinPath (module_spec_dir, target_file.GetFilename ().AsCString ());
 
 const auto tmp_file_path = tmp_file.GetPath ();
 const auto err_code = llvm::sys::fs::rename (tmp_file_path.c_str (), module_file_path.GetPath ().c_str ());
 if (err_code)
 return Error ("Failed to rename file %s to %s: %s",
   tmp_file_path.c_str (), module_file_path.GetPath ().c_str (), err_code.message ().c_str ());
 
-const auto error = CreateHostSysRootModuleLink(root_dir_spec, hostname, module_spec.GetFileSpec(), module_file_path);
+const auto error = CreateHostSysRootModuleLink(root_dir_spec, hostname, target_file, module_file_path);
 if (error.Fail ())
 return Error ("Failed to create link to %s: %s", module_file_path.GetPath ().c_str (), error.AsCString ());
 return Error ();
@@ -131,6 +140,11 @@
 cached_module_spec.GetFileSpec () = module_file_path;
 cached_module_spec.GetPlatformFileSpec () = module_spec.GetFileSpec ();
 cached_module_sp.reset (new Module (cached_module_spec));
+
+FileSpec symfile_spec = GetSymbolFileSpec(cached_module_sp->GetFileSpec ());
+if (symfile_spec.Exists ())
+cached_module_sp->SetSymbolFileFileSpec (symfile_spec);
+
 if (did_create_ptr)
 *did_create_ptr = true;
 
@@ -143,7 +157,8 @@
 ModuleCache::GetAndPut (const FileSpec &root_dir_spec,
 const char *hostname,
 const ModuleSpec &module_spec,
-const Downloader &downloader,
+const ModuleDownloader &module_downloader,
+const SymfileDownloader &symfile_downloader,
 lldb::ModuleSP &cached_module_sp,
 bool *did_create_ptr)
 {
@@ -171,16 +186,37 @@
 return error;
 
 const auto tmp_download_file_spec = JoinPath (module_spec_dir, kTempFileName);
-error = downloader (module_spec, tmp_download_file_spec);
+error = module_

[Lldb-commits] [lldb] r244739 - Improve check for ASAN callbacks

2015-08-12 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Wed Aug 12 06:13:11 2015
New Revision: 244739

URL: http://llvm.org/viewvc/llvm-project?rev=244739&view=rev
Log:
Improve check for ASAN callbacks

The ASAN callbacks are public symbols so we can search for them
with reading only the symbol table (not the debug info). Whit this
change the attach time for big executables with debug symbols
decreased by a factor of ~4.

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

Modified:

lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp

Modified: 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp?rev=244739&r1=244738&r2=244739&view=diff
==
--- 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
 Wed Aug 12 06:13:11 2015
@@ -78,14 +78,11 @@ AddressSanitizerRuntime::~AddressSanitiz
 
 bool ModuleContainsASanRuntime(Module * module)
 {
-SymbolContextList sc_list;
-const bool include_symbols = true;
-const bool append = true;
-const bool include_inlines = true;
-
-size_t num_matches = 
module->FindFunctions(ConstString("__asan_get_alloc_stack"), NULL, 
eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-
-return num_matches > 0;
+const Symbol* symbol = module->FindFirstSymbolWithNameAndType(
+ConstString("__asan_get_alloc_stack"),
+lldb::eSymbolTypeAny);
+
+return symbol != nullptr;
 }
 
 void

Modified: lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp?rev=244739&r1=244738&r2=244739&view=diff
==
--- lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp 
(original)
+++ lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp Wed Aug 
12 06:13:11 2015
@@ -30,36 +30,25 @@ MemoryHistoryASan::CreateInstance (const
 {
 if (!process_sp.get())
 return NULL;
-
+
 Target & target = process_sp->GetTarget();
-
-bool found_asan_runtime = false;
-
+
 const ModuleList &target_modules = target.GetImages();
 Mutex::Locker modules_locker(target_modules.GetMutex());
 const size_t num_modules = target_modules.GetSize();
 for (size_t i = 0; i < num_modules; ++i)
 {
 Module *module_pointer = 
target_modules.GetModulePointerAtIndexUnlocked(i);
-
-SymbolContextList sc_list;
-const bool include_symbols = true;
-const bool append = true;
-const bool include_inlines = true;
-
-size_t num_matches = 
module_pointer->FindFunctions(ConstString("__asan_get_alloc_stack"), NULL, 
eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-
-if (num_matches)
-{
-found_asan_runtime = true;
-break;
-}
+
+const Symbol* symbol = module_pointer->FindFirstSymbolWithNameAndType(
+ConstString("__asan_get_alloc_stack"),
+lldb::eSymbolTypeAny);
+
+if (symbol != nullptr)
+return MemoryHistorySP(new MemoryHistoryASan(process_sp));
 }
-
-if (! found_asan_runtime)
-return MemoryHistorySP();
 
-return MemoryHistorySP(new MemoryHistoryASan(process_sp));
+return MemoryHistorySP();
 }
 
 void


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


Re: [Lldb-commits] [PATCH] D11384: Improve check for ASAN callbacks

2015-08-12 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244739: Improve check for ASAN callbacks (authored by 
tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D11384?vs=30239&id=31923#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11384

Files:
  
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
  lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp

Index: 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
===
--- 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -78,14 +78,11 @@
 
 bool ModuleContainsASanRuntime(Module * module)
 {
-SymbolContextList sc_list;
-const bool include_symbols = true;
-const bool append = true;
-const bool include_inlines = true;
-
-size_t num_matches = 
module->FindFunctions(ConstString("__asan_get_alloc_stack"), NULL, 
eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-
-return num_matches > 0;
+const Symbol* symbol = module->FindFirstSymbolWithNameAndType(
+ConstString("__asan_get_alloc_stack"),
+lldb::eSymbolTypeAny);
+
+return symbol != nullptr;
 }
 
 void
Index: lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
===
--- lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -30,36 +30,25 @@
 {
 if (!process_sp.get())
 return NULL;
-
+
 Target & target = process_sp->GetTarget();
-
-bool found_asan_runtime = false;
-
+
 const ModuleList &target_modules = target.GetImages();
 Mutex::Locker modules_locker(target_modules.GetMutex());
 const size_t num_modules = target_modules.GetSize();
 for (size_t i = 0; i < num_modules; ++i)
 {
 Module *module_pointer = 
target_modules.GetModulePointerAtIndexUnlocked(i);
-
-SymbolContextList sc_list;
-const bool include_symbols = true;
-const bool append = true;
-const bool include_inlines = true;
 
-size_t num_matches = 
module_pointer->FindFunctions(ConstString("__asan_get_alloc_stack"), NULL, 
eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-
-if (num_matches)
-{
-found_asan_runtime = true;
-break;
-}
+const Symbol* symbol = module_pointer->FindFirstSymbolWithNameAndType(
+ConstString("__asan_get_alloc_stack"),
+lldb::eSymbolTypeAny);
+
+if (symbol != nullptr)
+return MemoryHistorySP(new MemoryHistoryASan(process_sp));
 }
-
-if (! found_asan_runtime)
-return MemoryHistorySP();
 
-return MemoryHistorySP(new MemoryHistoryASan(process_sp));
+return MemoryHistorySP();
 }
 
 void


Index: lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
===
--- lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -78,14 +78,11 @@
 
 bool ModuleContainsASanRuntime(Module * module)
 {
-SymbolContextList sc_list;
-const bool include_symbols = true;
-const bool append = true;
-const bool include_inlines = true;
-
-size_t num_matches = module->FindFunctions(ConstString("__asan_get_alloc_stack"), NULL, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-
-return num_matches > 0;
+const Symbol* symbol = module->FindFirstSymbolWithNameAndType(
+ConstString("__asan_get_alloc_stack"),
+lldb::eSymbolTypeAny);
+
+return symbol != nullptr;
 }
 
 void
Index: lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
===
--- lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -30,36 +30,25 @@
 {
 if (!process_sp.get())
 return NULL;
-
+
 Target & target = process_sp->GetTarget();
-
-bool found_asan_runtime = false;
-
+
 const ModuleList &target_modules = target.GetImages();
 Mutex::Locker modules_locker(target_modules.GetMutex());
 const size_t num_modules = target_modules.GetSize();
 for (size_t i = 0; i < num_modules; ++i)
 {
 Module *module_pointer = target_modules.GetModulePointerAtIndexUnlocked(i);
-
-Sym

[Lldb-commits] [lldb] r244741 - Fix LLGS to enable read type watchpoints

2015-08-12 Thread Omair Javaid via lldb-commits
Author: omjavaid
Date: Wed Aug 12 06:30:21 2015
New Revision: 244741

URL: http://llvm.org/viewvc/llvm-project?rev=244741&view=rev
Log:
Fix LLGS to enable read type watchpoints
http://reviews.llvm.org/D11902

Modified:

lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp

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

Modified: 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp?rev=244741&r1=244740&r2=244741&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
Wed Aug 12 06:30:21 2015
@@ -1018,6 +1018,9 @@ NativeRegisterContextLinux_x86_64::SetHa
 if (wp_index >= NumSupportedHardwareWatchpoints())
 return Error ("Watchpoint index out of range");
 
+if (watch_flags == 0x2)
+return Error ("Read watchpoints currently unsupported on x86_64 
architecture");
+
 if (watch_flags != 0x1 && watch_flags != 0x3)
 return Error ("Invalid read/write bits for watchpoint");
 

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=244741&r1=244740&r2=244741&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 Wed Aug 12 06:30:21 2015
@@ -2227,6 +2227,7 @@ GDBRemoteCommunicationServerLLGS::Handle
 
 bool want_breakpoint = true;
 bool want_hardware = false;
+uint32_t watch_flags = 0;
 
 const GDBStoppointType stoppoint_type =
 GDBStoppointType(packet.GetS32 (eStoppointInvalid));
@@ -2237,10 +2238,13 @@ GDBRemoteCommunicationServerLLGS::Handle
 case eBreakpointHardware:
 want_hardware = true;  want_breakpoint = true;  break;
 case eWatchpointWrite:
+watch_flags = 1;
 want_hardware = true;  want_breakpoint = false; break;
 case eWatchpointRead:
+watch_flags = 2;
 want_hardware = true;  want_breakpoint = false; break;
 case eWatchpointReadWrite:
+watch_flags = 3;
 want_hardware = true;  want_breakpoint = false; break;
 case eStoppointInvalid:
 return SendIllFormedResponse(packet, "Z packet had invalid 
software/hardware specifier");
@@ -2280,11 +2284,6 @@ GDBRemoteCommunicationServerLLGS::Handle
 }
 else
 {
-uint32_t watch_flags =
-stoppoint_type == eWatchpointWrite
-? 0x1  // Write
-: 0x3; // ReadWrite
-
 // Try to set the watchpoint.
 const Error error = m_debugged_process_sp->SetWatchpoint (
 addr, size, watch_flags, want_hardware);


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


[Lldb-commits] [lldb] r244742 - Fix read only watchpoints on x86_64

2015-08-12 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Wed Aug 12 07:22:42 2015
New Revision: 244742

URL: http://llvm.org/viewvc/llvm-project?rev=244742&view=rev
Log:
Fix read only watchpoints on x86_64

On x86/x86_64 read only watchpoints aren't supported. Fall back
to read/write watchpoints in that case.

Note: Logic should be added to ignore the watchpoint hit when
occurred because of a write.

Modified:

lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp

Modified: 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp?rev=244742&r1=244741&r2=244742&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
Wed Aug 12 07:22:42 2015
@@ -1018,8 +1018,10 @@ NativeRegisterContextLinux_x86_64::SetHa
 if (wp_index >= NumSupportedHardwareWatchpoints())
 return Error ("Watchpoint index out of range");
 
+// Read only watchpoints aren't supported on x86_64. Fall back to 
read/write waitchpoints instead.
+// TODO: Add logic to detect when a write happens and ignore that 
watchpoint hit.
 if (watch_flags == 0x2)
-return Error ("Read watchpoints currently unsupported on x86_64 
architecture");
+watch_flags = 0x3;
 
 if (watch_flags != 0x1 && watch_flags != 0x3)
 return Error ("Invalid read/write bits for watchpoint");


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


Re: [Lldb-commits] [PATCH] D11899: Fix AArch64 watchpoint handlers in NativeRegisterContextLinux_arm64

2015-08-12 Thread Muhammad Omair Javaid via lldb-commits
omjavaid updated this revision to Diff 31934.
omjavaid added a comment.

I have updated this patch after incorporating suggestions.

Is it good for commit now?


http://reviews.llvm.org/D11899

Files:
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h

Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -82,6 +82,13 @@
 bool
 WatchpointIsEnabled(uint32_t wp_index);
 
+// Debug register type select
+enum DREGType
+{
+eDREGTypeWATCH = 0,
+eDREGTypeBREAK
+};
+
 protected:
 Error
 DoReadRegisterValue(uint32_t offset,
@@ -172,10 +179,10 @@
 IsFPR(unsigned reg) const;
 
 Error
-ReadHardwareDebugInfo(unsigned int &watch_count , unsigned int &break_count);
+ReadHardwareDebugInfo();
 
 Error
-WriteHardwareDebugRegs(lldb::addr_t *addr_buf, uint32_t *cntrl_buf, int type, int count);
+WriteHardwareDebugRegs(int hwbType);
 };
 
 } // namespace process_linux
Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -391,17 +391,9 @@
 if (log)
 log->Printf ("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
-NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
-if (!process_sp)
-return false;
+// Read hardware breakpoint and watchpoint information.
+ReadHardwareDebugInfo ();
 
-// Check if our hardware breakpoint and watchpoint information is updated.
-if (m_refresh_hwdebug_info)
-{
-ReadHardwareDebugInfo (m_max_hwp_supported, m_max_hbp_supported);
-m_refresh_hwdebug_info = false;
-}
-
 uint32_t control_value, bp_index;
 
 // Check if size has a valid hardware breakpoint length.
@@ -443,7 +435,8 @@
 m_hbr_regs[bp_index].control = control_value;
 m_hbr_regs[bp_index].refcount = 1;
 
-//TODO: PTRACE CALL HERE for an UPDATE
+// PTRACE call to set corresponding hardware breakpoint register.
+WriteHardwareDebugRegs(eDREGTypeBREAK);
 }
 else
 m_hbr_regs[bp_index].refcount++;
@@ -459,6 +452,9 @@
 if (log)
 log->Printf ("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
+// Read hardware breakpoint and watchpoint information.
+ReadHardwareDebugInfo ();
+
 if (hw_idx >= m_max_hbp_supported)
 return false;
 
@@ -474,8 +470,8 @@
 m_hbr_regs[hw_idx].address = 0;
 m_hbr_regs[hw_idx].refcount = 0;
 
-//TODO: PTRACE CALL HERE for an UPDATE
-return true;
+// PTRACE call to clear corresponding hardware breakpoint register.
+WriteHardwareDebugRegs(eDREGTypeBREAK);
 }
 
 return false;
@@ -489,6 +485,9 @@
 if (log)
 log->Printf ("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
+// Read hardware breakpoint and watchpoint information.
+ReadHardwareDebugInfo ();
+
 return m_max_hwp_supported;
 }
 
@@ -499,33 +498,36 @@
 
 if (log)
 log->Printf ("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
-
-NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
-if (!process_sp)
-return false;
-
 
-// Check if our hardware breakpoint and watchpoint information is updated.
-if (m_refresh_hwdebug_info)
-{
-ReadHardwareDebugInfo (m_max_hwp_supported, m_max_hbp_supported);
-m_refresh_hwdebug_info = false;
-}
+// Read hardware breakpoint and watchpoint information.
+ReadHardwareDebugInfo ();
 		
 uint32_t control_value, wp_index;
 
+// Check if we are setting watchpoint other than read/write/access
+// Also update watchpoint flag to match AArch64 write-read bit configuration.
+switch (watch_flags)
+{
+case 1:
+watch_flags = 2;
+break;
+case 2:
+watch_flags = 1;
+break;
+case 3:
+break;
+default:
+return LLDB_INVALID_INDEX32;
+}
 
-if (watch_flags != 0x1 && watch_flags != 0x2 && watch_flags != 0x3)
-return 0;//Error ("Invalid read/write bits for watchpoint");
-
 // Check if size has a valid hardware watchpoint length.
 if (size != 1 && size != 2 && size != 4 && size != 8)
-return 0;//Error ("Invalid size for watchpoint");
+return LLDB_INVALID_INDEX32;
 
 // Check 8-byte alignment for hardware watchpoint target address.
 // TODO: Add support for watching un-align

Re: [Lldb-commits] [PATCH] D11899: Fix AArch64 watchpoint handlers in NativeRegisterContextLinux_arm64

2015-08-12 Thread Tamas Berghammer via lldb-commits
tberghammer accepted this revision.
tberghammer added a comment.
This revision is now accepted and ready to land.

Looks good. Thank you for fixing it.



Comment at: 
source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:755
@@ -750,3 +754,3 @@
 
-if (type == 0)
-type = NT_ARM_HW_WATCH;
+if (hwbType == 0)
+{

Please use eDREGTypeWATCH instead of '0'


http://reviews.llvm.org/D11899



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


[Lldb-commits] [lldb] r244750 - Fix AArch64 watchpoint handlers in NativeRegisterContextLinux_arm64

2015-08-12 Thread Omair Javaid via lldb-commits
Author: omjavaid
Date: Wed Aug 12 08:42:24 2015
New Revision: 244750

URL: http://llvm.org/viewvc/llvm-project?rev=244750&view=rev
Log:
Fix AArch64 watchpoint handlers in NativeRegisterContextLinux_arm64

http://reviews.llvm.org/D11899


Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h

Modified: 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp?rev=244750&r1=244749&r2=244750&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp 
Wed Aug 12 08:42:24 2015
@@ -391,16 +391,8 @@ NativeRegisterContextLinux_arm64::SetHar
 if (log)
 log->Printf ("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
-NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
-if (!process_sp)
-return false;
-
-// Check if our hardware breakpoint and watchpoint information is updated.
-if (m_refresh_hwdebug_info)
-{
-ReadHardwareDebugInfo (m_max_hwp_supported, m_max_hbp_supported);
-m_refresh_hwdebug_info = false;
-}
+// Read hardware breakpoint and watchpoint information.
+ReadHardwareDebugInfo ();
 
 uint32_t control_value, bp_index;
 
@@ -443,7 +435,8 @@ NativeRegisterContextLinux_arm64::SetHar
 m_hbr_regs[bp_index].control = control_value;
 m_hbr_regs[bp_index].refcount = 1;
 
-//TODO: PTRACE CALL HERE for an UPDATE
+// PTRACE call to set corresponding hardware breakpoint register.
+WriteHardwareDebugRegs(eDREGTypeBREAK);
 }
 else
 m_hbr_regs[bp_index].refcount++;
@@ -459,6 +452,9 @@ NativeRegisterContextLinux_arm64::ClearH
 if (log)
 log->Printf ("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
+// Read hardware breakpoint and watchpoint information.
+ReadHardwareDebugInfo ();
+
 if (hw_idx >= m_max_hbp_supported)
 return false;
 
@@ -474,8 +470,8 @@ NativeRegisterContextLinux_arm64::ClearH
 m_hbr_regs[hw_idx].address = 0;
 m_hbr_regs[hw_idx].refcount = 0;
 
-//TODO: PTRACE CALL HERE for an UPDATE
-return true;
+// PTRACE call to clear corresponding hardware breakpoint register.
+WriteHardwareDebugRegs(eDREGTypeBREAK);
 }
 
 return false;
@@ -489,6 +485,9 @@ NativeRegisterContextLinux_arm64::NumSup
 if (log)
 log->Printf ("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
+// Read hardware breakpoint and watchpoint information.
+ReadHardwareDebugInfo ();
+
 return m_max_hwp_supported;
 }
 
@@ -499,33 +498,36 @@ NativeRegisterContextLinux_arm64::SetHar
 
 if (log)
 log->Printf ("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
-
-NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
-if (!process_sp)
-return false;
-
 
-// Check if our hardware breakpoint and watchpoint information is updated.
-if (m_refresh_hwdebug_info)
-{
-ReadHardwareDebugInfo (m_max_hwp_supported, m_max_hbp_supported);
-m_refresh_hwdebug_info = false;
-}
+// Read hardware breakpoint and watchpoint information.
+ReadHardwareDebugInfo ();

 uint32_t control_value, wp_index;
 
-
-if (watch_flags != 0x1 && watch_flags != 0x2 && watch_flags != 0x3)
-return 0;//Error ("Invalid read/write bits for watchpoint");
+// Check if we are setting watchpoint other than read/write/access
+// Also update watchpoint flag to match AArch64 write-read bit 
configuration.
+switch (watch_flags)
+{
+case 1:
+watch_flags = 2;
+break;
+case 2:
+watch_flags = 1;
+break;
+case 3:
+break;
+default:
+return LLDB_INVALID_INDEX32;
+}
 
 // Check if size has a valid hardware watchpoint length.
 if (size != 1 && size != 2 && size != 4 && size != 8)
-return 0;//Error ("Invalid size for watchpoint");
+return LLDB_INVALID_INDEX32;
 
 // Check 8-byte alignment for hardware watchpoint target address.
 // TODO: Add support for watching un-aligned addresses
 if (addr & 0x07)
-return 0;//Error ("LLDB for AArch64 currently supports 8-byte 
alignment for hardware watchpoint target address.");
+return LLDB_INVALID_INDEX32;
 
 // Setup control value
 control_value = watch_flags << 3;
@@ -554,12 +556,13 @@ NativeRegisterContextLinux_arm64::SetHar
 // Add new or update existing watchpoint
 if ((m_hwp_regs[wp_index].control & 1) == 0)
 {
+// Update watchpoint 

[Lldb-commits] [lldb] r244759 - Remove printf most likely left from some debugging section

2015-08-12 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Wed Aug 12 10:55:04 2015
New Revision: 244759

URL: http://llvm.org/viewvc/llvm-project?rev=244759&view=rev
Log:
Remove printf most likely left from some debugging section

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=244759&r1=244758&r2=244759&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Wed Aug 12 
10:55:04 2015
@@ -467,7 +467,6 @@ DWARFCompileUnit::BuildAddressRangeTable
 {
 const LineTable::FileAddressRanges::Entry &range = 
file_ranges.GetEntryRef(idx);
 debug_aranges->AppendRange(GetOffset(), 
range.GetRangeBase(), range.GetRangeEnd());
-printf ("0x%8.8x: [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 
")\n", GetOffset(), range.GetRangeBase(), range.GetRangeEnd());
 }
 }
 }


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


Re: [Lldb-commits] [PATCH] D11519: [MIPS] Use qfThreadID if qC packet is not supported by target

2015-08-12 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D11519



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


Re: [Lldb-commits] [PATCH] D11747: [MIPS] Support standard GDB remote stop reply packet for watchpoint

2015-08-12 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D11747



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


Re: [Lldb-commits] [PATCH] D11971: Remove DNBConfig.h

2015-08-12 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11971



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


Re: [Lldb-commits] [PATCH] D11672: [MIPS] Handle false positives for MIPS hardware watchpoints

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

Yes, this looks fine.


Repository:
  rL LLVM

http://reviews.llvm.org/D11672



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


[Lldb-commits] LLVM buildmaster will be restarted tonight

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

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

Thanks

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


Re: [Lldb-commits] [PATCH] D11962: Mark TestCModules as XFAIL on OSX

2015-08-12 Thread Oleksiy Vyalov via lldb-commits
ovyalov updated this revision to Diff 31956.
ovyalov added a comment.

Added bug id to XFAIL decorators


http://reviews.llvm.org/D11962

Files:
  test/lang/c/modules/TestCModules.py

Index: test/lang/c/modules/TestCModules.py
===
--- test/lang/c/modules/TestCModules.py
+++ test/lang/c/modules/TestCModules.py
@@ -16,12 +16,14 @@
 
 @skipUnlessDarwin
 @dsym_test
+@expectedFailureDarwin('http://llvm.org/pr24302')
 def test_expr_with_dsym(self):
 self.buildDsym()
 self.expr()
 
 @dwarf_test
 @skipIfFreeBSD
+@expectedFailureDarwin('http://llvm.org/pr24302')
 @expectedFailureLinux('http://llvm.org/pr23456') # 'fopen' has unknown 
return type
 def test_expr_with_dwarf(self):
 self.buildDwarf()


Index: test/lang/c/modules/TestCModules.py
===
--- test/lang/c/modules/TestCModules.py
+++ test/lang/c/modules/TestCModules.py
@@ -16,12 +16,14 @@
 
 @skipUnlessDarwin
 @dsym_test
+@expectedFailureDarwin('http://llvm.org/pr24302')
 def test_expr_with_dsym(self):
 self.buildDsym()
 self.expr()
 
 @dwarf_test
 @skipIfFreeBSD
+@expectedFailureDarwin('http://llvm.org/pr24302')
 @expectedFailureLinux('http://llvm.org/pr23456') # 'fopen' has unknown return type
 def test_expr_with_dwarf(self):
 self.buildDwarf()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11843: Make dosep output status by overwriting the same line.

2015-08-12 Thread Chaoren Lin via lldb-commits
chaoren added inline comments.


Comment at: test/dosep.py:163
@@ -162,3 @@
-# We're only interested in the test file with the "Test*.py" naming 
pattern.
-if not name.startswith("Test") or not name.endswith(".py"):
-continue

From here.


Comment at: test/dosep.py:215
@@ +214,3 @@
+# Only interested in test files with the "Test*.py" naming pattern.
+return name.startswith("Test") and name.endswith(".py")
+

zturner wrote:
> How was this working before?  Seems risky to start eliminating files that 
> were previously considered, and is this rule documented anywhere that the 
> filename must start with Test?
Yeah, this is moved over from line 163. I just moved the filtering earlier to 
get a count of test suites.


http://reviews.llvm.org/D11843



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


Re: [Lldb-commits] [PATCH] D11843: Make dosep output status by overwriting the same line.

2015-08-12 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: test/dosep.py:215
@@ +214,3 @@
+# Only interested in test files with the "Test*.py" naming pattern.
+return name.startswith("Test") and name.endswith(".py")
+

How was this working before?  Seems risky to start eliminating files that were 
previously considered, and is this rule documented anywhere that the filename 
must start with Test?


http://reviews.llvm.org/D11843



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


[Lldb-commits] [lldb] r244783 - Refactor dosep to use list comprehension. NFC.

2015-08-12 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Wed Aug 12 13:02:53 2015
New Revision: 244783

URL: http://llvm.org/viewvc/llvm-project?rev=244783&view=rev
Log:
Refactor dosep to use list comprehension. NFC.

Reviewers: zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=244783&r1=244782&r2=244783&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Aug 12 13:02:53 2015
@@ -153,15 +153,11 @@ def call_with_timeout(command, timeout,
 report_test_pass(name, output[1])
 else:
 report_test_failure(name, command, output[1])
-return exit_status, passes, failures
+return name, exit_status, passes, failures
 
 def process_dir(root, files, test_root, dotest_argv):
 """Examine a directory for tests, and invoke any found within it."""
-timed_out = []
-failed = []
-passed = []
-pass_sub_count = 0
-fail_sub_count = 0
+results = []
 for name in files:
 script_file = os.path.join(test_root, "dotest.py")
 command = ([sys.executable, script_file] +
@@ -172,18 +168,19 @@ def process_dir(root, files, test_root,
 
 timeout = os.getenv("LLDB_%s_TIMEOUT" % timeout_name) or 
getDefaultTimeout(dotest_options.lldb_platform_name)
 
-exit_status, pass_count, fail_count = call_with_timeout(command, 
timeout, name)
+results.append(call_with_timeout(command, timeout, name))
 
-pass_sub_count = pass_sub_count + pass_count
-fail_sub_count = fail_sub_count + fail_count
+# result = (name, status, passes, failures)
+timed_out = [name for name, status, _, _ in results
+ if status == eTimedOut]
+passed = [name for name, status, _, _ in results
+  if status == ePassed]
+failed = [name for name, status, _, _ in results
+  if status != ePassed]
+pass_count = sum([result[2] for result in results])
+fail_count = sum([result[3] for result in results])
 
-if exit_status == ePassed:
-passed.append(name)
-else:
-if eTimedOut == exit_status:
-timed_out.append(name)
-failed.append(name)
-return (timed_out, failed, passed, fail_sub_count, pass_sub_count)
+return (timed_out, passed, failed, pass_count, fail_count)
 
 in_q = None
 out_q = None
@@ -191,8 +188,7 @@ out_q = None
 def process_dir_worker(arg_tuple):
 """Worker thread main loop when in multithreaded mode.
 Takes one directory specification at a time and works on it."""
-(root, files, test_root, dotest_argv) = arg_tuple
-return process_dir(root, files, test_root, dotest_argv)
+return process_dir(*arg_tuple)
 
 def walk_and_invoke(test_directory, test_subdir, dotest_argv, num_threads):
 """Look for matched files and invoke test driver on each one.
@@ -237,25 +233,16 @@ def walk_and_invoke(test_directory, test
   dotest_options))
 test_results = pool.map(process_dir_worker, test_work_items)
 else:
-test_results = []
-for work_item in test_work_items:
-test_results.append(process_dir_worker(work_item))
-
-timed_out = []
-failed = []
-passed = []
-fail_sub_count = 0
-pass_sub_count = 0
-
-for test_result in test_results:
-(dir_timed_out, dir_failed, dir_passed, dir_fail_sub_count, 
dir_pass_sub_count) = test_result
-timed_out += dir_timed_out
-failed += dir_failed
-passed += dir_passed
-fail_sub_count = fail_sub_count + dir_fail_sub_count
-pass_sub_count = pass_sub_count + dir_pass_sub_count
+test_results = map(process_dir_worker, test_work_items)
+
+# result = (timed_out, failed, passed, fail_count, pass_count)
+timed_out = sum([result[0] for result in test_results], [])
+passed = sum([result[1] for result in test_results], [])
+failed = sum([result[2] for result in test_results], [])
+pass_count = sum([result[3] for result in test_results])
+fail_count = sum([result[4] for result in test_results])
 
-return (timed_out, failed, passed, fail_sub_count, pass_sub_count)
+return (timed_out, passed, failed, pass_count, fail_count)
 
 def getExpectedTimeouts(platform_name):
 # returns a set of test filenames that might timeout
@@ -413,11 +400,12 @@ Run lldb test suite using a separate pro
 num_threads = 1
 
 system_info = " ".join(platform.uname())
-(timed_out, failed, passed, all_fails, all_passes) = 
walk_and_invoke(test_directory, test_subdir, dotest_argv, num_threads)
+(timed_out, passed, failed, pass_count, fail_count) = walk_and_invoke(
+test_directory, test_subdir, dotest_argv, num_threads)
 
 timed_out = set(timed_out)
-num_test_files = len(failed) + le

[Lldb-commits] [lldb] r244781 - Make dosep output status by overwriting the same line.

2015-08-12 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Wed Aug 12 13:02:49 2015
New Revision: 244781

URL: http://llvm.org/viewvc/llvm-project?rev=244781&view=rev
Log:
Make dosep output status by overwriting the same line.

Summary: Update to D11816.

Reviewers: zturner

Subscribers: zturner, lldb-commits

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

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=244781&r1=244780&r2=244781&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Aug 12 13:02:49 2015
@@ -66,41 +66,47 @@ eTimedOut, ePassed, eFailed = 124, 0, 1
 output_lock = None
 test_counter = None
 total_tests = None
+test_name_len = None
 dotest_options = None
 output_on_success = False
 
-def setup_global_variables(lock, counter, total, options):
-global output_lock, test_counter, total_tests, dotest_options
+def setup_global_variables(lock, counter, total, name_len, options):
+global output_lock, test_counter, total_tests, test_name_len
+global dotest_options
 output_lock = lock
 test_counter = counter
 total_tests = total
+test_name_len = name_len
 dotest_options = options
 
 def report_test_failure(name, command, output):
 global output_lock
 with output_lock:
-print >> sys.stderr, "\n"
+print >> sys.stderr
 print >> sys.stderr, output
+print >> sys.stderr, "[%s FAILED]" % name
 print >> sys.stderr, "Command invoked: %s" % ' '.join(command)
-update_progress(name, "FAILED")
+update_progress(name)
 
 def report_test_pass(name, output):
 global output_lock, output_on_success
 with output_lock:
 if output_on_success:
-print >> sys.stderr, "\n"
+print >> sys.stderr
 print >> sys.stderr, output
-update_progress(name, "PASSED")
+print >> sys.stderr, "[%s PASSED]" % name
+update_progress(name)
 
-def update_progress(test_name, result):
-global output_lock, test_counter, total_tests
+def update_progress(test_name=""):
+global output_lock, test_counter, total_tests, test_name_len
 with output_lock:
-if test_name != None:
-sys.stderr.write("\n[%s %s] - %d out of %d test suites processed" %
-(result, test_name, test_counter.value, total_tests))
-else:
-sys.stderr.write("\n%d out of %d test suites processed" %
-(test_counter.value, total_tests))
+counter_len = len(str(total_tests))
+sys.stderr.write(
+"\r%*d out of %d test suites processed - %-*s" %
+(counter_len, test_counter.value, total_tests,
+ test_name_len.value, test_name))
+if len(test_name) > test_name_len.value:
+test_name_len.value = len(test_name)
 test_counter.value += 1
 sys.stdout.flush()
 sys.stderr.flush()
@@ -157,16 +163,6 @@ def process_dir(root, files, test_root,
 pass_sub_count = 0
 fail_sub_count = 0
 for name in files:
-path = os.path.join(root, name)
-
-# We're only interested in the test file with the "Test*.py" naming 
pattern.
-if not name.startswith("Test") or not name.endswith(".py"):
-continue
-
-# Neither a symbolically linked file.
-if os.path.islink(path):
-continue
-
 script_file = os.path.join(test_root, "dotest.py")
 command = ([sys.executable, script_file] +
dotest_argv +
@@ -211,21 +207,34 @@ def walk_and_invoke(test_directory, test
 # Collect the test files that we'll run.
 test_work_items = []
 for root, dirs, files in os.walk(test_subdir, topdown=False):
-test_work_items.append((root, files, test_directory, dotest_argv))
+def is_test(name):
+# Not interested in symbolically linked files.
+if os.path.islink(os.path.join(root, name)):
+return False
+# Only interested in test files with the "Test*.py" naming pattern.
+return name.startswith("Test") and name.endswith(".py")
+
+tests = filter(is_test, files)
+test_work_items.append((root, tests, test_directory, dotest_argv))
 
-global output_lock, test_counter, total_tests
+global output_lock, test_counter, total_tests, test_name_len
 output_lock = multiprocessing.RLock()
-total_tests = len(test_work_items)
+# item = (root, tests, test_directory, dotest_argv)
+total_tests = sum([len(item[1]) for item in test_work_items])
 test_counter = multiprocessing.Value('i', 0)
-print >> sys.stderr, "Testing: %d tests, %d threads" % (total_tests, 
num_threads)
-update_progress(None, None)
+test_name_len = multiprocessing.Value('i', 0)
+print >> sys.stderr, "Testing: %d test suites, %d thread%s" % (
+

Re: [Lldb-commits] [PATCH] D11910: Refactor dosep to use list comprehension. NFC.

2015-08-12 Thread Chaoren Lin via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244783: Refactor dosep to use list comprehension. NFC. 
(authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11910?vs=31708&id=31963#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11910

Files:
  lldb/trunk/test/dosep.py

Index: lldb/trunk/test/dosep.py
===
--- lldb/trunk/test/dosep.py
+++ lldb/trunk/test/dosep.py
@@ -153,15 +153,11 @@
 report_test_pass(name, output[1])
 else:
 report_test_failure(name, command, output[1])
-return exit_status, passes, failures
+return name, exit_status, passes, failures
 
 def process_dir(root, files, test_root, dotest_argv):
 """Examine a directory for tests, and invoke any found within it."""
-timed_out = []
-failed = []
-passed = []
-pass_sub_count = 0
-fail_sub_count = 0
+results = []
 for name in files:
 script_file = os.path.join(test_root, "dotest.py")
 command = ([sys.executable, script_file] +
@@ -172,27 +168,27 @@
 
 timeout = os.getenv("LLDB_%s_TIMEOUT" % timeout_name) or getDefaultTimeout(dotest_options.lldb_platform_name)
 
-exit_status, pass_count, fail_count = call_with_timeout(command, timeout, name)
+results.append(call_with_timeout(command, timeout, name))
 
-pass_sub_count = pass_sub_count + pass_count
-fail_sub_count = fail_sub_count + fail_count
+# result = (name, status, passes, failures)
+timed_out = [name for name, status, _, _ in results
+ if status == eTimedOut]
+passed = [name for name, status, _, _ in results
+  if status == ePassed]
+failed = [name for name, status, _, _ in results
+  if status != ePassed]
+pass_count = sum([result[2] for result in results])
+fail_count = sum([result[3] for result in results])
 
-if exit_status == ePassed:
-passed.append(name)
-else:
-if eTimedOut == exit_status:
-timed_out.append(name)
-failed.append(name)
-return (timed_out, failed, passed, fail_sub_count, pass_sub_count)
+return (timed_out, passed, failed, pass_count, fail_count)
 
 in_q = None
 out_q = None
 
 def process_dir_worker(arg_tuple):
 """Worker thread main loop when in multithreaded mode.
 Takes one directory specification at a time and works on it."""
-(root, files, test_root, dotest_argv) = arg_tuple
-return process_dir(root, files, test_root, dotest_argv)
+return process_dir(*arg_tuple)
 
 def walk_and_invoke(test_directory, test_subdir, dotest_argv, num_threads):
 """Look for matched files and invoke test driver on each one.
@@ -237,25 +233,16 @@
   dotest_options))
 test_results = pool.map(process_dir_worker, test_work_items)
 else:
-test_results = []
-for work_item in test_work_items:
-test_results.append(process_dir_worker(work_item))
-
-timed_out = []
-failed = []
-passed = []
-fail_sub_count = 0
-pass_sub_count = 0
-
-for test_result in test_results:
-(dir_timed_out, dir_failed, dir_passed, dir_fail_sub_count, dir_pass_sub_count) = test_result
-timed_out += dir_timed_out
-failed += dir_failed
-passed += dir_passed
-fail_sub_count = fail_sub_count + dir_fail_sub_count
-pass_sub_count = pass_sub_count + dir_pass_sub_count
+test_results = map(process_dir_worker, test_work_items)
+
+# result = (timed_out, failed, passed, fail_count, pass_count)
+timed_out = sum([result[0] for result in test_results], [])
+passed = sum([result[1] for result in test_results], [])
+failed = sum([result[2] for result in test_results], [])
+pass_count = sum([result[3] for result in test_results])
+fail_count = sum([result[4] for result in test_results])
 
-return (timed_out, failed, passed, fail_sub_count, pass_sub_count)
+return (timed_out, passed, failed, pass_count, fail_count)
 
 def getExpectedTimeouts(platform_name):
 # returns a set of test filenames that might timeout
@@ -413,11 +400,12 @@
 num_threads = 1
 
 system_info = " ".join(platform.uname())
-(timed_out, failed, passed, all_fails, all_passes) = walk_and_invoke(test_directory, test_subdir, dotest_argv, num_threads)
+(timed_out, passed, failed, pass_count, fail_count) = walk_and_invoke(
+test_directory, test_subdir, dotest_argv, num_threads)
 
 timed_out = set(timed_out)
-num_test_files = len(failed) + len(passed)
-num_tests = all_fails + all_passes
+num_test_files = len(passed) + len(failed)
+num_test_cases = pass_count + fail_count
 
 # move core files into session dir
 cores = find('core.*', test_subdir)
@@ -448,10 +436,10 @@
 sys.stdout.write(" (%d failed) (%f%%)" % (
 len(failed), 100.0 * l

[Lldb-commits] [lldb] r244782 - Don't print number of failures and percentage if no tests ran.

2015-08-12 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Wed Aug 12 13:02:51 2015
New Revision: 244782

URL: http://llvm.org/viewvc/llvm-project?rev=244782&view=rev
Log:
Don't print number of failures and percentage if no tests ran.

Reviewers: zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=244782&r1=244781&r2=244782&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Aug 12 13:02:51 2015
@@ -443,10 +443,16 @@ Run lldb test suite using a separate pro
 touch(os.path.join(session_dir, "{}-{}".format(result, test_name)))
 
 print
-print "Ran %d test suites (%d failed) (%f%%)" % (num_test_files, 
len(failed),
-(100.0 * len(failed) / num_test_files) if num_test_files > 0 else 
float('NaN'))
-print "Ran %d test cases (%d failed) (%f%%)" % (num_tests, all_fails,
-(100.0 * all_fails / num_tests) if num_tests > 0 else float('NaN'))
+sys.stdout.write("Ran %d test suites" % num_test_files)
+if num_test_files > 0:
+sys.stdout.write(" (%d failed) (%f%%)" % (
+len(failed), 100.0 * len(failed) / num_test_files))
+print
+sys.stdout.write("Ran %d test cases" % num_tests)
+if num_tests > 0:
+sys.stdout.write(" (%d failed) (%f%%)" % (
+all_fails, 100.0 * all_fails / num_tests))
+print
 if len(failed) > 0:
 failed.sort()
 print "Failing Tests (%d)" % len(failed)


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


[Lldb-commits] [lldb] r244784 - Make dosep.py PEP8 compliant. NFC.

2015-08-12 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Wed Aug 12 13:02:54 2015
New Revision: 244784

URL: http://llvm.org/viewvc/llvm-project?rev=244784&view=rev
Log:
Make dosep.py PEP8 compliant. NFC.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=244784&r1=244783&r2=244784&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Aug 12 13:02:54 2015
@@ -20,7 +20,8 @@ Set to "0" to run without time limit.
 E.g., export LLDB_TEST_TIMEOUT=0
 orexport LLDB_TESTCONCURRENTEVENTS_TIMEOUT=0
 
-To collect core files for timed out tests, do the following before running 
dosep.py
+To collect core files for timed out tests,
+do the following before running dosep.py
 
 OSX
 ulimit -c unlimited
@@ -43,6 +44,7 @@ import sys
 
 from optparse import OptionParser
 
+
 def get_timeout_command():
 """Search for a suitable timeout command."""
 if not sys.platform.startswith("win32"):
@@ -70,6 +72,7 @@ test_name_len = None
 dotest_options = None
 output_on_success = False
 
+
 def setup_global_variables(lock, counter, total, name_len, options):
 global output_lock, test_counter, total_tests, test_name_len
 global dotest_options
@@ -79,6 +82,7 @@ def setup_global_variables(lock, counter
 test_name_len = name_len
 dotest_options = options
 
+
 def report_test_failure(name, command, output):
 global output_lock
 with output_lock:
@@ -88,6 +92,7 @@ def report_test_failure(name, command, o
 print >> sys.stderr, "Command invoked: %s" % ' '.join(command)
 update_progress(name)
 
+
 def report_test_pass(name, output):
 global output_lock, output_on_success
 with output_lock:
@@ -97,6 +102,7 @@ def report_test_pass(name, output):
 print >> sys.stderr, "[%s PASSED]" % name
 update_progress(name)
 
+
 def update_progress(test_name=""):
 global output_lock, test_counter, total_tests, test_name_len
 with output_lock:
@@ -111,50 +117,60 @@ def update_progress(test_name=""):
 sys.stdout.flush()
 sys.stderr.flush()
 
+
 def parse_test_results(output):
 passes = 0
 failures = 0
 for result in output:
-pass_count = re.search("^RESULT:.*([0-9]+) passes", result, 
re.MULTILINE)
-fail_count = re.search("^RESULT:.*([0-9]+) failures", result, 
re.MULTILINE)
-error_count = re.search("^RESULT:.*([0-9]+) errors", result, 
re.MULTILINE)
+pass_count = re.search("^RESULT:.*([0-9]+) passes",
+   result, re.MULTILINE)
+fail_count = re.search("^RESULT:.*([0-9]+) failures",
+   result, re.MULTILINE)
+error_count = re.search("^RESULT:.*([0-9]+) errors",
+result, re.MULTILINE)
 this_fail_count = 0
 this_error_count = 0
-if pass_count != None:
+if pass_count is not None:
 passes = passes + int(pass_count.group(1))
-if fail_count != None:
+if fail_count is not None:
 failures = failures + int(fail_count.group(1))
-if error_count != None:
+if error_count is not None:
 failures = failures + int(error_count.group(1))
 pass
 return passes, failures
 
+
 def call_with_timeout(command, timeout, name):
 """Run command with a timeout if possible."""
 """-s QUIT will create a coredump if they are enabled on your system"""
 process = None
 if timeout_command and timeout != "0":
 command = [timeout_command, '-s', 'QUIT', timeout] + command
-# Specifying a value for close_fds is unsupported on Windows when using 
subprocess.PIPE
+# Specifying a value for close_fds is unsupported on Windows when using
+# subprocess.PIPE
 if os.name != "nt":
-process = subprocess.Popen(command, stdin=subprocess.PIPE,
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE,
-close_fds=True)
+process = subprocess.Popen(command,
+   stdin=subprocess.PIPE,
+   stdout=subprocess.PIPE,
+   stderr=subprocess.PIPE,
+   close_fds=True)
 else:
-process = subprocess.Popen(command, stdin=subprocess.PIPE,
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
+process = subprocess.Popen(command,
+   stdin=subprocess.PIPE,
+   stdout=subprocess.PIPE,
+   stderr=subprocess

Re: [Lldb-commits] [PATCH] D11846: Make dosep.py PEP8 compliant. NFC.

2015-08-12 Thread Chaoren Lin via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244784: Make dosep.py PEP8 compliant. NFC. (authored by 
chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11846?vs=31683&id=31964#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11846

Files:
  lldb/trunk/test/dosep.py

Index: lldb/trunk/test/dosep.py
===
--- lldb/trunk/test/dosep.py
+++ lldb/trunk/test/dosep.py
@@ -20,7 +20,8 @@
 E.g., export LLDB_TEST_TIMEOUT=0
 orexport LLDB_TESTCONCURRENTEVENTS_TIMEOUT=0
 
-To collect core files for timed out tests, do the following before running dosep.py
+To collect core files for timed out tests,
+do the following before running dosep.py
 
 OSX
 ulimit -c unlimited
@@ -43,6 +44,7 @@
 
 from optparse import OptionParser
 
+
 def get_timeout_command():
 """Search for a suitable timeout command."""
 if not sys.platform.startswith("win32"):
@@ -70,6 +72,7 @@
 dotest_options = None
 output_on_success = False
 
+
 def setup_global_variables(lock, counter, total, name_len, options):
 global output_lock, test_counter, total_tests, test_name_len
 global dotest_options
@@ -79,6 +82,7 @@
 test_name_len = name_len
 dotest_options = options
 
+
 def report_test_failure(name, command, output):
 global output_lock
 with output_lock:
@@ -88,6 +92,7 @@
 print >> sys.stderr, "Command invoked: %s" % ' '.join(command)
 update_progress(name)
 
+
 def report_test_pass(name, output):
 global output_lock, output_on_success
 with output_lock:
@@ -97,6 +102,7 @@
 print >> sys.stderr, "[%s PASSED]" % name
 update_progress(name)
 
+
 def update_progress(test_name=""):
 global output_lock, test_counter, total_tests, test_name_len
 with output_lock:
@@ -111,50 +117,60 @@
 sys.stdout.flush()
 sys.stderr.flush()
 
+
 def parse_test_results(output):
 passes = 0
 failures = 0
 for result in output:
-pass_count = re.search("^RESULT:.*([0-9]+) passes", result, re.MULTILINE)
-fail_count = re.search("^RESULT:.*([0-9]+) failures", result, re.MULTILINE)
-error_count = re.search("^RESULT:.*([0-9]+) errors", result, re.MULTILINE)
+pass_count = re.search("^RESULT:.*([0-9]+) passes",
+   result, re.MULTILINE)
+fail_count = re.search("^RESULT:.*([0-9]+) failures",
+   result, re.MULTILINE)
+error_count = re.search("^RESULT:.*([0-9]+) errors",
+result, re.MULTILINE)
 this_fail_count = 0
 this_error_count = 0
-if pass_count != None:
+if pass_count is not None:
 passes = passes + int(pass_count.group(1))
-if fail_count != None:
+if fail_count is not None:
 failures = failures + int(fail_count.group(1))
-if error_count != None:
+if error_count is not None:
 failures = failures + int(error_count.group(1))
 pass
 return passes, failures
 
+
 def call_with_timeout(command, timeout, name):
 """Run command with a timeout if possible."""
 """-s QUIT will create a coredump if they are enabled on your system"""
 process = None
 if timeout_command and timeout != "0":
 command = [timeout_command, '-s', 'QUIT', timeout] + command
-# Specifying a value for close_fds is unsupported on Windows when using subprocess.PIPE
+# Specifying a value for close_fds is unsupported on Windows when using
+# subprocess.PIPE
 if os.name != "nt":
-process = subprocess.Popen(command, stdin=subprocess.PIPE,
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE,
-close_fds=True)
+process = subprocess.Popen(command,
+   stdin=subprocess.PIPE,
+   stdout=subprocess.PIPE,
+   stderr=subprocess.PIPE,
+   close_fds=True)
 else:
-process = subprocess.Popen(command, stdin=subprocess.PIPE,
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
+process = subprocess.Popen(command,
+   stdin=subprocess.PIPE,
+   stdout=subprocess.PIPE,
+   stderr=subprocess.PIPE)
 output = process.communicate()
 exit_status = process.returncode
 passes, failures = parse_test_results(output)
 if exit_status == 0:
-# stdout does not have any useful information from 'dotest.py', only stderr does.
+# stdout does not have any useful information from 'dotest.py',
+# only stderr does.
 report_test_pass(

Re: [Lldb-commits] [PATCH] D11909: Don't print number of failures and percentage if no tests ran.

2015-08-12 Thread Chaoren Lin via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244782: Don't print number of failures and percentage if no 
tests ran. (authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11909?vs=31679&id=31962#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11909

Files:
  lldb/trunk/test/dosep.py

Index: lldb/trunk/test/dosep.py
===
--- lldb/trunk/test/dosep.py
+++ lldb/trunk/test/dosep.py
@@ -443,10 +443,16 @@
 touch(os.path.join(session_dir, "{}-{}".format(result, test_name)))
 
 print
-print "Ran %d test suites (%d failed) (%f%%)" % (num_test_files, 
len(failed),
-(100.0 * len(failed) / num_test_files) if num_test_files > 0 else 
float('NaN'))
-print "Ran %d test cases (%d failed) (%f%%)" % (num_tests, all_fails,
-(100.0 * all_fails / num_tests) if num_tests > 0 else float('NaN'))
+sys.stdout.write("Ran %d test suites" % num_test_files)
+if num_test_files > 0:
+sys.stdout.write(" (%d failed) (%f%%)" % (
+len(failed), 100.0 * len(failed) / num_test_files))
+print
+sys.stdout.write("Ran %d test cases" % num_tests)
+if num_tests > 0:
+sys.stdout.write(" (%d failed) (%f%%)" % (
+all_fails, 100.0 * all_fails / num_tests))
+print
 if len(failed) > 0:
 failed.sort()
 print "Failing Tests (%d)" % len(failed)


Index: lldb/trunk/test/dosep.py
===
--- lldb/trunk/test/dosep.py
+++ lldb/trunk/test/dosep.py
@@ -443,10 +443,16 @@
 touch(os.path.join(session_dir, "{}-{}".format(result, test_name)))
 
 print
-print "Ran %d test suites (%d failed) (%f%%)" % (num_test_files, len(failed),
-(100.0 * len(failed) / num_test_files) if num_test_files > 0 else float('NaN'))
-print "Ran %d test cases (%d failed) (%f%%)" % (num_tests, all_fails,
-(100.0 * all_fails / num_tests) if num_tests > 0 else float('NaN'))
+sys.stdout.write("Ran %d test suites" % num_test_files)
+if num_test_files > 0:
+sys.stdout.write(" (%d failed) (%f%%)" % (
+len(failed), 100.0 * len(failed) / num_test_files))
+print
+sys.stdout.write("Ran %d test cases" % num_tests)
+if num_tests > 0:
+sys.stdout.write(" (%d failed) (%f%%)" % (
+all_fails, 100.0 * all_fails / num_tests))
+print
 if len(failed) > 0:
 failed.sort()
 print "Failing Tests (%d)" % len(failed)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11843: Make dosep output status by overwriting the same line.

2015-08-12 Thread Chaoren Lin via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244781: Make dosep output status by overwriting the same 
line. (authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11843?vs=31703&id=31961#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11843

Files:
  lldb/trunk/test/dosep.py

Index: lldb/trunk/test/dosep.py
===
--- lldb/trunk/test/dosep.py
+++ lldb/trunk/test/dosep.py
@@ -66,41 +66,47 @@
 output_lock = None
 test_counter = None
 total_tests = None
+test_name_len = None
 dotest_options = None
 output_on_success = False
 
-def setup_global_variables(lock, counter, total, options):
-global output_lock, test_counter, total_tests, dotest_options
+def setup_global_variables(lock, counter, total, name_len, options):
+global output_lock, test_counter, total_tests, test_name_len
+global dotest_options
 output_lock = lock
 test_counter = counter
 total_tests = total
+test_name_len = name_len
 dotest_options = options
 
 def report_test_failure(name, command, output):
 global output_lock
 with output_lock:
-print >> sys.stderr, "\n"
+print >> sys.stderr
 print >> sys.stderr, output
+print >> sys.stderr, "[%s FAILED]" % name
 print >> sys.stderr, "Command invoked: %s" % ' '.join(command)
-update_progress(name, "FAILED")
+update_progress(name)
 
 def report_test_pass(name, output):
 global output_lock, output_on_success
 with output_lock:
 if output_on_success:
-print >> sys.stderr, "\n"
+print >> sys.stderr
 print >> sys.stderr, output
-update_progress(name, "PASSED")
+print >> sys.stderr, "[%s PASSED]" % name
+update_progress(name)
 
-def update_progress(test_name, result):
-global output_lock, test_counter, total_tests
+def update_progress(test_name=""):
+global output_lock, test_counter, total_tests, test_name_len
 with output_lock:
-if test_name != None:
-sys.stderr.write("\n[%s %s] - %d out of %d test suites processed" %
-(result, test_name, test_counter.value, total_tests))
-else:
-sys.stderr.write("\n%d out of %d test suites processed" %
-(test_counter.value, total_tests))
+counter_len = len(str(total_tests))
+sys.stderr.write(
+"\r%*d out of %d test suites processed - %-*s" %
+(counter_len, test_counter.value, total_tests,
+ test_name_len.value, test_name))
+if len(test_name) > test_name_len.value:
+test_name_len.value = len(test_name)
 test_counter.value += 1
 sys.stdout.flush()
 sys.stderr.flush()
@@ -157,16 +163,6 @@
 pass_sub_count = 0
 fail_sub_count = 0
 for name in files:
-path = os.path.join(root, name)
-
-# We're only interested in the test file with the "Test*.py" naming pattern.
-if not name.startswith("Test") or not name.endswith(".py"):
-continue
-
-# Neither a symbolically linked file.
-if os.path.islink(path):
-continue
-
 script_file = os.path.join(test_root, "dotest.py")
 command = ([sys.executable, script_file] +
dotest_argv +
@@ -211,21 +207,34 @@
 # Collect the test files that we'll run.
 test_work_items = []
 for root, dirs, files in os.walk(test_subdir, topdown=False):
-test_work_items.append((root, files, test_directory, dotest_argv))
+def is_test(name):
+# Not interested in symbolically linked files.
+if os.path.islink(os.path.join(root, name)):
+return False
+# Only interested in test files with the "Test*.py" naming pattern.
+return name.startswith("Test") and name.endswith(".py")
+
+tests = filter(is_test, files)
+test_work_items.append((root, tests, test_directory, dotest_argv))
 
-global output_lock, test_counter, total_tests
+global output_lock, test_counter, total_tests, test_name_len
 output_lock = multiprocessing.RLock()
-total_tests = len(test_work_items)
+# item = (root, tests, test_directory, dotest_argv)
+total_tests = sum([len(item[1]) for item in test_work_items])
 test_counter = multiprocessing.Value('i', 0)
-print >> sys.stderr, "Testing: %d tests, %d threads" % (total_tests, num_threads)
-update_progress(None, None)
+test_name_len = multiprocessing.Value('i', 0)
+print >> sys.stderr, "Testing: %d test suites, %d thread%s" % (
+total_tests, num_threads, (num_threads > 1) * "s")
+update_progress()
 
 # Run the items, either in a pool (for multicore speedup) or
 # calling each individually.
 if num_threads > 1:
-pool = multiprocessing.Pool(num_threads,
-initializer = setup_global_vari

[Lldb-commits] [PATCH] D11987: Fix to handle AArch64 watchpoint exception before instruction being watched is executed

2015-08-12 Thread Muhammad Omair Javaid via lldb-commits
omjavaid created this revision.
omjavaid added reviewers: tberghammer, clayborg.
omjavaid added a subscriber: lldb-commits.
Herald added subscribers: rengolin, aemerson.

LLDB needs to know whether a watchpoint instruction is executed before or after 
the watchpoint exception is delivered.

This patch fixes this behavior for AArch64 and makes sure lldb disables and 
steps over the watchpoint instruction after watchpoint exception is delivered.

http://reviews.llvm.org/D11987

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -182,7 +182,9 @@
 response.Printf("watchpoint_exceptions_received:after;");
 #else
 if (host_arch.GetMachine() == llvm::Triple::mips64 ||
-host_arch.GetMachine() == llvm::Triple::mips64el)
+host_arch.GetMachine() == llvm::Triple::mips64el ||
+host_arch.GetMachine() == llvm::Triple::aarch64 ||
+host_arch.GetMachine() == llvm::Triple::aarch64_be)
 response.Printf("watchpoint_exceptions_received:before;");
 else
 response.Printf("watchpoint_exceptions_received:after;");


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -182,7 +182,9 @@
 response.Printf("watchpoint_exceptions_received:after;");
 #else
 if (host_arch.GetMachine() == llvm::Triple::mips64 ||
-host_arch.GetMachine() == llvm::Triple::mips64el)
+host_arch.GetMachine() == llvm::Triple::mips64el ||
+host_arch.GetMachine() == llvm::Triple::aarch64 ||
+host_arch.GetMachine() == llvm::Triple::aarch64_be)
 response.Printf("watchpoint_exceptions_received:before;");
 else
 response.Printf("watchpoint_exceptions_received:after;");
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11987: Fix to handle AArch64 watchpoint exception before instruction being watched is executed

2015-08-12 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11987



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


[Lldb-commits] [lldb] r244801 - Fix process_events.py to auto continue the process if we attached so the process doesn't just sit there suspended.

2015-08-12 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Aug 12 15:04:01 2015
New Revision: 244801

URL: http://llvm.org/viewvc/llvm-project?rev=244801&view=rev
Log:
Fix process_events.py to auto continue the process if we attached so the 
process doesn't just sit there suspended.


Modified:
lldb/trunk/examples/python/process_events.py

Modified: lldb/trunk/examples/python/process_events.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/process_events.py?rev=244801&r1=244800&r2=244801&view=diff
==
--- lldb/trunk/examples/python/process_events.py (original)
+++ lldb/trunk/examples/python/process_events.py Wed Aug 12 15:04:01 2015
@@ -171,7 +171,13 @@ def main(argv):
 
 # Make sure the launch went ok
 if process and process.GetProcessID() != 
lldb.LLDB_INVALID_PROCESS_ID:
+
 pid = process.GetProcessID()
+print 'Process is %i' % (pid)
+if attach_info:
+# continue process if we attached as we won't get an 
initial event
+process.Continue()
+
 listener = debugger.GetListener()
 # sign up for process state change events
 stop_idx = 0


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


Re: [Lldb-commits] [PATCH] D11987: Fix to handle AArch64 watchpoint exception before instruction being watched is executed

2015-08-12 Thread Ed Maste via lldb-commits
emaste added a subscriber: emaste.


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:186-187
@@ -186,1 +185,4 @@
+host_arch.GetMachine() == llvm::Triple::mips64el ||
+host_arch.GetMachine() == llvm::Triple::aarch64 ||
+host_arch.GetMachine() == llvm::Triple::aarch64_be)
 response.Printf("watchpoint_exceptions_received:before;");

minor point, but you could put these first in the list to keep them in alpha 
order


http://reviews.llvm.org/D11987



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


[Lldb-commits] [lldb] r244846 - Convert GetNumTemplateArguments() and GetTemplateArgument() to be instance functions on the CompilerType and the TypeSystem

2015-08-12 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Aug 12 19:24:24 2015
New Revision: 244846

URL: http://llvm.org/viewvc/llvm-project?rev=244846&view=rev
Log:
Convert GetNumTemplateArguments() and GetTemplateArgument() to be instance 
functions on the CompilerType and the TypeSystem


Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerType.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/DataFormatters/LibCxxInitializerList.cpp
lldb/trunk/source/DataFormatters/LibCxxList.cpp
lldb/trunk/source/DataFormatters/LibStdcpp.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerType.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=244846&r1=244845&r2=244846&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Wed Aug 12 19:24:24 2015
@@ -805,13 +805,13 @@ public:
bool omit_empty_base_classes,
std::vector& child_indexes) 
override;
 
-static size_t
-GetNumTemplateArguments (const CompilerType& type);
+size_t
+GetNumTemplateArguments (void* type) override;
 
-static CompilerType
-GetTemplateArgument (const CompilerType& type,
+CompilerType
+GetTemplateArgument (void* type,
  size_t idx,
- lldb::TemplateArgumentKind &kind);
+ lldb::TemplateArgumentKind &kind) override;
 
 
 //--

Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=244846&r1=244845&r2=244846&view=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Wed Aug 12 19:24:24 2015
@@ -370,6 +370,13 @@ public:
bool omit_empty_base_classes,
std::vector& child_indexes) const;
 
+size_t
+GetNumTemplateArguments () const;
+
+CompilerType
+GetTemplateArgument (size_t idx,
+ lldb::TemplateArgumentKind &kind) const;
+
 //--
 // Pointers & References
 //--

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=244846&r1=244845&r2=244846&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Wed Aug 12 19:24:24 2015
@@ -215,6 +215,14 @@ public:
bool omit_empty_base_classes,
std::vector& child_indexes) = 0;
 
+virtual size_t
+GetNumTemplateArguments (void * type) = 0;
+
+virtual CompilerType
+GetTemplateArgument (void * type,
+ size_t idx,
+ lldb::TemplateArgumentKind &kind) = 0;
+
 //--
 // Dumping types
 //--

Modified: lldb/trunk/source/API/SBType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=244846&r1=244845&r2=244846&view=diff
==
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Wed Aug 12 19:24:24 2015
@@ -533,7 +533,7 @@ uint32_t
 SBType::GetNumberOfTemplateArguments ()
 {
 if (IsValid())
-return 
ClangASTContext::GetNumTemplateArguments(m_opaque_sp->GetCompilerType(false));
+return m_opaque_sp->GetCompilerType(false).GetNumTemplateArguments();
 return 0;
 }
 
@@ -543,7 +543,7 @@ SBType::GetTemplateArgumentType (uint32_
 if (IsValid())
 {
 TemplateArgumentKind kind = eTemplateArgumentKindNull;
-CompilerType template_arg_type = 
ClangASTContext::GetTemplateArgument(m_opaque_sp->GetCompilerType(false), idx, 
kind);
+CompilerType template_arg_type = 
m_opaque_sp->GetCompilerType(false).GetTemplateArgument(idx, kind);
 if (template_arg_type.IsValid())
 return SBType(template_arg_type);
 }
@@ -556,7 +556,7 @@ SBType::GetTemplateArgumentKind (uint32_
 {
 TemplateArgumentKind kind = eT

[Lldb-commits] [lldb] r244850 - Remove DNBConfig.h

2015-08-12 Thread Bruce Mitchener via lldb-commits
Author: brucem
Date: Wed Aug 12 19:32:01 2015
New Revision: 244850

URL: http://llvm.org/viewvc/llvm-project?rev=244850&view=rev
Log:
Remove DNBConfig.h

Summary:
This was no longer needed and hasn't been needed since r143244
in 2011.  This removes everything associated with generating
or using it.

Reviewers: clayborg, jasonmolenda

Subscribers: lldb-commits

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

Removed:
lldb/trunk/tools/debugserver/scripts/CMakeLists.txt
lldb/trunk/tools/debugserver/scripts/Makefile
lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl
Modified:
lldb/trunk/tools/debugserver/CMakeLists.txt
lldb/trunk/tools/debugserver/Makefile
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
lldb/trunk/tools/debugserver/source/CMakeLists.txt
lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
lldb/trunk/tools/debugserver/source/MacOSX/dbgnub-mig.defs

Modified: lldb/trunk/tools/debugserver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/CMakeLists.txt?rev=244850&r1=244849&r2=244850&view=diff
==
--- lldb/trunk/tools/debugserver/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/CMakeLists.txt Wed Aug 12 19:32:01 2015
@@ -1,3 +1,2 @@
 project(C CXX ASM-ATT)
-add_subdirectory(scripts)
 add_subdirectory(source)

Modified: lldb/trunk/tools/debugserver/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/Makefile?rev=244850&r1=244849&r2=244850&view=diff
==
--- lldb/trunk/tools/debugserver/Makefile (original)
+++ lldb/trunk/tools/debugserver/Makefile Wed Aug 12 19:32:01 2015
@@ -8,6 +8,6 @@
 
##===--===##
 LLDB_LEVEL := ../..
 
-DIRS := scripts source
+DIRS := source
 
-include $(LLDB_LEVEL)/Makefile
\ No newline at end of file
+include $(LLDB_LEVEL)/Makefile

Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=244850&r1=244849&r2=244850&view=diff
==
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj 
(original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Wed Aug 
12 19:32:01 2015
@@ -83,7 +83,6 @@
26ACA3340D3E956300A2120B /* CoreFoundation.framework */ = {isa 
= PBXFileReference; lastKnownFileType = wrapper.framework; name = 
CoreFoundation.framework; path = 
System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
26B67DE00EE9BC30006C8BC0 /* MachTask.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
MachTask.h; sourceTree = ""; };
26B67DE10EE9BC30006C8BC0 /* MachTask.mm */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; 
path = MachTask.mm; sourceTree = ""; };
-   26C636AD0C71303A0024798E /* dbgnub-config.pl */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.perl; path 
= "dbgnub-config.pl"; sourceTree = ""; };
26C637D60C71334A0024798E /* DNB.cpp */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; 
path = DNB.cpp; sourceTree = ""; };
26C637D70C71334A0024798E /* DNB.h */ = {isa = PBXFileReference; 
fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DNB.h; sourceTree 
= ""; };
26C637D80C71334A0024798E /* DNBArch.h */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = 
DNBArch.h; sourceTree = ""; };
@@ -163,7 +162,6 @@
children = (
26ACA3330D3E94F200A2120B /* Framework */,
26C637D50C71334A0024798E /* source */,
-   26C636AC0C71303A0024798E /* scripts */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = dbgnub;
@@ -259,14 +257,6 @@
name = Framework;
sourceTree = "";
};
-   26C636AC0C71303A0024798E /* scripts */ = {
-   isa = PBXGroup;
-   children = (
-   26C636AD0C71303A0024798E /* dbgnub-config.pl */,
-   );
-   path = scripts;
-   sourceTree = "";
-   };
26C637D50C71334A0024798E /* source */ = {
isa = PBXGroup;
children = (
@@ -377,7 

Re: [Lldb-commits] [PATCH] D11971: Remove DNBConfig.h

2015-08-12 Thread Bruce Mitchener via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244850: Remove DNBConfig.h (authored by brucem).

Changed prior to commit:
  http://reviews.llvm.org/D11971?vs=31902&id=32011#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11971

Files:
  lldb/trunk/tools/debugserver/CMakeLists.txt
  lldb/trunk/tools/debugserver/Makefile
  lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
  lldb/trunk/tools/debugserver/scripts/CMakeLists.txt
  lldb/trunk/tools/debugserver/scripts/Makefile
  lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl
  lldb/trunk/tools/debugserver/source/CMakeLists.txt
  lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
  lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
  lldb/trunk/tools/debugserver/source/MacOSX/dbgnub-mig.defs

Index: lldb/trunk/tools/debugserver/source/MacOSX/dbgnub-mig.defs
===
--- lldb/trunk/tools/debugserver/source/MacOSX/dbgnub-mig.defs
+++ lldb/trunk/tools/debugserver/source/MacOSX/dbgnub-mig.defs
@@ -2,15 +2,4 @@
  * nub.defs
  */
  
-/*
- * DNBConfig.h is autogenerated by a perl script that is run as a build
- * script in XCode. XCode is responsible for calling the script and setting
- * the include paths correctly to locate it. The file will exist in the
- * derived sources directory in the build folder.
- *
- */
-
-#include "DNBConfig.h"
-
-
 #import 
Index: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -14,8 +14,7 @@
   ${CMAKE_CURRENT_BINARY_DIR}/mach_excUser.c
   )
 add_custom_command(OUTPUT ${generated_mach_interfaces}
-  COMMAND mig -I${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/dbgnub-mig.defs
-  DEPENDS ${dnbconfig_header}
+  COMMAND mig ${CMAKE_CURRENT_SOURCE_DIR}/dbgnub-mig.defs
   )
 
 set(DEBUGSERVER_VERS_GENERATED_FILE ${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c)
@@ -34,7 +33,6 @@
   )
 
 add_lldb_executable(debugserver
-  ${dnbconfig_header}
   HasAVX.s
   CFBundle.cpp
   CFData.cpp
@@ -57,7 +55,6 @@
   PROPERTIES LANGUAGE C COMPILE_FLAGS "-x assembler-with-cpp"
   )
 
-add_dependencies(debugserver generate_dnbconfig)
 target_link_libraries(debugserver ${DEBUGSERVER_USED_LIBS})
 
 # Sign the debugserver binary
Index: lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
===
--- lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
@@ -17,7 +17,6 @@
 
 #include 
 #include 
-#include "DNBConfig.h"
 
 class MachProcess;
 class PThreadMutex;
Index: lldb/trunk/tools/debugserver/source/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt
@@ -41,7 +41,6 @@
 endif ()
 
 add_library(lldbDebugserverCommon
-  #${dnbconfig_header}
   debugserver.cpp
   DNBArch.cpp
   DNBBreakpoint.cpp
@@ -63,8 +62,6 @@
   TTYState.cpp
   )
 
-add_dependencies(lldbDebugserverCommon generate_dnbconfig)
-
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   find_library(COCOA_LIBRARY Cocoa)
   target_link_libraries(lldbDebugserverCommon ${COCOA_LIBRARY})
Index: lldb/trunk/tools/debugserver/Makefile
===
--- lldb/trunk/tools/debugserver/Makefile
+++ lldb/trunk/tools/debugserver/Makefile
@@ -8,6 +8,6 @@
 ##===--===##
 LLDB_LEVEL := ../..
 
-DIRS := scripts source
+DIRS := source
 
-include $(LLDB_LEVEL)/Makefile
\ No newline at end of file
+include $(LLDB_LEVEL)/Makefile
Index: lldb/trunk/tools/debugserver/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/CMakeLists.txt
@@ -1,3 +1,2 @@
 project(C CXX ASM-ATT)
-add_subdirectory(scripts)
 add_subdirectory(source)
Index: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
===
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
@@ -83,7 +83,6 @@
 		26ACA3340D3E956300A2120B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
 		26B67DE00EE9BC30006C8BC0 /* MachTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachTask.h; sourceTree = ""; };
 		26B67DE10EE9BC30006C8BC0 /* MachTask.mm */ = {isa = PBXFileRefer

[Lldb-commits] [lldb] r244863 - Add missing newline at EOF.

2015-08-12 Thread Bruce Mitchener via lldb-commits
Author: brucem
Date: Wed Aug 12 21:44:40 2015
New Revision: 244863

URL: http://llvm.org/viewvc/llvm-project?rev=244863&view=rev
Log:
Add missing newline at EOF.

This fixes a warning on the Mac OS X build.

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s

Modified: lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s?rev=244863&r1=244862&r2=244863&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s Wed Aug 12 21:44:40 2015
@@ -47,4 +47,4 @@ done:
 #endif
 ret
 // return
 
-#endif
\ No newline at end of file
+#endif


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


[Lldb-commits] [lldb] r244864 - [LLDB][MIPS] Handle false positives for MIPS hardware watchpoints

2015-08-12 Thread Jaydeep Patil via lldb-commits
Author: jaydeep
Date: Wed Aug 12 22:44:09 2015
New Revision: 244864

URL: http://llvm.org/viewvc/llvm-project?rev=244864&view=rev
Log:
[LLDB][MIPS] Handle false positives for MIPS hardware watchpoints
SUMMARY:
Last 3bits of the watchpoint address are masked by the kernel. For example, 
n is 
at 0x120010d00 and m is 0x120010d04. When a watchpoint is set at m, then 
watch 
exception is generated even when n is read/written. To handle this case, 
instruction 
at PC is emulated to find the base address of the load/store instruction. 
This address 
is then appended to the description of the stop-info packet. Client then 
reads this 
information to check whether the user has set a watchpoint on this address.

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

Modified:
lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h
lldb/trunk/include/lldb/Target/StopInfo.h
lldb/trunk/source/Host/common/NativeRegisterContext.cpp
lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h

lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Target/StopInfo.cpp

Modified: lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h?rev=244864&r1=244863&r2=244864&view=diff
==
--- lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h Wed Aug 12 
22:44:09 2015
@@ -111,6 +111,19 @@ public:
 virtual lldb::addr_t
 GetWatchpointAddress (uint32_t wp_index);
 
+// MIPS Linux kernel returns a masked address (last 3bits are masked)
+// when a HW watchpoint is hit. However user may not have set a watchpoint
+// on this address. This function emulates the instruction at PC and 
+// finds the base address used in the load/store instruction. This gives 
the 
+// exact address used to read/write the variable being watched.
+// For example:
+// 'n' is at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set 
at 'm', 
+// then watch exception is generated even when 'n' is read/written. This 
function
+// returns address of 'n' so that client can check whether a watchpoint is 
set
+// on this address or not.
+virtual lldb::addr_t
+GetWatchpointHitAddress (uint32_t wp_index);
+
 virtual bool
 HardwareSingleStep (bool enable);
 

Modified: lldb/trunk/include/lldb/Target/StopInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StopInfo.h?rev=244864&r1=244863&r2=244864&view=diff
==
--- lldb/trunk/include/lldb/Target/StopInfo.h (original)
+++ lldb/trunk/include/lldb/Target/StopInfo.h Wed Aug 12 22:44:09 2015
@@ -161,7 +161,7 @@ public:
 CreateStopReasonWithBreakpointSiteID (Thread &thread, lldb::break_id_t 
break_id, bool should_stop);
 
 static lldb::StopInfoSP
-CreateStopReasonWithWatchpointID (Thread &thread, lldb::break_id_t 
watch_id);
+CreateStopReasonWithWatchpointID (Thread &thread, lldb::break_id_t 
watch_id, lldb::addr_t watch_hit_addr = LLDB_INVALID_ADDRESS);
 
 static lldb::StopInfoSP
 CreateStopReasonWithSignal (Thread &thread, int signo, const char 
*description = nullptr);

Modified: lldb/trunk/source/Host/common/NativeRegisterContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeRegisterContext.cpp?rev=244864&r1=244863&r2=244864&view=diff
==
--- lldb/trunk/source/Host/common/NativeRegisterContext.cpp (original)
+++ lldb/trunk/source/Host/common/NativeRegisterContext.cpp Wed Aug 12 22:44:09 
2015
@@ -334,6 +334,12 @@ NativeRegisterContext::GetWatchpointAddr
 return LLDB_INVALID_ADDRESS;
 }
 
+lldb::addr_t
+NativeRegisterContext::GetWatchpointHitAddress (uint32_t wp_index)
+{
+return LLDB_INVALID_ADDRESS;
+}
+
 bool
 NativeRegisterContext::HardwareSingleStep (bool enable)
 {

Modified: 
lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp?rev=244864&r1=244863&r2=244864&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInst

[Lldb-commits] [lldb] r244865 - [LLDB][MIPS] Support standard GDB remote stop reply packet for watchpoint

2015-08-12 Thread Jaydeep Patil via lldb-commits
Author: jaydeep
Date: Wed Aug 12 22:46:01 2015
New Revision: 244865

URL: http://llvm.org/viewvc/llvm-project?rev=244865&view=rev
Log:
[LLDB][MIPS] Support standard GDB remote stop reply packet for watchpoint
SUMMARY:
The patch supports TAAwatch:addr packet. The patch also sets 
m_watchpoints_trigger_after_instruction 
to eLazyBoolNo when qHostInfo or qWatchpointSupportInfo is not supported by 
the target.

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

Modified:

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

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=244865&r1=244864&r2=244865&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Wed Aug 12 22:46:01 2015
@@ -2473,26 +2473,45 @@ GDBRemoteCommunicationClient::GetWatchpo
 }
 
 lldb_private::Error
-GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num, bool& 
after)
+GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num, bool& 
after, const ArchSpec &arch)
 {
 Error error(GetWatchpointSupportInfo(num));
 if (error.Success())
-error = GetWatchpointsTriggerAfterInstruction(after);
+error = GetWatchpointsTriggerAfterInstruction(after, arch);
 return error;
 }
 
 lldb_private::Error
-GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction (bool 
&after)
+GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction (bool 
&after, const ArchSpec &arch)
 {
 Error error;
+llvm::Triple::ArchType atype = arch.GetMachine();
 
 // we assume watchpoints will happen after running the relevant opcode
 // and we only want to override this behavior if we have explicitly
 // received a qHostInfo telling us otherwise
 if (m_qHostInfo_is_valid != eLazyBoolYes)
-after = true;
+{
+// On targets like MIPS, watchpoint exceptions are always generated 
+// before the instruction is executed. The connected target may not 
+// support qHostInfo or qWatchpointSupportInfo packets.
+if (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel
+|| atype == llvm::Triple::mips64 || atype == 
llvm::Triple::mips64el)
+after = false;
+else
+after = true;
+}
 else
+{
+// For MIPS, set m_watchpoints_trigger_after_instruction to 
eLazyBoolNo 
+// if it is not calculated before.
+if (m_watchpoints_trigger_after_instruction == eLazyBoolCalculate &&
+(atype == llvm::Triple::mips || atype == llvm::Triple::mipsel
+|| atype == llvm::Triple::mips64 || atype == 
llvm::Triple::mips64el))
+m_watchpoints_trigger_after_instruction = eLazyBoolNo;
+
 after = (m_watchpoints_trigger_after_instruction != eLazyBoolNo);
+}
 return error;
 }
 

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=244865&r1=244864&r2=244865&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h 
Wed Aug 12 22:46:01 2015
@@ -287,10 +287,10 @@ public:
 GetWatchpointSupportInfo (uint32_t &num); 
 
 Error
-GetWatchpointSupportInfo (uint32_t &num, bool& after);
+GetWatchpointSupportInfo (uint32_t &num, bool& after, const ArchSpec 
&arch);
 
 Error
-GetWatchpointsTriggerAfterInstruction (bool &after);
+GetWatchpointsTriggerAfterInstruction (bool &after, const ArchSpec &arch);
 
 const ArchSpec &
 GetHostArchitecture ();

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=244865&r1=244864&r2=244865&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Aug 
12 22:46:01 2015
@@ -2484,6 +2484,21 @@ ProcessGDBRemote::SetThreadStopInfo (Str
   

[Lldb-commits] [lldb] r244866 - [LLDB][MIPS] Use qfThreadID if qC packet is not supported by target

2015-08-12 Thread Jaydeep Patil via lldb-commits
Author: jaydeep
Date: Wed Aug 12 22:46:36 2015
New Revision: 244866

URL: http://llvm.org/viewvc/llvm-project?rev=244866&view=rev
Log:
[LLDB][MIPS] Use qfThreadID if qC packet is not supported by target
SUMMARY:
The patch uses qfThreadID to get the thread IDs if qC packet is not 
supported by target.

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

Modified:

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

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=244866&r1=244865&r2=244866&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Wed Aug 12 22:46:36 2015
@@ -1459,6 +1459,21 @@ GDBRemoteCommunicationClient::GetCurrent
 }
 }
 }
+
+// If we don't get a response for $qC, check if $qfThreadID gives us a 
result.
+if (m_curr_pid == LLDB_INVALID_PROCESS_ID)
+{
+std::vector thread_ids;
+bool sequence_mutex_unavailable;
+size_t size;
+size = GetCurrentThreadIDs (thread_ids, 
sequence_mutex_unavailable);
+if (size && sequence_mutex_unavailable == false)
+{
+m_curr_pid = thread_ids.front();
+m_curr_pid_is_valid = eLazyBoolYes;
+return m_curr_pid;
+}
+}
 }
 
 return LLDB_INVALID_PROCESS_ID;


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