blob: 5ccb78076bf5c440e0a7b33a172f2da60a6ed12a [file] [log] [blame]
Steve Fung6c34c252015-08-20 00:27:30 -07001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Luigi Semenzato6fdc0b42013-04-11 17:22:13 -070016
Ben Chan7e776902014-06-18 13:19:51 -070017#ifndef CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_
18#define CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_
19
20#include <string>
Luigi Semenzato6fdc0b42013-04-11 17:22:13 -070021
Ben Chan895fa5d2014-09-02 20:58:20 -070022#include <base/macros.h>
Luigi Semenzato6fdc0b42013-04-11 17:22:13 -070023#include <gtest/gtest_prod.h> // for FRIEND_TEST
Luigi Semenzato6fdc0b42013-04-11 17:22:13 -070024
Steve Fung129bea52015-07-23 13:11:15 -070025#include "crash_collector.h"
Luigi Semenzato6fdc0b42013-04-11 17:22:13 -070026
27// Kernel warning collector.
28class KernelWarningCollector : public CrashCollector {
29 public:
30 KernelWarningCollector();
31
Ben Chanefec0b32014-08-12 08:52:11 -070032 ~KernelWarningCollector() override;
Luigi Semenzato6fdc0b42013-04-11 17:22:13 -070033
34 // Collects warning.
35 bool Collect();
36
37 private:
38 friend class KernelWarningCollectorTest;
39 FRIEND_TEST(KernelWarningCollectorTest, CollectOK);
40
Luigi Semenzatob20c9ef2013-12-17 18:12:09 -080041 // Reads the full content of the kernel warn dump and its signature.
42 bool LoadKernelWarning(std::string *content, std::string *signature);
Ben Chan895fa5d2014-09-02 20:58:20 -070043
44 DISALLOW_COPY_AND_ASSIGN(KernelWarningCollector);
Luigi Semenzato6fdc0b42013-04-11 17:22:13 -070045};
46
Ben Chan7e776902014-06-18 13:19:51 -070047#endif // CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_