From 1b306c26ade71504511d2fa75b03dfaee77f9620 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 1 Jul 2017 13:24:58 +0000 Subject: Vendor import of lldb trunk r306956: https://llvm.org/svn/llvm-project/lldb/trunk@306956 --- source/Host/linux/Support.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/Host/linux/Support.cpp') diff --git a/source/Host/linux/Support.cpp b/source/Host/linux/Support.cpp index 8fbb60052e3f6..31808401ea615 100644 --- a/source/Host/linux/Support.cpp +++ b/source/Host/linux/Support.cpp @@ -32,3 +32,13 @@ lldb_private::getProcFile(::pid_t pid, const llvm::Twine &file) { LLDB_LOG(log, "Failed to open {0}: {1}", File, Ret.getError().message()); return Ret; } + +llvm::ErrorOr> +lldb_private::getProcFile(const llvm::Twine &file) { + Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + std::string File = ("/proc/" + file).str(); + auto Ret = llvm::MemoryBuffer::getFileAsStream(File); + if (!Ret) + LLDB_LOG(log, "Failed to open {0}: {1}", File, Ret.getError().message()); + return Ret; +} -- cgit v1.3