Coverage for /Syzygy/instrument/instrumenters/flummox_instrumenter.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
85.7%670.C++source

Line-by-line coverage:

   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 the flummox instrumenter.
  16    :  
  17    :  #ifndef SYZYGY_INSTRUMENT_INSTRUMENTERS_FLUMMOX_INSTRUMENTER_H_
  18    :  #define SYZYGY_INSTRUMENT_INSTRUMENTERS_FLUMMOX_INSTRUMENTER_H_
  19    :  
  20    :  #include <memory>
  21    :  #include <set>
  22    :  #include <string>
  23    :  
  24    :  #include "base/command_line.h"
  25    :  #include "base/macros.h"
  26    :  #include "base/files/file_path.h"
  27    :  #include "syzygy/instrument/instrumenters/instrumenter_with_relinker.h"
  28    :  #include "syzygy/instrument/transforms/filler_transform.h"
  29    :  
  30    :  namespace instrument {
  31    :  namespace instrumenters {
  32    :  
  33    :  class FlummoxInstrumenter : public InstrumenterWithRelinker {
  34    :   public:
  35    :    typedef InstrumenterWithRelinker Super;
  36    :  
  37    :    class FlummoxConfig {
  38    :     public:
  39  E :      FlummoxConfig() : add_copy_(false) { }
  40  E :      ~FlummoxConfig() { }
  41    :  
  42    :      // Loads (from a JSON string) configurations for the flummox instrumenter.
  43    :      // The contents of the 'json' string should follow the format below:
  44    :      // {
  45    :      //   "targets": {
  46    :      //     "function_name1": [],
  47    :      //     "function_name2": [],
  48    :      //     ...
  49    :      //   },
  50    :      //   "add_copy": true|false
  51    :      // }
  52    :      // @param json A JSON string containing the configuration following the
  53    :      //     format described above.
  54    :      // @param path Path to a JSON file, to use a file instead of a string.
  55    :      // @returns True if the operation succeeded, false otherwise.
  56    :      // @{
  57    :      bool ReadFromJSON(const std::string& json);
  58    :      bool ReadFromJSONPath(const base::FilePath& path);
  59    :      // @}
  60    :  
  61    :      // Accessors
  62    :      // @{
  63  E :      const std::set<std::string>& target_set() const { return target_set_; }
  64  E :      bool add_copy() const { return add_copy_; }
  65    :      // @}
  66    :  
  67    :     protected:
  68    :      std::set<std::string> target_set_;
  69    :      bool add_copy_;
  70    :  
  71    :     private:
  72    :      DISALLOW_COPY_AND_ASSIGN(FlummoxConfig);
  73    :    };
  74    :  
  75  E :    FlummoxInstrumenter() { }
  76  E :    virtual ~FlummoxInstrumenter() { }
  77    :  
  78    :   protected:
  79    :    bool ParseFromJSON();
  80    :  
  81    :    // @name InstrumenterWithRelinker overrides.
  82    :    // @{
  83    :    bool InstrumentPrepare() override;
  84    :    bool InstrumentImpl() override;
  85  i :    const char* InstrumentationMode() override { return "flummox"; }
  86    :    bool DoCommandLineParse(const base::CommandLine* command_line) override;
  87    :    // @}
  88    :  
  89    :    // @name Command-line parameters.
  90    :    // @{
  91    :    base::FilePath flummox_config_path_;
  92    :    // @}
  93    :  
  94    :    FlummoxConfig config_;
  95    :  
  96    :    // The main transformer.
  97    :    std::unique_ptr<instrument::transforms::FillerTransform> flummox_transform_;
  98    :  
  99    :   private:
 100    :    DISALLOW_COPY_AND_ASSIGN(FlummoxInstrumenter);
 101    :  };
 102    :  
 103    :  }  // namespace instrumenters
 104    :  }  // namespace instrument
 105    :  
 106    :  #endif  // SYZYGY_INSTRUMENT_INSTRUMENTERS_FLUMMOX_INSTRUMENTER_H_

Coverage information generated Fri Jul 29 11:00:21 2016.