[Lldb-commits] [PATCH] D29352: [CMake] Final dependency cleanup patch!

2017-02-07 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks great.


https://reviews.llvm.org/D29352



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


[Lldb-commits] [PATCH] D29667: Synchronize PlatformFreeBSD with Linux

2017-02-07 Thread Ed Maste via Phabricator via lldb-commits
emaste created this revision.

Inspired by https://reviews.llvm.org/rL294145 (https://reviews.llvm.org/D29266) 
for NetBSD, this reduces diffs between the FreeBSD and Linux/NetBSD Platform 
implementations. Further diff reduction will occur once FreeBSD switches to 
using the remote process plugin.

(Recreated to add lldb-commits)


https://reviews.llvm.org/D29667

Files:
  source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h

Index: source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
===
--- source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -10,103 +10,59 @@
 #ifndef liblldb_PlatformFreeBSD_h_
 #define liblldb_PlatformFreeBSD_h_
 
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Target/Platform.h"
+#include "Plugins/Platform/POSIX/PlatformPOSIX.h"
 
 namespace lldb_private {
 namespace platform_freebsd {
 
-class PlatformFreeBSD : public Platform {
+class PlatformFreeBSD : public PlatformPOSIX {
 public:
   PlatformFreeBSD(bool is_host);
 
   ~PlatformFreeBSD() override;
 
-  //
-  // Class functions
-  //
-  static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
-
   static void Initialize();
 
   static void Terminate();
 
-  static ConstString GetPluginNameStatic(bool is_host);
-
-  static const char *GetDescriptionStatic(bool is_host);
-
   //
   // lldb_private::PluginInterface functions
   //
-  ConstString GetPluginName() override { return GetPluginNameStatic(IsHost()); }
+  static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
 
-  uint32_t GetPluginVersion() override { return 1; }
+  static ConstString GetPluginNameStatic(bool is_host);
 
-  const char *GetDescription() override {
-return GetDescriptionStatic(IsHost());
-  }
+  static const char *GetPluginDescriptionStatic(bool is_host);
+
+  ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override { return 1; }
 
   //
   // lldb_private::Platform functions
   //
-  bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
- ModuleSpec &module_spec) override;
-
-  Error RunShellCommand(const char *command, const FileSpec &working_dir,
-int *status_ptr, int *signo_ptr,
-std::string *command_output,
-uint32_t timeout_sec) override;
-
-  size_t GetSoftwareBreakpointTrapOpcode(Target &target,
- BreakpointSite *bp_site) override;
-
-  bool GetRemoteOSVersion() override;
-
-  bool GetRemoteOSBuildString(std::string &s) override;
-
-  bool GetRemoteOSKernelDescription(std::string &s) override;
-
-  // Remote Platform subclasses need to override this function
-  ArchSpec GetRemoteSystemArchitecture() override;
-
-  bool IsConnected() const override;
-
-  Error ConnectRemote(Args &args) override;
+  const char *GetDescription() override {
+return GetPluginDescriptionStatic(IsHost());
+  }
 
-  Error DisconnectRemote() override;
+  void GetStatus(Stream &strm) override;
 
-  const char *GetHostname() override;
+  bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override;
 
-  const char *GetUserName(uint32_t uid) override;
+  bool CanDebugProcess() override;
 
-  const char *GetGroupName(uint32_t gid) override;
+  size_t GetSoftwareBreakpointTrapOpcode(Target &target,
+ BreakpointSite *bp_site) override;
 
   Error LaunchProcess(ProcessLaunchInfo &launch_info) override;
 
   lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
  Target *target, Error &error) override;
 
-  // FreeBSD processes can not be launched by spawning and attaching.
-  bool CanDebugProcess() override { return false; }
-
-  Error GetSharedModule(const ModuleSpec &module_spec, Process *process,
-lldb::ModuleSP &module_sp,
-const FileSpecList *module_search_paths_ptr,
-lldb::ModuleSP *old_module_sp_ptr,
-bool *did_create_ptr) override;
-
-  bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override;
-
-  void GetStatus(Stream &strm) override;
-
   void CalculateTrapHandlerSymbolNames() override;
 
-protected:
-  lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a
- // remote freebsd OS
+  uint64_t ConvertMmapFl

[Lldb-commits] [PATCH] D29667: Synchronize PlatformFreeBSD with Linux

2017-02-07 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

cool


https://reviews.llvm.org/D29667



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


[Lldb-commits] [lldb] r294340 - Synchronize PlatformFreeBSD with Linux

2017-02-07 Thread Ed Maste via lldb-commits
Author: emaste
Date: Tue Feb  7 13:29:10 2017
New Revision: 294340

URL: http://llvm.org/viewvc/llvm-project?rev=294340&view=rev
Log:
Synchronize PlatformFreeBSD with Linux

Inspired by r294145 for NetBSD, this reduces diffs between the FreeBSD
and Linux/NetBSD Platform implementations. Further diff reduction will
occur once FreeBSD switches to using the remote process plugin.

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

Modified:
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h

Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=294340&r1=294339&r2=294340&view=diff
==
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Tue Feb  7 
13:29:10 2017
@@ -22,22 +22,34 @@
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/BreakpointSite.h"
 #include "lldb/Core/Debugger.h"
-#include "lldb/Core/Module.h"
-#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
-#include "lldb/Host/Host.h"
+#include "lldb/Core/State.h"
+#include "lldb/Host/FileSpec.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Utility/Error.h"
+#include "lldb/Utility/StreamString.h"
+
+// Define these constants from FreeBSD mman.h for use when targeting
+// remote FreeBSD systems even when host has different values.
+#define MAP_PRIVATE 0x0002
+#define MAP_ANON 0x1000
 
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::platform_freebsd;
 
+static uint32_t g_initialize_count = 0;
+
+//--
+
 PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) {
-  // The only time we create an instance is when we are creating a remote
-  // freebsd platform
-  const bool is_host = false;
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
+  LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
+   arch ? arch->GetArchitectureName() : "",
+   arch ? arch->GetTriple().getTriple() : "");
 
   bool create = force;
   if (create == false && arch && arch->IsValid()) {
@@ -59,8 +71,10 @@ PlatformSP PlatformFreeBSD::CreateInstan
   break;
 }
   }
