diff options
Diffstat (limited to 'lldb/source/Host/linux/Support.cpp')
-rw-r--r-- | lldb/source/Host/linux/Support.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lldb/source/Host/linux/Support.cpp b/lldb/source/Host/linux/Support.cpp index 8fbb60052e3..31808401ea6 100644 --- a/lldb/source/Host/linux/Support.cpp +++ b/lldb/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<std::unique_ptr<llvm::MemoryBuffer>> +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; +} |