[Lldb-commits] [PATCH] D89181: [lldb] [Process/FreeBSD] Mark methods override in RegisterContext*

2020-10-10 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: emaste, krytarowski.
Herald added subscribers: atanasyan, nemanjai.
mgorny requested review of this revision.

https://reviews.llvm.org/D89181

Files:
  lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.h
  lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
  
lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h
  
lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
  lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h

Index: lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
===
--- lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
+++ lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
@@ -22,13 +22,13 @@
   lldb_private::RegisterInfoInterface *register_info);
 
 protected:
-  bool ReadGPR();
+  bool ReadGPR() override;
 
-  bool ReadFPR();
+  bool ReadFPR() override;
 
-  bool WriteGPR();
+  bool WriteGPR() override;
 
-  bool WriteFPR();
+  bool WriteFPR() override;
 
   // lldb_private::RegisterContext
   bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
@@ -37,39 +37,39 @@
  const lldb_private::RegisterValue &value);
 
   bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
-lldb_private::RegisterValue &value);
+lldb_private::RegisterValue &value) override;
 
   bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
- const lldb_private::RegisterValue &value);
+ const lldb_private::RegisterValue &value) override;
 
-  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
+  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
 
-  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
+  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
 
   uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read,
- bool write);
+ bool write) override;
 
-  bool ClearHardwareWatchpoint(uint32_t hw_index);
+  bool ClearHardwareWatchpoint(uint32_t hw_index) override;
 
-  bool HardwareSingleStep(bool enable);
+  bool HardwareSingleStep(bool enable) override;
 
   // POSIXBreakpointProtocol
-  bool UpdateAfterBreakpoint();
+  bool UpdateAfterBreakpoint() override;
 
-  unsigned GetRegisterIndexFromOffset(unsigned offset);
+  unsigned GetRegisterIndexFromOffset(unsigned offset) override;
 
-  bool IsWatchpointHit(uint32_t hw_index);
+  bool IsWatchpointHit(uint32_t hw_index) override;
 
-  bool ClearWatchpointHits();
+  bool ClearWatchpointHits() override;
 
-  lldb::addr_t GetWatchpointAddress(uint32_t hw_index);
+  lldb::addr_t GetWatchpointAddress(uint32_t hw_index) override;
 
-  bool IsWatchpointVacant(uint32_t hw_index);
+  bool IsWatchpointVacant(uint32_t hw_index) override;
 
   bool SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, bool read,
-  bool write, uint32_t hw_index);
+  bool write, uint32_t hw_index) override;
 
-  uint32_t NumSupportedHardwareWatchpoints();
+  uint32_t NumSupportedHardwareWatchpoints() override;
 
 private:
   ProcessMonitor &GetMonitor();
Index: lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
===
--- lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
+++ lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
@@ -24,17 +24,17 @@
 protected:
   bool IsVMX();
 
-  bool ReadGPR();
+  bool ReadGPR() override;
 
-  bool ReadFPR();
+  bool ReadFPR() override;
 
-  bool ReadVMX();
+  bool ReadVMX() override;
 
-  bool WriteGPR();
+  bool WriteGPR() override;
 
-  bool WriteFPR();
+  bool WriteFPR() override;
 
-  bool WriteVMX();
+  bool WriteVMX() override;
 
   // lldb_private::RegisterContext
   bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
@@ -43,39 +43,39 @@
  const lldb_private::RegisterValue &value);
 
   bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
-lldb_private::RegisterValue &value);
+lldb_private::RegisterValue &value) override;
 
   bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
- const lldb_private::RegisterValue &value);
+ const lldb_private::RegisterValue &value) override;
 
-  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
+  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
 
-  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
+  bool WriteAllRegis

[Lldb-commits] [PATCH] D89182: [lldb] [Process/FreeBSDRemote] Kill process via PT_KILL

2020-10-10 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: emaste, labath, krytarowski.
mgorny requested review of this revision.

Use PT_KILL to kill the stopped process.  This ensures that the process
termination is reported properly and fixes delay/error on killing it.


https://reviews.llvm.org/D89182

Files:
  lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp


Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -404,12 +404,7 @@
 break;
   }
 
-  if (kill(GetID(), SIGKILL) != 0) {
-error.SetErrorToErrno();
-return error;
-  }
-
-  return error;
+  return PtraceWrapper(PT_KILL, m_pid);
 }
 
 Status NativeProcessFreeBSD::GetMemoryRegionInfo(lldb::addr_t load_addr,


Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -404,12 +404,7 @@
 break;
   }
 
-  if (kill(GetID(), SIGKILL) != 0) {
-error.SetErrorToErrno();
-return error;
-  }
-
-  return error;
+  return PtraceWrapper(PT_KILL, m_pid);
 }
 
 Status NativeProcessFreeBSD::GetMemoryRegionInfo(lldb::addr_t load_addr,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] d83cd73 - [lldb] [Process/FreeBSD] Mark methods override in RegisterContext*