-  if (create)
-return PlatformSP(new PlatformFreeBSD(is_host));
+  LLDB_LOG(log, "create = {0}", create);
+  if (create) {
+return PlatformSP(new PlatformFreeBSD(false));
+  }
   return PlatformSP();
 }
 
@@ -74,221 +88,51 @@ ConstString PlatformFreeBSD::GetPluginNa
   }
 }
 
-const char *PlatformFreeBSD::GetDescriptionStatic(bool is_host) {
+const char *PlatformFreeBSD::GetPluginDescriptionStatic(bool is_host) {
   if (is_host)
 return "Local FreeBSD user platform plug-in.";
   else
 return "Remote FreeBSD user platform plug-in.";
 }
 
-static uint32_t g_initialize_count = 0;
+ConstString PlatformFreeBSD::GetPluginName() {
+  return GetPluginNameStatic(IsHost());
+}
 
 void PlatformFreeBSD::Initialize() {
   Platform::Initialize();
 
   if (g_initialize_count++ == 0) {
 #if defined(__FreeBSD__)
-// Force a host flag to true for the default platform object.
 PlatformSP default_platform_sp(new PlatformFreeBSD(true));
 default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
 Platform::SetHostPlatform(default_platform_sp);
 #endif
-PluginManager::RegisterPlugin(PlatformFreeBSD::GetPluginNameStatic(false),
-  PlatformFreeBSD::GetDescriptionStatic(false),
-  PlatformFreeBSD::CreateInstance);
+PluginManager::RegisterPlugin(
+PlatformFreeBSD::GetPluginNameStatic(false),
+PlatformFreeBSD::GetPluginDescriptionStatic(false),
+PlatformFreeBSD::CreateInstance, nullptr);
   }
 }
 
 void PlatformFreeBSD::Terminate() {
-  if (g_initialize_count > 0 && --g_initialize_count == 0)
-PluginManager::UnregisterPlugin(PlatformFreeBSD::CreateInstance);
-
-  Platform::Terminate();
-}
-
-bool PlatformFreeBSD::GetModuleSpec(const FileSpec &module_file_spec,
-const ArchSpec &arch,
-ModuleSpec &module_spec) {
-  if (m_remote_platform_sp)
-return m_remote_platform_sp->GetModuleSpec(module_file_spec, arch,
-   module_spec);
-
-  return Platform::GetModuleSpec(module_file_spec, arch, module_spec);
-}
-
-Error PlatformFreeBSD::RunShellCommand(const char *command,
-   const FileSpec &working_dir,
-   int *status_ptr, int *signo_ptr,
-

[Lldb-commits] [PATCH] D29667: Synchronize PlatformFreeBSD with Linux

2017-02-07 Thread Ed Maste via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294340: Synchronize PlatformFreeBSD with Linux (authored by 
emaste).

Changed prior to commit:
  https://reviews.llvm.org/D29667?vs=87482&id=87490#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29667

Files:
  lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h

Index: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
===
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -10,103 +10,59 @@
 #ifndef liblldb_PlatformFreeBSD_h_
 #define liblldb_PlatformFreeBSD_h_
 
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Target/Platform.h"
+#include "Plugins/Platform/POSIX/PlatformPOSIX.h"
 
 namespace lldb_private {
 namespace platform_freebsd {
 
-class PlatformFreeBSD : public Platform {
+class PlatformFreeBSD : public PlatformPOSIX {
 public:
   PlatformFreeBSD(bool is_host);
 
   ~PlatformFreeBSD() override;
 
-  //
-  // Class functions
-  //
-  static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
-
   static void Initialize();
 
   static void Terminate();
 
-  static ConstString GetPluginNameStatic(bool is_host);
-
-  static const char *GetDescriptionStatic(bool is_host);
-
   //
   // lldb_private::PluginInterface functions
   //
-  ConstString GetPluginName() override { return GetPluginNameStatic(IsHost()); }
+  static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
 
-  uint32_t GetPluginVersion() override { return 1; }
+  static ConstString GetPluginNameStatic(bool is_host);
 
-  const char *GetDescription() override {
-return GetDescriptionStatic(IsHost());
-  }
+  static const char *GetPluginDescriptionStatic(bool is_host);
+
+  ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override { return 1; }
 
   //
   // lldb_private::Platform functions
   //
-  bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
- ModuleSpec &module_spec) override;
-
-  Error RunShellCommand(const char *command, const FileSpec &working_dir,
-int *status_ptr, int *signo_ptr,
-std::string *command_output,
-uint32_t timeout_sec) override;
-
-  size_t GetSoftwareBreakpointTrapOpcode(Target &target,
- BreakpointSite *bp_site) override;
-
-  bool GetRemoteOSVersion() override;
-
-  bool GetRemoteOSBuildString(std::string &s) override;
-
-  bool GetRemoteOSKernelDescription(std::string &s) override;
-
-  // Remote Platform subclasses need to override this function
-  ArchSpec GetRemoteSystemArchitecture() override;
-
-  bool IsConnected() const override;
-
-  Error ConnectRemote(Args &args) override;
+  const char *GetDescription() override {
+return GetPluginDescriptionStatic(IsHost());
+  }
 
-  Error DisconnectRemote() override;
+  void GetStatus(Stream &strm) override;
 
-  const char *GetHostname() override;
+  bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override;
 
-  const char *GetUserName(uint32_t uid) override;
+  bool CanDebugProcess() override;
 
-  const char *GetGroupName(uint32_t gid) override;
+  size_t GetSoftwareBreakpointTrapOpcode(Target &target,
+ BreakpointSite *bp_site) override;
 
   Error LaunchProcess(ProcessLaunchInfo &launch_info) override;
 
   lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
  Target *target, Error &error) override;
 
-  // FreeBSD processes can not be launched by spawning and attaching.
-  bool CanDebugProcess() override { return false; }
-
-  Error GetSharedModule(const ModuleSpec &module_spec, Process *process,
-lldb::ModuleSP &module_sp,
-const FileSpecList *module_search_paths_ptr,
-lldb::ModuleSP *old_module_sp_ptr,
-bool *did_create_ptr) override;
-
-  bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override;
-
-  void GetStatus(Stream &strm) override;
-
   void CalculateTrapHandlerSymbolNames() override;
 
-protected:
-  lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a
- // remote freebsd OS
+  uint64_t ConvertMmapFlagsToPlatfo

[Lldb-commits] [PATCH] D29669: Hardware breakpoints implementation for AArch64 targets

2017-02-07 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid created this revision.
Herald added subscribers: mgorny, danalbert, rengolin, aemerson.

This patch implements hardware breakpoint functionality in LLDB for AArch64 
targets. AArch64 targets supports hardware breakpoints via ptrace interface 
similar to hardware watchpoints. Hardware breakpoints provide fast way to stop 
target not requiring any memory read/write like software breakpoints.

This patch fixes areas which required tweaking to put hardware breakpoints 
implementation in place via process gdb remote. We are able to test these 
breakpoints via a simple application on Android Nexux5x devices.

I am in process of testing on various other platforms and also writing lldb 
testsuite test cases.

Still on TODO list:

1. LLDB Testsuite testcases for hardware breakpoints testing.
2. Similar implementation for Arm targets.
3. Improve stepping speed by trying to use hardware in place of software 
breakpoints which single step is being done via breakpoints.

Looking forward to upstream comments on this.

Test code in case someone wants to test:

#include 
#include 
#include 

#define THREAD_COUNT 8

void *thread_function( void *ptr )
{

  int *argument = (int *) ptr;
  
  printf("Thread #%i \n", *argument);

}

int main()
{

  int argument[THREAD_COUNT];
  pthread_t thread_handle[THREAD_COUNT];
  
  int i;
  for (i = 0; i < THREAD_COUNT; i++)
  { 
argument[i] = i;
if (pthread_create( &thread_handle[i], NULL, thread_function, (void*) 
&argument[i]))
{
  printf("Error - pthread_create() failed\n");
  exit(EXIT_FAILURE);
}
  }
  
  for (i = 0; i < THREAD_COUNT; i++)
pthread_join( thread_handle[i], NULL);
  
  exit(EXIT_SUCCESS);
  
  return 0;

}


https://reviews.llvm.org/D29669

Files:
  include/lldb/Host/common/HardwareBreakpointList.h
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/Host/common/NativeRegisterContext.h
  include/lldb/Host/common/NativeThreadProtocol.h
  source/Host/CMakeLists.txt
  source/Host/common/HardwareBreakpointList.cpp
  source/Host/common/NativeProcessProtocol.cpp
  source/Host/common/NativeRegisterContext.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  source/Plugins/Process/Linux/NativeThreadLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -2531,12 +2531,14 @@
 packet, "Too short z packet, missing software/hardware specifier");
 
   bool want_breakpoint = true;
+  bool want_hardware = false;
 
   const GDBStoppointType stoppoint_type =
   GDBStoppointType(packet.GetS32(eStoppointInvalid));
   switch (stoppoint_type) {
   case eBreakpointHardware:
 want_breakpoint = true;
+want_hardware = true;
 break;
   case eBreakpointSoftware:
 want_breakpoint = true;
@@ -2579,7 +2581,8 @@
 
   if (want_breakpoint) {
 // Try to clear the breakpoint.
-const Error error = m_debugged_process_sp->RemoveBreakpoint(addr);
+const Error error =
+m_debugged_process_sp->RemoveBreakpoint(addr, want_hardware);
 if (error.Success())
   return SendOKResponse();
 Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
@@ -3037,9 +3040,14 @@
   if (packet.GetChar() != ':')
 return SendErrorResponse(67);
 
-  uint32_t num = m_debugged_process_sp->GetMaxWatchpoints();
+  uint32_t bp_max = 0, wp_max = 0;
+  if (!m_debugged_process_sp->GetHardwareDebugSupportInfo(bp_max, wp_max)) {
+bp_max = 0;
+wp_max = 0;
+  }
+
   StreamGDBRemote response;
-  response.Printf("num:%d;", num);
+  response.Printf("num:%d;", wp_max);
   return SendPacketNoLock(response.GetString());
 }
 
Index: source/Plugins/Process/Linux/NativeThreadLinux.h
===
--- source/Plugins/Process/Linux/NativeThreadLinux.h
+++ source/Plugins/Process/Linux/NativeThreadLinux.h
@@ -46,6 +46,10 @@
 
   Error RemoveWatchpoint(lldb::addr_t addr) override;
 
+  Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
+
+  Error RemoveHardwareBreakpoint(lldb::addr_t addr) override;
+
 private:
   // -
   // Interface for friend classes
@@ -102,6 +106,7 @@
   std::string m_stop_description;
   using WatchpointIndexMap = std::map;
   WatchpointIndexMap m_watchpoint_index_map;
+  WatchpointIndexMap m_hw_break_index_map;
   llvm::Optional m_step_workaround;
 };
 
Index: source/Plugins/Process/Linux/NativeThreadLinux.cpp
===

[Lldb-commits] [PATCH] D29669: Hardware breakpoints implementation for AArch64 targets

2017-02-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Don't be intimidated by the number of comments :) - I think the change looks 
reasonable as a whole - most of them are just about style and come from the 
fact you were probably working on the patch while I was refactoring this code. 
As for tests, what I'd definitely want to see is a lldb-server-style test, 
which tests just the server changes without the client part (maybe you we're 
already talking about those - I just want to make sure we're on the same page).

As for the stepping speed, do you have any data which shows that this is 
actually a bottleneck in those operations? (I'm not against doing that, I'm 
just curious).




Comment at: include/lldb/Host/common/HardwareBreakpointList.h:24
+
+class HardwareBreakpointList {
+public:

What's the benefit of this class over using `std::map` directly?



Comment at: source/Host/common/NativeProcessProtocol.cpp:142
 
-uint32_t NativeProcessProtocol::GetMaxWatchpoints() const {
+bool NativeProcessProtocol::GetHardwareDebugSupportInfo(
+uint32_t &breakpoints, uint32_t &watchpoints) const {

`llvm::Optional> GetHardwareDebugSupportInfo()`



Comment at: source/Host/common/NativeProcessProtocol.cpp:145
   // This default implementation will return the number of
   // *hardware* breakpoints available.  MacOSX and other OS
   // implementations that support software breakpoints will want to

This comment needs update



Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:875
+error = thread.GetRegisterContext()->GetHardwareBreakHitIndex(
+wp_index, (uintptr_t)info.si_addr);
+if (error.Fail())

Please rename the wp_index variable to something more generic if you're going 
to use it here.



Comment at: 
source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:367
+
+  if (log)
+log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);

Please use LLDB_LOG here.



Comment at: 
source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:384
 size_t size) {
-  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
   LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size);

Please use POSIX_LOG_BREAKPOINTS here (the code in the NativeProcessLinux 
plugin was using a combination of posix and lldb log channels, so i've 
standardized it on posix).



Comment at: 
source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:414
+} else if (m_hbr_regs[i].address == addr) {
+  return LLDB_INVALID_INDEX32; // We do not support duplicate watchpoints.
 }

s/watchpoints/breakpoints/ ?



Comment at: source/Plugins/Process/Linux/NativeThreadLinux.cpp:246
 
+  // Set all active hardware breakpoint on all threads.
+  if (m_hw_break_index_map.empty()) {

This doesn't appear to be setting the breakpoint on *all* threads (and it 
probably shouldnt)


https://reviews.llvm.org/D29669



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


[Lldb-commits] [lldb] r294372 - [CMake] Add explicit dependencies for ObjectFileELF tests

2017-02-07 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Feb  7 17:33:58 2017
New Revision: 294372

URL: http://llvm.org/viewvc/llvm-project?rev=294372&view=rev
Log:
[CMake] Add explicit dependencies for ObjectFileELF tests

Modified:
lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt

Modified: lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt?rev=294372&r1=294371&r2=294372&view=diff
==
--- lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt (original)
+++ lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt Tue Feb  7 17:33:58 2017
@@ -1,3 +1,7 @@
 add_lldb_unittest(ObjectFileELFTests
   TestELFHeader.cpp
+
+  LINK_LIBS
+lldbPluginObjectFileELF
+lldbCore
   )


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


[Lldb-commits] [PATCH] D29352: [CMake] Final dependency cleanup patch!

2017-02-07 Thread Chris Bieneman via Phabricator via lldb-commits
beanz added a comment.

Ok. I think this patch is fully ready to go now. I added the missing 
dependencies in the ObjectFileELF tests in https://reviews.llvm.org/rL294372.

Thank you @labath for all your patience and help testing this patch. I've 
tested it on Darwin and FreeBSD in the current incarnation. I'm going to try 
and land it tomorrow, and I will resolve any issues the bots encounter.


https://reviews.llvm.org/D29352



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


[Lldb-commits] [lldb] r294415 - [LLDB][MIPS] Fix TestMiniDumpNew

2017-02-07 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Wed Feb  8 01:29:24 2017
New Revision: 294415

URL: http://llvm.org/viewvc/llvm-project?rev=294415&view=rev
Log:
[LLDB][MIPS] Fix TestMiniDumpNew

Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=294415&r1=294414&r2=294415&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 Wed Feb  8 01:29:24 2017
@@ -23,6 +23,14 @@ class MiniDumpNewTestCase(TestBase):
 _linux_x86_64_not_crashed_pid = 29939
 _linux_x86_64_not_crashed_pid_offset = 0xD967
 
+def setUp(self):
+super(MiniDumpNewTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MiniDumpNewTestCase, self).tearDown()
+
 def test_process_info_in_minidump(self):
 """Test that lldb can read the process information from the 
Minidump."""
 # target create -c linux-x86_64.dmp


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


[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

2017-02-07 Thread Nitesh Jain via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294415: [LLDB][MIPS] Fix TestMiniDumpNew (authored by 
nitesh.jain).

Changed prior to commit:
  https://reviews.llvm.org/D29215?vs=86268&id=87598#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29215

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py


Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -23,6 +23,14 @@
 _linux_x86_64_not_crashed_pid = 29939
 _linux_x86_64_not_crashed_pid_offset = 0xD967
 
+def setUp(self):
+super(MiniDumpNewTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MiniDumpNewTestCase, self).tearDown()
+
 def test_process_info_in_minidump(self):
 """Test that lldb can read the process information from the 
Minidump."""
 # target create -c linux-x86_64.dmp


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -23,6 +23,14 @@
 _linux_x86_64_not_crashed_pid = 29939
 _linux_x86_64_not_crashed_pid_offset = 0xD967
 
+def setUp(self):
+super(MiniDumpNewTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MiniDumpNewTestCase, self).tearDown()
+
 def test_process_info_in_minidump(self):
 """Test that lldb can read the process information from the Minidump."""
 # target create -c linux-x86_64.dmp
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r294418 - [LLDB][MIPS] Fix TestMiExec and TestMiData failures

2017-02-07 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Wed Feb  8 01:42:56 2017
New Revision: 294418

URL: http://llvm.org/viewvc/llvm-project?rev=294418&view=rev
Log:
[LLDB][MIPS] Fix TestMiExec and TestMiData failures

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=294418&r1=294417&r2=294418&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Wed Feb  8 01:42:56 
2017
@@ -1227,6 +1227,13 @@ class Base(unittest2.TestCase):
 # (enables reading of the current test configuration)
 # 
 
+def isMIPS(self):
+"""Returns true if the architecture is MIPS."""
+arch = self.getArchitecture()
+if re.match("mips", arch):
+return True
+return False
+
 def getArchitecture(self):
 """Returns the architecture in effect the test suite is running 
with."""
 module = builder_module()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py?rev=294418&r1=294417&r2=294418&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py 
Wed Feb  8 01:42:56 2017
@@ -260,7 +260,7 @@ class MiExecTestCase(lldbmi_testcase.MiT
 self.expect("\^running")
 # Depending on compiler, it can stop at different line
 self.expect(
-
"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30|31)\"")
+
"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(28|29|30|31)\"")
 
 # Test that an invalid --thread is handled
 self.runCmd("-exec-next-instruction --thread 0")
@@ -382,7 +382,17 @@ class MiExecTestCase(lldbmi_testcase.MiT
 
 # Test that -exec-step-instruction steps into g_MyFunction
 # instruction (and that --thread is optional)
-self.runCmd("-exec-step-instruction --frame 0")
+
+# In case of MIPS, there might be more than one instruction
+# before actual call instruction (like load, move and call 
instructions).
+# The -exec-step-instruction would step one assembly instruction.
+# Thus we may not enter into g_MyFunction function. The -exec-step 
would definitely
+# step into the function.
+
+if self.isMIPS():
+self.runCmd("-exec-step --frame 0")
+else:
+self.runCmd("-exec-step-instruction --frame 0")
 self.expect("\^running")
 self.expect(
 
"\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py?rev=294418&r1=294417&r2=294418&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py 
Wed Feb  8 01:42:56 2017
@@ -77,7 +77,13 @@ class MiDataTestCase(lldbmi_testcase.MiT
 # Linux:  
{address="0x00400642",func-name="hello_world()",offset="18",size="5",inst="callq
 0x4004d0; symbol stub for: printf"}
 # To match the escaped characters in the ouptut, we must use four 
backslashes per matches backslash
 # See https://docs.python.org/2/howto/regex.html#the-backslash-plague
-
self.expect(["{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?;
 \"Hello, World!n\"\"}",
+
+# The MIPS disassembler never prints stub name 
+if self.isMIPS():
+
self.expect(["{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?;
 \"Hello, World!n\"\"}",
+ 
"{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?\"}"])
+else:
+
self.expect(["{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?;
 \"Hello, World!n\"\"}