[Lldb-commits] [PATCH] D29288: Switch std::call_once to llvm::call_once

2017-02-04 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

Once someone could explain to me why `SymbolFileDWARF::GetCachedSectionData` 
cannot be switched mechanically to `llvm::call_once`, I would like to propose 
this revamped interface to llvm.


Repository:
  rL LLVM

https://reviews.llvm.org/D29288



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


[Lldb-commits] [PATCH] D29288: Switch std::call_once to llvm::call_once

2017-02-04 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

Test results for the above patch for LLVM and LLDB with "mechanical" switch to 
`llvm::call_once`.

  ===
  Test Result Summary
  ===
  Test Methods:   1224
  Reruns:1
  Success: 268
  Expected Failure: 21
  Failure: 324
  Error:   166
  Exceptional Exit:  0
  Unexpected Success:1
  Skip:441
  Timeout:   3
  Expected Timeout:  0

Results from Jan 21st

  ===
  Test Result Summary
  ===
  Test Methods:   1218
  Reruns:1
  Success: 264
  Expected Failure: 20
  Failure: 323
  Error:   166
  Exceptional Exit:  1
  Unexpected Success:1
  Skip:440
  Timeout:   3
  Expected Timeout:  0

It looks good to me. The patch on review with `LLVM_DEFINE_ONCE_FLAG` badly 
timeouts for me and I interrupted it.


Repository:
  rL LLVM

https://reviews.llvm.org/D29288



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


[Lldb-commits] [PATCH] D29288: Switch std::call_once to llvm::call_once

2017-02-04 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

I've tried to build the LLDB code with mechanically * replaced `std::call_once` 
-> `llvm::call_once` and `std::once_flag` -> `llvm::once_flag`:

  --- /public/llvm/include/llvm/Support/Threading.h 2017-02-05 
00:15:00.769574623 +0100
  +++ /usr/pkg/include/llvm/Support/Threading.h 2017-02-05 04:14:03.334251557 
+0100
  @@ -62,12 +62,16 @@
   
 /// This macro is the only way you should define your once flag for LLVM's
 /// call_once.
  -#define LLVM_DEFINE_ONCE_FLAG(flag) static ::llvm::once_flag flag
  +#define LLVM_DEFINE_ONCE_FLAG(flag) static once_flag flag
   
   #else
   
 enum InitStatus { Uninitialized = 0, Wait = 1, Done = 2 };
  -  typedef volatile sys::cas_flag once_flag;
  +  class once_flag {
  +  public:
  +once_flag() : status(::llvm::Uninitialized) {};
  +volatile ::llvm::sys::cas_flag status;
  +  };
   
 /// This macro is the only way you should define your once flag for LLVM's
 /// call_once.
  @@ -96,24 +100,24 @@
   #else
   // For other platforms we use a generic (if brittle) version based on our
   // atomics.
  -sys::cas_flag old_val = sys::CompareAndSwap(, Wait, Uninitialized);
  +sys::cas_flag old_val = sys::CompareAndSwap(, Wait, 
Uninitialized);
   if (old_val == Uninitialized) {
 std::forward(F)(std::forward(ArgList)...);
 sys::MemoryFence();
 TsanIgnoreWritesBegin();
  -  TsanHappensBefore();
  -  flag = Done;
  +  TsanHappensBefore();
  +  flag.status = Done;
 TsanIgnoreWritesEnd();
   } else {
 // Wait until any thread doing the call has finished.
  -  sys::cas_flag tmp = flag;
  +  sys::cas_flag tmp = flag.status;
 sys::MemoryFence();
 while (tmp != Done) {
  -tmp = flag;
  +tmp = flag.status;
   sys::MemoryFence();
 }
   }
  -TsanHappensAfter();
  +TsanHappensAfter();
   #endif
 }
   



- there is one exception, I don't understand:

  const DWARFDataExtractor &
  SymbolFileDWARF::GetCachedSectionData(lldb::SectionType sect_type,
DWARFDataSegment _segment) {
  #if 0
llvm::call_once(data_segment.m_flag, ::LoadSectionData, 
this,
   sect_type, std::ref(data_segment.m_data));
  #else
llvm::call_once(data_segment.m_flag,
  [this, sect_type, _segment] {
this->LoadSectionData(sect_type, std::ref(data_segment.m_data));
  }
);
  #endif
return data_segment.m_data;
  }

