[Lldb-commits] [lldb] c57ea1b - [lldb] Get lldb-server platform's --socket-file working again

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 17 01:29:25 PDT 2020


Author: Raphael Isemann
Date: 2020-08-17T10:29:06+02:00
New Revision: c57ea1b48f26caf7922bf434187e1c277f412550

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

LOG: [lldb] Get lldb-server platform's --socket-file working again

`lldb-server platform --socket-file /any/path` currently always fails to create
the socket file.  This stopped working after D67424 which changed the
input variables of `writeFileAtomically` slightly. We're expected to
pass in a temporary path template (`/tmp/foo-%%%%%`) and the final
path we want to write. Instead we currently pass in the never set
`temp_file_path` as the temporary path (which will make this function always
fail) and pass in the temp_file_spec's path as the final path (which is actually
the template path such as `/tmp/foo-%%%%%`) instead of the actual path
we want to write (e.g. `/tmp/foo`).

Reviewed By: labath

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

Added: 
    

Modified: 
    lldb/tools/lldb-server/lldb-platform.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp
index 33f918ffc2a1..ba3b6c59185c 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -104,11 +104,12 @@ static Status save_socket_id_to_file(const std::string &socket_id,
 
   llvm::SmallString<64> temp_file_path;
   temp_file_spec.AppendPathComponent("port-file.%%%%%%");
+  temp_file_path = temp_file_spec.GetPath();
 
   Status status;
   if (auto Err =
           handleErrors(llvm::writeFileAtomically(
-                           temp_file_path, temp_file_spec.GetPath(), socket_id),
+                           temp_file_path, file_spec.GetPath(), socket_id),
                        [&status, &file_spec](const AtomicFileWriteError &E) {
                          std::string ErrorMsgBuffer;
                          llvm::raw_string_ostream S(ErrorMsgBuffer);


        


More information about the lldb-commits mailing list