[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 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.

Heh... I did not expect it would get this small, but ok. :)


Repository:
  rL LLVM

https://reviews.llvm.org/D31138



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


[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski updated this revision to Diff 92490.
krytarowski edited the summary of this revision.
krytarowski added a comment.

Cut down the unused functions from the Native Process NetBSD Plugin.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138

Files:
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/NetBSD/CMakeLists.txt
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -17,6 +17,7 @@
 if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
 include_directories(
   ../../../../llvm/include
+  ../../source/Plugins/Process/NetBSD
   ../../source/Plugins/Process/POSIX
   )
 endif ()
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -0,0 +1,31 @@
+//===-- NativeThreadNetBSD.h -- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_NativeThreadNetBSD_H_
+#define liblldb_NativeThreadNetBSD_H_
+
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeProcessNetBSD;
+
+class NativeThreadNetBSD : public NativeThreadProtocol {
+  friend class NativeProcessNetBSD;
+
+public:
+  NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
+};
+
+typedef std::shared_ptr NativeThreadNetBSDSP;
+} // namespace process_netbsd
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_NativeThreadNetBSD_H_
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -0,0 +1,21 @@
+//===-- NativeThreadNetBSD.cpp  -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "NativeThreadNetBSD.h"
+#include "NativeRegisterContextNetBSD.h"
+
+#include "NativeProcessNetBSD.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_netbsd;
+
+NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process,
+   lldb::tid_t tid)
+: NativeThreadProtocol(process, tid) {}
Index: source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
@@ -0,0 +1,41 @@
+//===-- NativeRegisterContextNetBSD.h ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef lldb_NativeRegisterContextNetBSD_h
+#define lldb_NativeRegisterContextNetBSD_h
+
+#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+#include "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeRegisterContextNetBSD : public NativeRegisterContextRegisterInfo {
+public:
+  NativeRegisterContextNetBSD(NativeThreadProtocol _thread,
+  uint32_t concrete_frame_idx,
+  RegisterInfoInterface *reg_info_interface_p);
+
+  // This function is implemented in the NativeRegisterContextNetBSD_*
+  // subclasses to create a new instance of the host specific
+  // NativeRegisterContextNetBSD. The implementations can't collide as only one
+  // NativeRegisterContextNetBSD_* variant should be compiled into the final
+  // executable.
+  static NativeRegisterContextNetBSD *
+  CreateHostNativeRegisterContextNetBSD(const ArchSpec _arch,
+NativeThreadProtocol _thread,
+uint32_t concrete_frame_idx);
+};
+
+} // namespace process_netbsd
+} // namespace 

[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski updated this revision to Diff 92492.
krytarowski added a comment.

Style fix.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138

Files:
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/NetBSD/CMakeLists.txt
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -17,6 +17,7 @@
 if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
 include_directories(
   ../../../../llvm/include
+  ../../source/Plugins/Process/NetBSD
   ../../source/Plugins/Process/POSIX
   )
 endif ()
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -0,0 +1,31 @@
+//===-- NativeThreadNetBSD.h -- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_NativeThreadNetBSD_H_
+#define liblldb_NativeThreadNetBSD_H_
+
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeProcessNetBSD;
+
+class NativeThreadNetBSD : public NativeThreadProtocol {
+  friend class NativeProcessNetBSD;
+
+public:
+  NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
+};
+
+typedef std::shared_ptr NativeThreadNetBSDSP;
+} // namespace process_netbsd
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_NativeThreadNetBSD_H_
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -0,0 +1,21 @@
+//===-- NativeThreadNetBSD.cpp  -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "NativeThreadNetBSD.h"
+#include "NativeRegisterContextNetBSD.h"
+
+#include "NativeProcessNetBSD.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_netbsd;
+
+NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process,
+   lldb::tid_t tid)
+: NativeThreadProtocol(process, tid) {}
Index: source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
@@ -0,0 +1,41 @@
+//===-- NativeRegisterContextNetBSD.h ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef lldb_NativeRegisterContextNetBSD_h
+#define lldb_NativeRegisterContextNetBSD_h
+
+#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+#include "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeRegisterContextNetBSD : public NativeRegisterContextRegisterInfo {
+public:
+  NativeRegisterContextNetBSD(NativeThreadProtocol _thread,
+  uint32_t concrete_frame_idx,
+  RegisterInfoInterface *reg_info_interface_p);
+
+  // This function is implemented in the NativeRegisterContextNetBSD_*
+  // subclasses to create a new instance of the host specific
+  // NativeRegisterContextNetBSD. The implementations can't collide as only one
+  // NativeRegisterContextNetBSD_* variant should be compiled into the final
+  // executable.
+  static NativeRegisterContextNetBSD *
+  CreateHostNativeRegisterContextNetBSD(const ArchSpec _arch,
+NativeThreadProtocol _thread,
+uint32_t concrete_frame_idx);
+};
+
+} // namespace process_netbsd
+} // namespace lldb_private
+
+#endif // #ifndef lldb_NativeRegisterContextNetBSD_h
Index: 