This exception is valid for so far all versions of switches out of 
`std::once_flag`.


Repository:
  rL LLVM

https://reviews.llvm.org/D29288



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


[Lldb-commits] [PATCH] D29266: Synchronize PlatformNetBSD with Linux

2017-02-04 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski updated this revision to Diff 87126.
krytarowski added a comment.

Catch up after r294114 - Clean up PlatformLinux code


Repository:
  rL LLVM

https://reviews.llvm.org/D29266

Files:
  source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
  source/Plugins/Platform/NetBSD/PlatformNetBSD.h

Index: source/Plugins/Platform/NetBSD/PlatformNetBSD.h
===
--- source/Plugins/Platform/NetBSD/PlatformNetBSD.h
+++ source/Plugins/Platform/NetBSD/PlatformNetBSD.h
@@ -10,100 +10,57 @@
 #ifndef liblldb_PlatformNetBSD_h_
 #define liblldb_PlatformNetBSD_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_netbsd {
 
-class PlatformNetBSD : public Platform {
+class PlatformNetBSD : public PlatformPOSIX {
 public:
   PlatformNetBSD(bool is_host);
 
-  ~PlatformNetBSD() override = default;
-
-  //
-  // Class functions
-  //
-  static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+  ~PlatformNetBSD() override;
 
   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 _file_spec, const ArchSpec ,
- ModuleSpec _spec) override;
-
-  Error RunShellCommand(const char *command, const FileSpec _dir,
-int *status_ptr, int *signo_ptr,
-std::string *command_output,
-uint32_t timeout_sec) override;
-
-  bool GetRemoteOSVersion() override;
-
-  bool GetRemoteOSBuildString(std::string ) override;
-
-  bool GetRemoteOSKernelDescription(std::string ) override;
-
-  // Remote Platform subclasses need to override this function
-  ArchSpec GetRemoteSystemArchitecture() override;
-
-  bool IsConnected() const override;
-
-  Error ConnectRemote(Args ) override;
-
-  Error DisconnectRemote() override;
-
-  const char *GetHostname() override;
-
-  const char *GetUserName(uint32_t uid) override;
-
-  const char *GetGroupName(uint32_t gid) override;
-
-  Error LaunchProcess(ProcessLaunchInfo _info) override;
+  const char *GetDescription() override {
+return GetPluginDescriptionStatic(IsHost());
+  }
 
-  lldb::ProcessSP Attach(ProcessAttachInfo _info, Debugger ,
- Target *target, Error ) override;
+  void GetStatus(Stream ) override;
 
-  // NetBSD processes can not be launched by spawning and attaching.
-  bool CanDebugProcess() override { return false; }
+  bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec ) override;
 
-  Error GetSharedModule(const ModuleSpec _spec, Process *process,
-lldb::ModuleSP _sp,
-const FileSpecList *module_search_paths_ptr,
-lldb::ModuleSP *old_module_sp_ptr,
-bool *did_create_ptr) override;
+  int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo _info) override;
 
-  bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec ) override;
+  bool CanDebugProcess() override;
 
-  void GetStatus(Stream ) override;
+  lldb::ProcessSP DebugProcess(ProcessLaunchInfo _info,
+   Debugger , Target *target,
+   Error ) override;
 
   void CalculateTrapHandlerSymbolNames() override;
 
-protected:
-  lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a
- // remote netbsd OS
+  uint64_t ConvertMmapFlagsToPlatform(const ArchSpec ,
+  unsigned flags) override;
 
 private:
   DISALLOW_COPY_AND_ASSIGN(PlatformNetBSD);
Index: source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
===
--- 

[Lldb-commits] [PATCH] D29266: Synchronize PlatformNetBSD with Linux

2017-02-04 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

I'm syncing the code to get the changes from SVN revision 294114 "Clean up 
PlatformLinux code"


Repository:
  rL LLVM

https://reviews.llvm.org/D29266



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