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 branch instrumenter.
16 : #ifndef SYZYGY_INSTRUMENT_INSTRUMENTERS_BRANCH_INSTRUMENTER_H_
17 : #define SYZYGY_INSTRUMENT_INSTRUMENTERS_BRANCH_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/mutators/add_indexed_data_ranges_stream.h"
24 : #include "syzygy/instrument/transforms/branch_hook_transform.h"
25 :
26 : namespace instrument {
27 : namespace instrumenters {
28 :
29 : class BranchInstrumenter : public InstrumenterWithAgent {
30 : public:
31 : BranchInstrumenter();
32 E : ~BranchInstrumenter() { }
33 :
34 : protected:
35 : // The name of the agent for this mode of instrumentation.
36 : static const char kAgentDllBasicBlockEntry[];
37 :
38 : // @name InstrumenterWithAgent overrides.
39 : // @{
40 : virtual bool InstrumentImpl();
41 i : virtual const char* InstrumentationMode() { return "branch"; }
42 : virtual bool ParseAdditionalCommandLineArguments(
43 : const CommandLine* command_line) OVERRIDE;
44 : // @}
45 :
46 : // The transform for this agent.
47 : scoped_ptr<instrument::transforms::BranchHookTransform> branch_transform_;
48 :
49 : // The PDB mutator for this agent.
50 : scoped_ptr<instrument::mutators::AddIndexedDataRangesStreamPdbMutator>
51 : add_bb_addr_stream_mutator_;
52 :
53 : // @name Command-line parameters.
54 : // @{
55 : bool buffering_;
56 : uint32 fs_slot_;
57 : // @}
58 :
59 : };
60 :
61 : } // namespace instrumenters
62 : } // namespace instrument
63 :
64 : #endif // SYZYGY_INSTRUMENT_INSTRUMENTERS_BRANCH_INSTRUMENTER_H_
|