[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

In https://reviews.llvm.org/D31138#706216, @labath wrote:

> I like the idea of adding boilerplate first, so that we can than better focus 
> on the important stuff later. However, I think you've have gone a bit too far 
> with it -- you introduce a lot of functions I am pretty sure will not be 
> necessary for your case, or that should be handled differently (software 
> single stepping stuff, handling of linux thread stopping, ...).
>
> Could we trim this down to just the functions that are necessary to get this 
> building (basically just virtual overrides -- no private functions or 
> members)? Those can be always added along with the patch that implements 
> them, and then we will be in a better position to review it.


I will go for it. Your idea is good. I originally planned to trim unneeded 
chunks afterwards, but this direction is cleaner.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138



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


[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I like the idea of adding boilerplate first, so that we can than better focus 
on the important stuff later. However, I think you've have gone a bit too far 
with it -- you introduce a lot of functions I am pretty sure will not be 
necessary for your case, or that should be handled differently (software single 
stepping stuff, handling of linux thread stopping, ...).

Could we trim this down to just the functions that are necessary to get this 
building (basically just virtual overrides -- no private functions or members)? 
Those can be always added along with the patch that implements them, and then 
we will be in a better position to review it.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138



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


[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-20 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

I have got a few local changes that conflict with 
https://reviews.llvm.org/D31131, this is why I will hold on them unless 
@kettenis does not intend to land his patch in the coming days.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138



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


[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-20 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski created this revision.
krytarowski added a project: LLDB.
Herald added a subscriber: mgorny.

This is the base for introduction of further features to support Process 
Tracing on NetBSD, in local and remote setup.

This code contains stubs of the needed functions. Their bodies will be added in 
next commits.

The layout of functions is not set in stone and can be changed in future, 
however the current one with set of local patches to fill the missing function 
bodies was used to handle functional debugging session.

This code is also a starting point to synchronize the development with other 
BSDs, Currently only NetBSD is ahead and other can catch up.

Sponsored by 


Repository:
  rL LLVM

https://reviews.llvm.org/D31138

Files:
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/NetBSD/CMakeLists.txt
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -17,6 +17,7 @@
 if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
 include_directories(
   ../../../../llvm/include
+  ../../source/Plugins/Process/NetBSD
   ../../source/Plugins/Process/POSIX
   )
 endif ()
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -0,0 +1,84 @@
+//===-- NativeThreadNetBSD.h -- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_NativeThreadNetBSD_H_
+#define liblldb_NativeThreadNetBSD_H_
+
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeProcessNetBSD;
+
+class NativeThreadNetBSD : public NativeThreadProtocol {
+  friend class NativeProcessNetBSD;
+
+public:
+  NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
+
+  // -
+  // NativeThreadProtocol Interface
+  // -
+  std::string GetName() override;
+
+  lldb::StateType GetState() override;
+
+  bool GetStopReason(ThreadStopInfo _info,
+ std::string ) override;
+
+  NativeRegisterContextSP GetRegisterContext() override;
+
+  Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
+  bool hardware) override;
+
+  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
+  // -
+
+  void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
+
+  void SetStoppedByExec();
+
+  void SetStoppedByTrace();
+
+  void SetStoppedByBreakpoint();
+
+  void SetRunning();
+
+  void SetStepping();
+
+  // -
+  // Private interface
+  // -
+  NativeProcessNetBSD ();
+
+  void SetStopped();
+
+  // -
+  // Member Variables
+  // -
+  lldb::StateType m_state;
+  ThreadStopInfo m_stop_info;
+  NativeRegisterContextSP m_reg_context_sp;
+  std::string m_stop_description;
+};
+
+typedef std::shared_ptr NativeThreadNetBSDSP;
+} // namespace process_netbsd
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_NativeThreadNetBSD_H_
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -0,0 +1,97 @@
+//===-- NativeThreadNetBSD.cpp  -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//