[Lldb-commits] [PATCH] D76450: [lldb/PlatformDarwin] Always delete destination file first in PutFile

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 23 14:44:03 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb6ae8937e031: [lldb/PlatformDarwin] Always delete destination file first in PutFile (authored by friss).

Changed prior to commit:
  https://reviews.llvm.org/D76450?vs=251461&id=252146#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76450

Files:
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h


Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -25,6 +25,11 @@
 
   ~PlatformDarwin() override;
 
+  lldb_private::Status PutFile(const lldb_private::FileSpec &source,
+                               const lldb_private::FileSpec &destination,
+                               uint32_t uid = UINT32_MAX,
+                               uint32_t gid = UINT32_MAX) override;
+
   // lldb_private::Platform functions
   lldb_private::Status
   ResolveSymbolFile(lldb_private::Target &target,
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -58,6 +58,17 @@
 /// inherited from by the plug-in instance.
 PlatformDarwin::~PlatformDarwin() {}
 
+lldb_private::Status
+PlatformDarwin::PutFile(const lldb_private::FileSpec &source,
+                        const lldb_private::FileSpec &destination, uint32_t uid,
+                        uint32_t gid) {
+  // Unconditionally unlink the destination. If it is an executable,
+  // simply opening it and truncating its contents would invalidate
+  // its cached code signature.
+  Unlink(destination);
+  return PlatformPOSIX::PutFile(source, destination, uid, gid);
+}
+
 FileSpecList PlatformDarwin::LocateExecutableScriptingResources(
     Target *target, Module &module, Stream *feedback_stream) {
   FileSpecList file_list;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76450.252146.patch
Type: text/x-patch
Size: 1668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200323/3f312225/attachment.bin>


More information about the lldb-commits mailing list