1 : // Copyright 2015 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Declares a minidump processor.
16 :
17 : #ifndef SYZYGY_POIROT_MINIDUMP_PROCESSOR_H_
18 : #define SYZYGY_POIROT_MINIDUMP_PROCESSOR_H_
19 :
20 : #include "base/files/file_path.h"
21 : #include "base/files/scoped_file.h"
22 : #include "syzygy/crashdata/crashdata.h"
23 :
24 m : namespace poirot {
25 :
26 : // The MinidumpProcessor reads the crash data embedded in a minidump and
27 : // processes it.
28 m : class MinidumpProcessor {
29 m : public:
30 : // Constructor.
31 : // @param input_minidump The minidump to process.
32 m : explicit MinidumpProcessor(const base::FilePath& input_minidump);
33 :
34 : // Process the minidump.
35 : // @returns true on success, false otherwise.
36 m : bool ProcessDump();
37 :
38 : // Convert the crash data contained in the minidump into a JSON
39 : // representation and dump it into |file|.
40 : // @param file A handle to the file in which the output should be printed.
41 : // @returns true on success, false otherwise.
42 m : bool GenerateJsonOutput(FILE* file);
43 :
44 m : protected:
45 : // The minidump to process.
46 m : base::FilePath input_minidump_;
47 :
48 : // Indicates if the minidump has been processed.
49 m : bool processed_;
50 :
51 : // The protobuf containing the crash data.
52 m : crashdata::Value protobuf_value_;
53 :
54 m : DISALLOW_COPY_AND_ASSIGN(MinidumpProcessor);
55 m : };
56 :
57 m : } // namespace poirot
58 :
59 : #endif // SYZYGY_POIROT_MINIDUMP_PROCESSOR_H_
|