OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CRASH_CRASH_DUMPER_H_ |
| 6 #define CRASH_CRASH_DUMPER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/scoped_ptr.h" |
| 11 |
| 12 namespace google_breakpad { |
| 13 class ExceptionHandler; |
| 14 } |
| 15 |
| 16 class FilePath; |
| 17 |
| 18 // Class to manage crash handling and dumping. When Enable is called, all |
| 19 // crashes will be caught and stored to the appropriate crash directory. |
| 20 // The directory will be: |
| 21 // /home/chronos/user/crash - for all processes running as chronos |
| 22 // /var/spool/crash - for all other processes |
| 23 // The class takes care of creating the directories (even recreating them |
| 24 // at crash time in case the cryptohome mounting changes from Enable time. |
| 25 |
| 26 class CrashDumper { |
| 27 public: |
| 28 ~CrashDumper() { |
| 29 if (IsEnabled()) { |
| 30 Disable(); |
| 31 } |
| 32 } |
| 33 |
| 34 // Enable crash detection and dumping. Aborts if already enabled |
| 35 // or crash reporting cannot be enabled. If the cryptohome is mounted |
| 36 // while crash handling is enabled, later crashes may be lost. |
| 37 static void Enable(); |
| 38 |
| 39 // Return if enabled. |
| 40 static bool IsEnabled(); |
| 41 |
| 42 // Disable crash detection and dumping. Aborts if not enabled. |
| 43 static void Disable(); |
| 44 }; |
| 45 |
| 46 #endif // CRASH_CRASH_DUMPER_H_ |
OLD | NEW |