blob: dcdb3553d8c3902b65583c105530d3dd02ce81be [file] [log] [blame]
Todd Fiala3dc2fb22014-06-30 04:14:13 +00001//===-- 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 Berghammerdb264a62015-03-31 09:52:22 +000018namespace lldb_private {
19namespace process_linux {
20
Kate Stoneb9c1b512016-09-06 20:57:50 +000021class ProcFileReader {
22public:
23 static lldb::DataBufferSP ReadIntoDataBuffer(lldb::pid_t pid,
24 const char *name);
Todd Fiala3dc2fb22014-06-30 04:14:13 +000025
Kate Stoneb9c1b512016-09-06 20:57:50 +000026 /// 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 Berghammerdb264a62015-03-31 09:52:22 +000033
34} // namespace process_linux
35} // namespace lldb_private
Todd Fiala3dc2fb22014-06-30 04:14:13 +000036
37#endif // #ifndef liblldb_ProcFileReader_h_