2020-10-10 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2020-10-10T18:52:23+02:00
New Revision: d83cd73e9ddf9ba4cc5754560ef9a2abaaa30749

URL: 
https://github.com/llvm/llvm-project/commit/d83cd73e9ddf9ba4cc5754560ef9a2abaaa30749
DIFF: 
https://github.com/llvm/llvm-project/commit/d83cd73e9ddf9ba4cc5754560ef9a2abaaa30749.diff

LOG: [lldb] [Process/FreeBSD] Mark methods override in RegisterContext*

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

Added: 


Modified: 
lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.h

lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h

lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h

lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.h 
b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.h
index 906926fd9194..bb455841dff1 100644
--- 
a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.h
+++ 
b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.h
@@ -20,13 +20,13 @@ class RegisterContextPOSIXProcessMonitor_arm : public 
RegisterContextPOSIX_arm,
   std::unique_ptr register_info);
 
 protected:
-  bool ReadGPR();
+  bool ReadGPR() override;
 
-  bool ReadFPR();
+  bool ReadFPR() override;
 
-  bool WriteGPR();
+  bool WriteGPR() override;
 
-  bool WriteFPR();
+  bool WriteFPR() override;
 
   // lldb_private::RegisterContext
   bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
@@ -35,39 +35,39 @@ class RegisterContextPOSIXProcessMonitor_arm : public 
RegisterContextPOSIX_arm,
  const lldb_private::RegisterValue &value);
 
   bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
-lldb_private::RegisterValue &value);
+lldb_private::RegisterValue &value) override;
 
   bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
- const lldb_private::RegisterValue &value);
+ const lldb_private::RegisterValue &value) override;
 
-  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
+  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
 
-  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
+  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
 
   uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read,
- bool write);
+ bool write) override;
 
-  bool ClearHardwareWatchpoint(uint32_t hw_index);
+  bool ClearHardwareWatchpoint(uint32_t hw_index) override;
 
-  bool HardwareSingleStep(bool enable);
+  bool HardwareSingleStep(bool enable) override;
 
   // POSIXBreakpointProtocol
-  bool UpdateAfterBreakpoint();
+  bool UpdateAfterBreakpoint() override;
 
-  unsigned GetRegisterIndexFromOffset(unsigned offset);
+  unsigned GetRegisterIndexFromOffset(unsigned offset) override;
 
-  bool IsWatchpointHit(uint32_t hw_index);
+  bool IsWatchpointHit(uint32_t hw_index) override;
 
-  bool ClearWatchpointHits();
+  bool ClearWatchpointHits() override;
 
-  lldb::addr_t GetWatchpointAddress(uint32_t hw_index);
+  lldb::addr_t GetWatchpointAddress(uint32_t hw_index) override;
 
-  bool IsWatchpointVacant(uint32_t hw_index);
+  bool IsWatchpointVacant(uint32_t hw_index) override;
 
   bool SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, bool 
read,
-  bool write, uint32_t hw_index);
+  bool write, uint32_t hw_index) override;
 
-  uint32_t NumSupportedHardwareWatchpoints();
+  uint32_t NumSupportedHardwareWatchpoints() override;
 
 private:
   RegisterInfoPOSIX_arm::GPR m_gpr_arm;

diff  --git 
a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
 
b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
index 579fa9d8cebb..dcae1d46de9b 100644
--- 
a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
+++ 
b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
@@ -21,13 +21,13 @@ class RegisterContextPOSIXProcessMonitor_arm64
   std::unique_ptr register_info);
 
 protected:
-  bool ReadGPR();
+  bool ReadGPR() override;
 
-  bool ReadFPR();
+  bool ReadFPR() override;
 
-  bool WriteGPR();
+  bool WriteGPR() override;
 
-  bool WriteFPR();
+  bool WriteFPR() override;
 
   // lldb_private::RegisterContext
   bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
@@ -36,39 +36,39 @@ class RegisterContextPOSIXProcessMonitor_arm64
  const lldb

[Lldb-commits] [lldb] 9a37587 - [lldb] [Process/FreeBSDRemote] Kill process via PT_KILL

2020-10-10 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2020-10-10T18:54:05+02:00
New Revision: 9a37587ee33bcf2fe27b49f48c9ddd8128f8ac13

URL: 
https://github.com/llvm/llvm-project/commit/9a37587ee33bcf2fe27b49f48c9ddd8128f8ac13
DIFF: 
https://github.com/llvm/llvm-project/commit/9a37587ee33bcf2fe27b49f48c9ddd8128f8ac13.diff

LOG: [lldb] [Process/FreeBSDRemote] Kill process via PT_KILL

Use PT_KILL to kill the stopped process.  This ensures that the process
termination is reported properly and fixes delay/error on killing it.

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

Added: 


Modified: 
lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp 
b/lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
index c96e05f238d4..9ff10f856555 100644
--- a/lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ b/lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -404,12 +404,7 @@ Status NativeProcessFreeBSD::Kill() {
 break;
   }
 
