summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-01-23 15:56:45 +0000
committerPavel Labath <labath@google.com>2017-01-23 15:56:45 +0000
commit1d5855b1078569ba49682010fc9be5ec32fef5ea (patch)
treec289a6559b748db3ae617b7a3a1db5efac8c6acf /lldb/source/Plugins/Process/gdb-remote
parent1f46b70b5dec51858074248da4af3fbc38198a13 (diff)
downloadbcm5719-llvm-1d5855b1078569ba49682010fc9be5ec32fef5ea.tar.gz
bcm5719-llvm-1d5855b1078569ba49682010fc9be5ec32fef5ea.zip
Replace getcwd with the llvm equivalent
Summary: getcwd() is not available (well.. um.. deprecated?) on windows, and the way PosixApi.h is providing it causes strange compile errors when it's included in the wrong order. The best way to avoid that is to just not use chdir. This replaces all uses of getcwd in generic code. There are still a couple of more uses, but these are in platform-specific code. chdir() is causing a similar problem, but for that there is no llvm equivalent for that (yet). Reviewers: zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D28858 llvm-svn: 292795
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 11069749186..d3161838ed3 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -356,12 +356,12 @@ GDBRemoteCommunicationServerPlatform::Handle_qGetWorkingDir(
// If this packet is sent to a platform, then change the current working
// directory
- char cwd[PATH_MAX];
- if (getcwd(cwd, sizeof(cwd)) == NULL)
- return SendErrorResponse(errno);
+ llvm::SmallString<64> cwd;
+ if (std::error_code ec = llvm::sys::fs::current_path(cwd))
+ return SendErrorResponse(ec.value());
StreamString response;
- response.PutBytesAsRawHex8(cwd, strlen(cwd));
+ response.PutBytesAsRawHex8(cwd.data(), cwd.size());
return SendPacketNoLock(response.GetString());
}
OpenPOWER on IntegriCloud