Steve Fung | 6c34c25 | 2015-08-20 00:27:30 -0700 | [diff] [blame] | 1 | /* |
| 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 Semenzato | 6fdc0b4 | 2013-04-11 17:22:13 -0700 | [diff] [blame] | 16 | |
Ben Chan | 7e77690 | 2014-06-18 13:19:51 -0700 | [diff] [blame] | 17 | #ifndef CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_ |
| 18 | #define CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_ |
| 19 | |
| 20 | #include <string> |
Luigi Semenzato | 6fdc0b4 | 2013-04-11 17:22:13 -0700 | [diff] [blame] | 21 | |
Ben Chan | 895fa5d | 2014-09-02 20:58:20 -0700 | [diff] [blame] | 22 | #include <base/macros.h> |
Luigi Semenzato | 6fdc0b4 | 2013-04-11 17:22:13 -0700 | [diff] [blame] | 23 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
Luigi Semenzato | 6fdc0b4 | 2013-04-11 17:22:13 -0700 | [diff] [blame] | 24 | |
Steve Fung | 129bea5 | 2015-07-23 13:11:15 -0700 | [diff] [blame] | 25 | #include "crash_collector.h" |
Luigi Semenzato | 6fdc0b4 | 2013-04-11 17:22:13 -0700 | [diff] [blame] | 26 | |
| 27 | // Kernel warning collector. |
| 28 | class KernelWarningCollector : public CrashCollector { |
| 29 | public: |
| 30 | KernelWarningCollector(); |
| 31 | |
Ben Chan | efec0b3 | 2014-08-12 08:52:11 -0700 | [diff] [blame] | 32 | ~KernelWarningCollector() override; |
Luigi Semenzato | 6fdc0b4 | 2013-04-11 17:22:13 -0700 | [diff] [blame] | 33 | |
| 34 | // Collects warning. |
| 35 | bool Collect(); |
| 36 | |
| 37 | private: |
| 38 | friend class KernelWarningCollectorTest; |
| 39 | FRIEND_TEST(KernelWarningCollectorTest, CollectOK); |
| 40 | |
Luigi Semenzato | b20c9ef | 2013-12-17 18:12:09 -0800 | [diff] [blame] | 41 | // Reads the full content of the kernel warn dump and its signature. |
| 42 | bool LoadKernelWarning(std::string *content, std::string *signature); |
Ben Chan | 895fa5d | 2014-09-02 20:58:20 -0700 | [diff] [blame] | 43 | |
| 44 | DISALLOW_COPY_AND_ASSIGN(KernelWarningCollector); |
Luigi Semenzato | 6fdc0b4 | 2013-04-11 17:22:13 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
Ben Chan | 7e77690 | 2014-06-18 13:19:51 -0700 | [diff] [blame] | 47 | #endif // CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_ |