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 : // Specialization of the instrumenter interface for instrumenters that use an
16 : // agent (and also the relinker).
17 : #ifndef SYZYGY_INSTRUMENT_INSTRUMENTERS_INSTRUMENTER_WITH_AGENT_H_
18 : #define SYZYGY_INSTRUMENT_INSTRUMENTERS_INSTRUMENTER_WITH_AGENT_H_
19 :
20 : #include <string>
21 :
22 : #include "base/command_line.h"
23 : #include "syzygy/instrument/instrumenters/instrumenter_with_relinker.h"
24 :
25 : namespace instrument {
26 : namespace instrumenters {
27 :
28 : class InstrumenterWithAgent : public InstrumenterWithRelinker {
29 : public:
30 : typedef InstrumenterWithRelinker Super;
31 : typedef block_graph::BlockGraph BlockGraph;
32 : typedef block_graph::BlockGraph::ImageFormat ImageFormat;
33 :
34 E : InstrumenterWithAgent() { }
35 E : ~InstrumenterWithAgent() { }
36 :
37 : // @name Accessors.
38 : // @
39 E : const std::string& agent_dll() {
40 E : return agent_dll_;
41 E : }
42 : // @}
43 :
44 : protected:
45 : // @name InstrumenterWithRelinker interface redeclaration.
46 : // @{
47 : virtual bool InstrumentPrepare() = 0;
48 : virtual bool InstrumentImpl() = 0;
49 : virtual const char* InstrumentationMode() = 0;
50 : // @}
51 :
52 : // @name Super overrides.
53 : // @{
54 : bool DoCommandLineParse(const base::CommandLine* command_line) override;
55 : bool CheckCommandLineParse(const base::CommandLine* command_line) override;
56 : // @}
57 :
58 : // The agent DLL used by this instrumentation.
59 : std::string agent_dll_;
60 :
61 : private:
62 : DISALLOW_COPY_AND_ASSIGN(InstrumenterWithAgent);
63 : };
64 :
65 : } // namespace instrumenters
66 : } // namespace instrument
67 :
68 : #endif // SYZYGY_INSTRUMENT_INSTRUMENTERS_INSTRUMENTER_WITH_AGENT_H_
|