-  if (kill(GetID(), SIGKILL) != 0) {
-error.SetErrorToErrno();
-return error;
-  }
-
-  return error;
+  return PtraceWrapper(PT_KILL, m_pid);
 }
 
 Status NativeProcessFreeBSD::GetMemoryRegionInfo(lldb::addr_t load_addr,



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


[Lldb-commits] [lldb] 8dc2faf - [lldb] [Process/FreeBSDRemote] Fix double semicolon

2020-10-10 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2020-10-10T18:54:52+02:00
New Revision: 8dc2faf642b720c7abad06fd4cea51e6b4333cfe

URL: 
https://github.com/llvm/llvm-project/commit/8dc2faf642b720c7abad06fd4cea51e6b4333cfe
DIFF: 
https://github.com/llvm/llvm-project/commit/8dc2faf642b720c7abad06fd4cea51e6b4333cfe.diff

LOG: [lldb] [Process/FreeBSDRemote] Fix double semicolon

Added: 


Modified: 
lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp 
b/lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
index 9ff10f856555..4a50d8e4b960 100644
--- a/lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ b/lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -491,7 +491,7 @@ Status NativeProcessFreeBSD::PopulateMemoryRegionCache() {
 return Status("sysctl() for KERN_PROC_VMMAP failed");
   }
 
-  char *bp = buf->getBufferStart();;
+  char *bp = buf->getBufferStart();
   char *end = bp + len;
   while (bp < end) {
 auto *kv = reinterpret_cast(bp);



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


[Lldb-commits] [PATCH] D89181: [lldb] [Process/FreeBSD] Mark methods override in RegisterContext*

2020-10-10 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd83cd73e9ddf: [lldb] [Process/FreeBSD] Mark methods override 
in RegisterContext* (authored by mgorny).
Herald added a subscriber: jrtc27.
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89181/new/

https://reviews.llvm.org/D89181

Files:
  lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.h
  lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
  
lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h
  
lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
  lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h

Index: lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
===
--- lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
+++ lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
@@ -22,13 +22,13 @@
   lldb_private::RegisterInfoInterface *register_info);
 
 protected:
-  bool ReadGPR();
+  bool ReadGPR() override;
 
-  bool ReadFPR();
+  bool ReadFPR() override;
 
-  bool WriteGPR();
+  bool WriteGPR() override;
 
-  bool WriteFPR();
+  bool WriteFPR() override;
 
   // lldb_private::RegisterContext
   bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
@@ -37,39 +37,39 @@
  const lldb_private::RegisterValue &value);
 
   bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
-lldb_private::RegisterValue &value);
+lldb_private::RegisterValue &value) override;
 
   bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
- const lldb_private::RegisterValue &value);
+ const lldb_private::RegisterValue &value) override;
 
-  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
+  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
 
-  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
+  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
 
   uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read,
- bool write);
+ bool write) override;
 
-  bool ClearHardwareWatchpoint(uint32_t hw_index);
+  bool ClearHardwareWatchpoint(uint32_t hw_index) override;
 
-  bool HardwareSingleStep(bool enable);
+  bool HardwareSingleStep(bool enable) override;
 
   // POSIXBreakpointProtocol
-  bool UpdateAfterBreakpoint();
+  bool UpdateAfterBreakpoint() override;
 
-  unsigned GetRegisterIndexFromOffset(unsigned offset);
+  unsigned GetRegisterIndexFromOffset(unsigned offset) override;
 
-  bool IsWatchpointHit(uint32_t hw_index);
+  bool IsWatchpointHit(uint32_t hw_index) override;
 
-  bool ClearWatchpointHits();
+  bool ClearWatchpointHits() override;
 
-  lldb::addr_t GetWatchpointAddress(uint32_t hw_index);
+  lldb::addr_t GetWatchpointAddress(uint32_t hw_index) override;
 
-  bool IsWatchpointVacant(uint32_t hw_index);
+  bool IsWatchpointVacant(uint32_t hw_index) override;
 
   bool SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, bool read,
-  bool write, uint32_t hw_index);
+  bool write, uint32_t hw_index) override;
 
-  uint32_t NumSupportedHardwareWatchpoints();
+  uint32_t NumSupportedHardwareWatchpoints() override;
 
 private:
   ProcessMonitor &GetMonitor();
Index: lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
===
--- lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
+++ lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.h
@@ -24,17 +24,17 @@
 protected:
   bool IsVMX();
 
-  bool ReadGPR();
+  bool ReadGPR() override;
 
-  bool ReadFPR();
+  bool ReadFPR() override;
 
-  bool ReadVMX();
+  bool ReadVMX() override;
 
-  bool WriteGPR();
+  bool WriteGPR() override;
 
-  bool WriteFPR();
+  bool WriteFPR() override;
 
-  bool WriteVMX();
+  bool WriteVMX() override;
 
   // lldb_private::RegisterContext
   bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
