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 : // Declares the Asan instrumenter.
16 : #ifndef SYZYGY_INSTRUMENT_INSTRUMENTERS_ASAN_INSTRUMENTER_H_
17 : #define SYZYGY_INSTRUMENT_INSTRUMENTERS_ASAN_INSTRUMENTER_H_
18 :
19 : #include <string>
20 :
21 : #include "base/command_line.h"
22 : #include "syzygy/instrument/instrumenters/instrumenter_with_agent.h"
23 : #include "syzygy/instrument/transforms/asan_transform.h"
24 : #include "syzygy/pe/image_filter.h"
25 : #include "syzygy/pe/pe_relinker.h"
26 :
27 : namespace instrument {
28 : namespace instrumenters {
29 :
30 : class AsanInstrumenter : public InstrumenterWithAgent {
31 : public:
32 : AsanInstrumenter();
33 :
34 E : ~AsanInstrumenter() { }
35 :
36 : protected:
37 : // The name of the agent for this mode of instrumentation.
38 : static const char kAgentDllAsan[];
39 :
40 : // @name InstrumenterWithAgent overrides.
41 : // @{
42 : virtual bool ImageFormatIsSupported(pe::ImageFormat image_format) OVERRIDE;
43 : virtual bool InstrumentImpl() OVERRIDE;
44 i : virtual const char* InstrumentationMode() OVERRIDE { return "asan"; }
45 : virtual bool ParseAdditionalCommandLineArguments(
46 : const CommandLine* command_line) OVERRIDE;
47 : // @}
48 :
49 : // @name Command-line parameters.
50 : // @{
51 : base::FilePath filter_path_;
52 : bool use_interceptors_;
53 : bool remove_redundant_checks_;
54 : bool use_liveness_analysis_;
55 : // @}
56 :
57 : // The transform for this agent.
58 : scoped_ptr<instrument::transforms::AsanTransform> asan_transform_;
59 :
60 : // The image filter (optional).
61 : scoped_ptr<pe::ImageFilter> filter_;
62 : };
63 :
64 : } // namespace instrumenters
65 : } // namespace instrument
66 :
67 : #endif // SYZYGY_INSTRUMENT_INSTRUMENTERS_ASAN_INSTRUMENTER_H_
|