blob: 7b38124330684ed91de98abfd5bcb1a3b96af7cb [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
Todd Fiala3dc2fb22014-06-30 04:14:13 +000021 class ProcFileReader
22 {
23 public:
24
25 static lldb::DataBufferSP
26 ReadIntoDataBuffer (lldb::pid_t pid, const char *name);
27
28 /// Parse the /proc/{@a pid}/{@a name} file line by line, passing each line to line_parser, until
29 /// either end of file or until line_parser returns false.
Tamas Berghammerdb264a62015-03-31 09:52:22 +000030 static Error
Todd Fiala3dc2fb22014-06-30 04:14:13 +000031 ProcessLineByLine (lldb::pid_t pid, const char *name, 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_