@@ -43,39 +43,39 @@
  const lldb_private::RegisterValue &value);
 
   bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
-lldb_private::RegisterValue &value);
+lldb_private::RegisterValue &value) override;
 
   bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
- const lldb_private::RegisterValue &value);
+ const lldb_private::RegisterValue &value) override;
 
-  bool ReadAllR

[Lldb-commits] [PATCH] D89182: [lldb] [Process/FreeBSDRemote] Kill process via PT_KILL

2020-10-10 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9a37587ee33b: [lldb] [Process/FreeBSDRemote] Kill process 
via PT_KILL (authored by mgorny).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89182/new/

https://reviews.llvm.org/D89182

Files:
  lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp


Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -404,12 +404,7 @@
 break;
   }
 
-  if (kill(GetID(), SIGKILL) != 0) {
-error.SetErrorToErrno();
-return error;
-  }
-
-  return error;
+  return PtraceWrapper(PT_KILL, m_pid);
 }
 
 Status NativeProcessFreeBSD::GetMemoryRegionInfo(lldb::addr_t load_addr,


Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -404,12 +404,7 @@
 break;
   }
 
-  if (kill(GetID(), SIGKILL) != 0) {
-error.SetErrorToErrno();
-return error;
-  }
-
-  return error;
+  return PtraceWrapper(PT_KILL, m_pid);
 }
 
 Status NativeProcessFreeBSD::GetMemoryRegionInfo(lldb::addr_t load_addr,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D89155: [lldb] Minidump: check for .text hash match with directory

2020-10-10 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet updated this revision to Diff 297422.
JosephTremoulet added a comment.

- Handle finding wrong version before right one


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89155/new/

https://reviews.llvm.org/D89155

Files:
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/source/Plugins/Process/minidump/ProcessMinidump.h
  lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
  lldb/test/API/functionalities/postmortem/minidump-new/libbreakpad-decoy.yaml

Index: lldb/test/API/functionalities/postmortem/minidump-new/libbreakpad-decoy.yaml
===
--- /dev/null
+++ lldb/test/API/functionalities/postmortem/minidump-new/libbreakpad-decoy.yaml
@@ -0,0 +1,18 @@
+# This has different .text contents than libbreakpad-yaml,
+# to simulate having different versions of the module (to
+# test that we pick the one matching the minidump UUID).
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_DYN
+  Machine: EM_ARM
+  Flags:   [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+Sections:
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+Address: 0x0001
+AddressAlign:0x0004
+Content: 040014000300474E5500CC
Index: lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
===
--- lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
+++ lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
@@ -22,11 +22,14 @@
 def verify_module(self, module, verify_path, verify_uuid):
 # Compare the filename and the directory separately. We are avoiding
 # SBFileSpec.fullpath because it causes a slash/backslash confusion
-# on Windows.
+# on Windows.  Similarly, we compare the directories using normcase
+# because they may contain a Linux-style relative path from the
+# minidump appended to a Windows-style root path from the host.
 self.assertEqual(
 os.path.basename(verify_path), module.GetFileSpec().basename)
 self.assertEqual(
-os.path.dirname(verify_path), module.GetFileSpec().dirname or "")
+os.path.normcase(os.path.dirname(verify_path)),
+os.path.normcase(module.GetFileSpec().dirname or ""))
 self.assertEqual(verify_uuid, module.GetUUIDString())
 
 def get_minidump_modules(self, yaml_file):
@@ -201,6 +204,50 @@
 # will check that this matches.
 self.verify_module(modules[0], so_path, "D9C480E8")
 
+def test_breakpad_hash_match_sysroot(self):
+"""
+Check that we can match the breakpad .text section hash when the
+module is located under a user-provided sysroot.
+"""
+sysroot_path = os.path.join(self.getBuildDir(), "mock_sysroot")
+# Create the directory under the sysroot where the minidump reports
+# the module.
+so_dir = os.path.join(sysroot_path, "invalid", "path", "on", "current", "system")
+so_path = os.path.join(so_dir, "libbreakpad.so")
+lldbutil.mkdir_p(so_dir)
+self.yaml2obj("libbreakpad.yaml", so_path)
+self.runCmd("platform select remote-linux --sysroot '%s'" % sysroot_path)
+modules = self.get_minidump_modules("linux-arm-breakpad-uuid-match.yaml")
+self.assertEqual(1, len(modules))
+# LLDB makes up its own UUID as well when there is no build ID so we
+# will check that this matches.
+self.verify_module(modules[0], so_path, "D9C480E8")
+
+def test_breakpad_hash_match_sysroot_decoy(self):
+"""
+Check that we can match the breakpad .text section hash when there is
+a module with the right name but wrong contents under a user-provided
+sysroot, and the right module is at the given search path..
+"""
+sysroot_path = os.path.join(self.getBuildDir(), "mock_sysroot")
+# Create the directory under the sysroot where the minidump reports
+# the module.
+decoy_dir = os.path.join(sysroot_path, "invalid", "path", "on", "current", "system")
+decoy_path = os.path.join(decoy_dir, "libbreakpad.so")
+lldbutil.mkdir_p(decoy_dir)
+self.yaml2obj("libbreakpad-decoy.yaml", decoy_path)
+self.runCmd("platform select remote-linux --sysroot '%s'" % sysroot_path)
+so_dir = os.path.join(self.getBuildDir(), "searchpath_dir")
+so_path = os.path.join(so_dir, "libbreakpad.so")
+lldbutil.mkdir_p(so_dir)
+self.yaml2obj("libbreakpad.yaml", so_path)
+self.runCmd('settings set target.exec-search-paths "%s"' % so_dir)
+modules = self.get_m

[Lldb-commits] [PATCH] D89155: [lldb] Minidump: check for .text hash match with directory

2020-10-10 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet marked an inline comment as done.
JosephTremoulet added a comment.

Thanks for the speedy review!  I've updated it to include a testcase that shows 
the problem you described, and include the fix you suggested.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89155/new/

https://reviews.llvm.org/D89155

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


[Lldb-commits] [lldb] 5d330f4 - [lldb] [Windows] Remove unused functions. NFC.

2020-10-10 Thread Martin Storsjö via lldb-commits

Author: Martin Storsjö
Date: 2020-10-10T20:47:40+03:00
New Revision: 5d330f435e12d4a7f97cde406d29ce7413f96b47

URL: 
https://github.com/llvm/llvm-project/commit/5d330f435e12d4a7f97cde406d29ce7413f96b47
DIFF: 
https://github.com/llvm/llvm-project/commit/5d330f435e12d4a7f97cde406d29ce7413f96b47.diff

LOG: [lldb] [Windows] Remove unused functions. NFC.

These became unused in 51117e3c51754f3732e.

Added: 


Modified: 
lldb/source/Host/windows/Windows.cpp

Removed: 




diff  --git a/lldb/source/Host/windows/Windows.cpp 
b/lldb/source/Host/windows/Windows.cpp
index 172ea29107d3..4e6437f1c9ec 100644
--- a/lldb/source/Host/windows/Windows.cpp
+++ b/lldb/source/Host/windows/Windows.cpp
@@ -22,26 +22,6 @@
 #include 
 #include 
 
-namespace {
-bool utf8ToWide(const char *utf8, wchar_t *buf, size_t bufSize) {
-  const llvm::UTF8 *sourceStart = reinterpret_cast(utf8);
-  size_t sourceLen = strlen(utf8) + 1 /* convert null too */;
-  llvm::UTF16 *target = reinterpret_cast(buf);
-  llvm::ConversionFlags flags = llvm::strictConversion;
-  return llvm::ConvertUTF8toUTF16(&sourceStart, sourceStart + sourceLen, 
&target,
-target + bufSize, flags) == llvm::conversionOK;
-}
-
-bool wideToUtf8(const wchar_t *wide, char *buf, size_t bufSize) {
-  const llvm::UTF16 *sourceStart = reinterpret_cast(wide);
-  size_t sourceLen = wcslen(wide) + 1 /* convert null too */;
-  llvm::UTF8 *target = reinterpret_cast(buf);
-  llvm::ConversionFlags flags = llvm::strictConversion;
-  return llvm::ConvertUTF16toUTF8(&sourceStart, sourceStart + sourceLen, 
&target,
-target + bufSize, flags) == llvm::conversionOK;
-}
-}
-
 int vasprintf(char **ret, const char *fmt, va_list ap) {
   char *buf;
   int len;



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


[Lldb-commits] [lldb] abaca23 - [lldb] [Windows] Add missing 'override', silencing warnings. NFC.

2020-10-10 Thread Martin Storsjö via lldb-commits

Author: Martin Storsjö
Date: 2020-10-10T20:47:40+03:00
New Revision: abaca237c519a406ab00606b0464c32079831803

URL: 
https://github.com/llvm/llvm-project/commit/abaca237c519a406ab00606b0464c32079831803
DIFF: 
https://github.com/llvm/llvm-project/commit/abaca237c519a406ab00606b0464c32079831803.diff

LOG: [lldb] [Windows] Add missing 'override', silencing warnings. NFC.

Also remove superfluous 'virtual' in overridden methods.

Added: 


Modified: 
lldb/include/lldb/Host/windows/HostThreadWindows.h
lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h

Removed: 




diff  --git a/lldb/include/lldb/Host/windows/HostThreadWindows.h 
b/lldb/include/lldb/Host/windows/HostThreadWindows.h
index 63d0d73faad5..a74539543aa6 100644
--- a/lldb/include/lldb/Host/windows/HostThreadWindows.h
+++ b/lldb/include/lldb/Host/windows/HostThreadWindows.h
@@ -26,10 +26,10 @@ class HostThreadWindows : public HostNativeThreadBase {
 
   void SetOwnsHandle(bool owns);
 
-  virtual Status Join(lldb::thread_result_t *result);
-  virtual Status Cancel();
-  virtual void Reset();
-  virtual bool EqualsThread(lldb::thread_t thread) const;
+  Status Join(lldb::thread_result_t *result) override;
+  Status Cancel() override;
+  void Reset() override;
+  bool EqualsThread(lldb::thread_t thread) const override;
 
   lldb::tid_t GetThreadId() const;
 

diff  --git a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h 
b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
index e765f1e9ed54..81aea5b2022a 100644
--- a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
+++ b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
@@ -18,8 +18,8 @@ class ProcessLaunchInfo;
 
 class ProcessLauncherWindows : public ProcessLauncher {
 public:
-  virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
-Status &error);
+  HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+Status &error) override;
 
 protected:
   HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);

diff  --git a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h 
b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h
index 732273a54c13..89888df46756 100644
--- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h
@@ -137,39 +137,41 @@ class NativeDebugDelegate : public IDebugDelegate {
 public:
   NativeDebugDelegate(NativeProcessWindows &process) : m_process(process) {}
 
-  void OnExitProcess(uint32_t exit_code) { m_process.OnExitProcess(exit_code); 
}
+  void OnExitProcess(uint32_t exit_code) override {
+m_process.OnExitProcess(exit_code);
+  }
 
-  void OnDebuggerConnected(lldb::addr_t image_base) {
+  void OnDebuggerConnected(lldb::addr_t image_base) override {
 m_process.OnDebuggerConnected(image_base);
   }
 
   ExceptionResult OnDebugException(bool first_chance,
-   const ExceptionRecord &record) {
+   const ExceptionRecord &record) override {
 return m_process.OnDebugException(first_chance, record);
   }
 
-  void OnCreateThread(const HostThread &thread) {
+  void OnCreateThread(const HostThread &thread) override {
 m_process.OnCreateThread(thread);
   }
 
-  void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) {
+  void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) override {
 m_process.OnExitThread(thread_id, exit_code);
   }
 
   void OnLoadDll(const lldb_private::ModuleSpec &module_spec,
- lldb::addr_t module_addr) {
+ lldb::addr_t module_addr) override {
 m_process.OnLoadDll(module_spec, module_addr);
   }
 
-  void OnUnloadDll(lldb::addr_t module_addr) {
+  void OnUnloadDll(lldb::addr_t module_addr) override {
 m_process.OnUnloadDll(module_addr);
   }
 
-  void OnDebugString(const std::string &string) {
+  void OnDebugString(const std::string &string) override {
 m_process.OnDebugString(string);
   }
 
-  void OnDebuggerError(const Status &error, uint32_t type) {
+  void OnDebuggerError(const Status &error, uint32_t type) override {
 return m_process.OnDebuggerError(error, type);
   }
 



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


[Lldb-commits] [PATCH] D89193: [lldb] [Process/FreeBSDRemote] Support YMM reg via PT_*XSTATE

2020-10-10 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, emaste, krytarowski.
mgorny requested review of this revision.

Add a framework for reading/writing extended register sets via
PT_GETXSTATE/PT_GETXSTATE_INFO/PT_SETXSTATE, and use it to support
YMM0..YMM15.  The code is prepared to handle arbitrary XSAVE extensions,
including correct offset handling.


https://reviews.llvm.org/D89193

Files:
  
lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
  
lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h

Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
@@ -22,6 +22,8 @@
 #include "Plugins/Process/Utility/RegisterContext_x86.h"
 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
 
+#define LLDB_INVALID_XSAVE_OFFSET UINT32_MAX
+
 namespace lldb_private {
 namespace process_freebsd {
 
@@ -75,7 +77,11 @@
 
 private:
   // Private member types.
-  enum { GPRegSet, FPRegSet, DBRegSet };
+  enum { GPRegSet, FPRegSet, XSaveRegSet, DBRegSet };
+  enum {
+YMMXSaveSet,
+MaxXSaveSet = YMMXSaveSet,
+  };
 
   // Private member variables.
   struct reg m_gpr;
@@ -85,6 +91,8 @@
   struct xmmreg m_fpr;
 #endif
   struct dbreg m_dbr;
+  std::vector m_xsave;
+  std::array m_xsave_offsets;
 
   int GetSetForNativeRegNum(int reg_num) const;
   int GetDR(int num) const;
Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
@@ -10,7 +10,11 @@
 
 #include "NativeRegisterContextFreeBSD_x86_64.h"
 
+// clang-format off
 #include 
+#include 
+#include 
+// clang-format on
 
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/DataBufferHeap.h"
@@ -18,6 +22,7 @@
 #include "lldb/Utility/RegisterValue.h"
 #include "lldb/Utility/Status.h"
 
+#include "NativeProcessFreeBSD.h"
 #include "Plugins/Process/Utility/RegisterContextFreeBSD_i386.h"
 #include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h"
 
@@ -392,7 +397,7 @@
 if (reg_num >= k_first_fpr_i386 && reg_num <= k_last_fpr_i386)
   return FPRegSet;
 if (reg_num >= k_first_avx_i386 && reg_num <= k_last_avx_i386)
-  return -1; // AVX
+  return XSaveRegSet; // AVX
 if (reg_num >= k_first_mpxr_i386 && reg_num <= k_last_mpxr_i386)
   return -1; // MPXR
 if (reg_num >= k_first_mpxc_i386 && reg_num <= k_last_mpxc_i386)
@@ -406,7 +411,7 @@
 if (reg_num >= k_first_fpr_x86_64 && reg_num <= k_last_fpr_x86_64)
   return FPRegSet;
 if (reg_num >= k_first_avx_x86_64 && reg_num <= k_last_avx_x86_64)
-  return -1; // AVX
+  return XSaveRegSet; // AVX
 if (reg_num >= k_first_mpxr_x86_64 && reg_num <= k_last_mpxr_x86_64)
   return -1; // MPXR
 if (reg_num >= k_first_mpxc_x86_64 && reg_num <= k_last_mpxc_x86_64)
@@ -433,6 +438,27 @@
 #endif
   case DBRegSet:
 return DoRegisterSet(PT_GETDBREGS, &m_dbr);
+  case XSaveRegSet: {
+struct ptrace_xstate_info info;
+Status ret = NativeProcessFreeBSD::PtraceWrapper(
+PT_GETXSTATE_INFO, GetProcessPid(), &info, sizeof(info));
+if (!ret.Success())
+  return ret;
+
+assert(info.xsave_mask & XFEATURE_ENABLED_X87);
+assert(info.xsave_mask & XFEATURE_ENABLED_SSE);
+
+m_xsave_offsets[YMMXSaveSet] = LLDB_INVALID_XSAVE_OFFSET;
+if (info.xsave_mask & XFEATURE_ENABLED_YMM_HI128) {
+  uint32_t eax, ecx, edx;
+  __get_cpuid_count(0x0D, 2, &eax, &m_xsave_offsets[YMMXSaveSet], &ecx,
+&edx);
+}
+
+m_xsave.resize(info.xsave_len);
+return NativeProcessFreeBSD::PtraceWrapper(PT_GETXSTATE, GetProcessPid(),
+   m_xsave.data(), m_xsave.size());
+  }
   }
   llvm_unreachable("NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet");
 }
@@ -449,6 +475,11 @@
 #endif
   case DBRegSet:
 return DoRegisterSet(PT_SETDBREGS, &m_dbr);
+  case XSaveRegSet:
+// TODO: can WriteRegisterSet() ever be called without ReadRegisterSet()?
+assert(m_xsave.size() > 0);
+return NativeProcessFreeBSD::PtraceWrapper(PT_SETXSTATE, GetProcessPid(),
+   m_xsave.data(), m_xsave.size());
   }
   llvm_unreachable("NativeRegisterContextFreeBSD_x86_64::WriteRegisterSet");
 }
@@ -713,6 +744,39 @@
reg_info->byte_size, endian::InlHostByteOrder());
 #endif
 break;
+  case lldb_ymm0_x86_64:
+  case lldb_ymm1_x86_64:
+  case lldb_ymm2_x86_64:
+  case lldb_ymm3_x86_64:
+  case lldb_ymm4_x86_64:
+  case lldb_ymm5_

[Lldb-commits] [PATCH] D89193: [lldb] [Process/FreeBSDRemote] Support YMM reg via PT_*XSTATE

2020-10-10 Thread Michał Górny via Phabricator via lldb-commits
mgorny added inline comments.



Comment at: 
lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp:479
+  case XSaveRegSet:
+// TODO: can WriteRegisterSet() ever be called without ReadRegisterSet()?
+assert(m_xsave.size() > 0);

@labath, is this a safe assumption to make? Generally, if `ReadRegisterSet()` 
is not called, `m_xsave` will be zero-sized.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89193/new/

https://reviews.llvm.org/D89193

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


[Lldb-commits] [PATCH] D89193: [lldb] [Process/FreeBSDRemote] Support YMM reg via PT_*XSTATE

2020-10-10 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a reviewer: bsdjhb.
krytarowski added a subscriber: bsdjhb.
krytarowski added a comment.

+ @bsdjhb John, could you have a look?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89193/new/

https://reviews.llvm.org/D89193

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


[Lldb-commits] [PATCH] D89193: [lldb] [Process/FreeBSDRemote] Support YMM reg via PT_*XSTATE

2020-10-10 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 297431.
mgorny added a comment.

Remove accidental reformatting.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89193/new/

https://reviews.llvm.org/D89193

Files:
  
lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
  
lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h

Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
@@ -22,6 +22,8 @@
 #include "Plugins/Process/Utility/RegisterContext_x86.h"
 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
 
+#define LLDB_INVALID_XSAVE_OFFSET UINT32_MAX
+
 namespace lldb_private {
 namespace process_freebsd {
 
@@ -75,7 +77,11 @@
 
 private:
   // Private member types.
-  enum { GPRegSet, FPRegSet, DBRegSet };
+  enum { GPRegSet, FPRegSet, XSaveRegSet, DBRegSet };
+  enum {
+YMMXSaveSet,
+MaxXSaveSet = YMMXSaveSet,
+  };
 
   // Private member variables.
   struct reg m_gpr;
@@ -85,6 +91,8 @@
   struct xmmreg m_fpr;
 #endif
   struct dbreg m_dbr;
+  std::vector m_xsave;
+  std::array m_xsave_offsets;
 
   int GetSetForNativeRegNum(int reg_num) const;
   int GetDR(int num) const;
Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
@@ -10,7 +10,11 @@
 
 #include "NativeRegisterContextFreeBSD_x86_64.h"
 
+// clang-format off
 #include 
+#include 
+#include 
+// clang-format on
 
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/DataBufferHeap.h"
@@ -18,6 +22,7 @@
 #include "lldb/Utility/RegisterValue.h"
 #include "lldb/Utility/Status.h"
 
+#include "NativeProcessFreeBSD.h"
 #include "Plugins/Process/Utility/RegisterContextFreeBSD_i386.h"
 #include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h"
 
@@ -392,7 +397,7 @@
 if (reg_num >= k_first_fpr_i386 && reg_num <= k_last_fpr_i386)
   return FPRegSet;
 if (reg_num >= k_first_avx_i386 && reg_num <= k_last_avx_i386)
-  return -1; // AVX
+  return XSaveRegSet; // AVX
 if (reg_num >= k_first_mpxr_i386 && reg_num <= k_last_mpxr_i386)
   return -1; // MPXR
 if (reg_num >= k_first_mpxc_i386 && reg_num <= k_last_mpxc_i386)
@@ -406,7 +411,7 @@
 if (reg_num >= k_first_fpr_x86_64 && reg_num <= k_last_fpr_x86_64)
   return FPRegSet;
 if (reg_num >= k_first_avx_x86_64 && reg_num <= k_last_avx_x86_64)
-  return -1; // AVX
+  return XSaveRegSet; // AVX
 if (reg_num >= k_first_mpxr_x86_64 && reg_num <= k_last_mpxr_x86_64)
   return -1; // MPXR
 if (reg_num >= k_first_mpxc_x86_64 && reg_num <= k_last_mpxc_x86_64)
@@ -433,6 +438,27 @@
 #endif
   case DBRegSet:
 return DoRegisterSet(PT_GETDBREGS, &m_dbr);
+  case XSaveRegSet: {
+struct ptrace_xstate_info info;
+Status ret = NativeProcessFreeBSD::PtraceWrapper(
+PT_GETXSTATE_INFO, GetProcessPid(), &info, sizeof(info));
+if (!ret.Success())
+  return ret;
+
+assert(info.xsave_mask & XFEATURE_ENABLED_X87);
+assert(info.xsave_mask & XFEATURE_ENABLED_SSE);
+
+m_xsave_offsets[YMMXSaveSet] = LLDB_INVALID_XSAVE_OFFSET;
+if (info.xsave_mask & XFEATURE_ENABLED_YMM_HI128) {
+  uint32_t eax, ecx, edx;
+  __get_cpuid_count(0x0D, 2, &eax, &m_xsave_offsets[YMMXSaveSet], &ecx,
+&edx);
+}
+
+m_xsave.resize(info.xsave_len);
+return NativeProcessFreeBSD::PtraceWrapper(PT_GETXSTATE, GetProcessPid(),
+   m_xsave.data(), m_xsave.size());
+  }
   }
   llvm_unreachable("NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet");
 }
@@ -449,6 +475,11 @@
 #endif
   case DBRegSet:
 return DoRegisterSet(PT_SETDBREGS, &m_dbr);
+  case XSaveRegSet:
+// TODO: can WriteRegisterSet() ever be called without ReadRegisterSet()?
+assert(m_xsave.size() > 0);
+return NativeProcessFreeBSD::PtraceWrapper(PT_SETXSTATE, GetProcessPid(),
+   m_xsave.data(), m_xsave.size());
   }
   llvm_unreachable("NativeRegisterContextFreeBSD_x86_64::WriteRegisterSet");
 }
@@ -713,6 +744,39 @@
reg_info->byte_size, endian::InlHostByteOrder());
 #endif
 break;
+  case lldb_ymm0_x86_64:
+  case lldb_ymm1_x86_64:
+  case lldb_ymm2_x86_64:
+  case lldb_ymm3_x86_64:
+  case lldb_ymm4_x86_64:
+  case lldb_ymm5_x86_64:
+  case lldb_ymm6_x86_64:
+  case lldb_ymm7_x86_64:
+  case lldb_ymm8_x86_64:
+  case lldb_ymm9_x86_64:
+  case lldb_ymm10_x86_64:
+  case lldb_ymm11_x86_64:
+  case lldb_ymm12_x86_64:
+