1 : // Copyright 2013 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 : // Define the GenFilterApp class. GenFilterApp is a command-line application for
16 : // generating Syzygy instrumentation filters.
17 :
18 : #ifndef SYZYGY_GENFILTER_GENFILTER_APP_H_
19 : #define SYZYGY_GENFILTER_GENFILTER_APP_H_
20 :
21 : #include "base/command_line.h"
22 : #include "base/files/file_path.h"
23 : #include "syzygy/application/application.h"
24 :
25 : namespace genfilter {
26 :
27 : // Implements the "filter" command-line application.
28 : //
29 : // Refer to kUsageFormatStr (referenced from GenFilterApp::Usage()) for
30 : // usage information.
31 : class GenFilterApp : public application::AppImplBase {
32 : public:
33 : // The valid actions.
34 : enum Action {
35 : kCompile,
36 : kIntersect,
37 : kInvert,
38 : kSubtract,
39 : kUnion,
40 : };
41 :
42 : GenFilterApp()
43 : : application::AppImplBase("GenFilterApp"),
44 : action_(kCompile),
45 : pretty_print_(false),
46 E : overwrite_(false) {
47 E : }
48 :
49 : // @name Implementation of the AppImplBase interface.
50 : // @{
51 : bool ParseCommandLine(const base::CommandLine* command_line);
52 : int Run();
53 : // @}
54 :
55 : protected:
56 : // @name Utility members.
57 : // @{
58 : void PrintUsage(const base::CommandLine* command_line,
59 : const base::StringPiece& message) const;
60 : // @}
61 :
62 : // @name Main bodies of the various actions.
63 : // @{
64 : bool RunCompileAction();
65 : bool RunSetAction();
66 : // @}
67 :
68 : Action action_;
69 : base::FilePath input_image_;
70 : base::FilePath input_pdb_;
71 : base::FilePath output_file_;
72 : std::vector<base::FilePath> inputs_;
73 : bool overwrite_;
74 : bool pretty_print_;
75 : };
76 :
77 : } // namespace genfilter
78 :
79 : #endif // SYZYGY_GENFILTER_GENFILTER_APP_H_
|