Todd Fiala | 3dc2fb2 | 2014-06-30 04:14:13 +0000 | [diff] [blame] | 1 | //===-- ProcFileReader.h ----------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef liblldb_ProcFileReader_h_ |
| 11 | #define liblldb_ProcFileReader_h_ |
| 12 | |
| 13 | #include <functional> |
| 14 | |
| 15 | #include "lldb/lldb-forward.h" |
| 16 | #include "lldb/lldb-types.h" |
| 17 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 18 | namespace lldb_private { |
| 19 | namespace process_linux { |
| 20 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 21 | class ProcFileReader { |
| 22 | public: |
| 23 | static lldb::DataBufferSP ReadIntoDataBuffer(lldb::pid_t pid, |
| 24 | const char *name); |
Todd Fiala | 3dc2fb2 | 2014-06-30 04:14:13 +0000 | [diff] [blame] | 25 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 26 | /// Parse the /proc/{@a pid}/{@a name} file line by line, passing each line to |
| 27 | /// line_parser, until |
| 28 | /// either end of file or until line_parser returns false. |
| 29 | static Error |
| 30 | ProcessLineByLine(lldb::pid_t pid, const char *name, |
| 31 | std::function<bool(const std::string &line)> line_parser); |
| 32 | }; |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 33 | |
| 34 | } // namespace process_linux |
| 35 | } // namespace lldb_private |
Todd Fiala | 3dc2fb2 | 2014-06-30 04:14:13 +0000 | [diff] [blame] | 36 | |
| 37 | #endif // #ifndef liblldb_ProcFileReader_h_ |