Coverage for /Syzygy/refinery/symbols/symbol_provider.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0022.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    :  #ifndef SYZYGY_REFINERY_SYMBOLS_SYMBOL_PROVIDER_H_
  16    :  #define SYZYGY_REFINERY_SYMBOLS_SYMBOL_PROVIDER_H_
  17    :  
  18    :  #include "base/macros.h"
  19    :  #include "base/containers/hash_tables.h"
  20    :  #include "base/memory/ref_counted.h"
  21    :  #include "base/memory/scoped_ptr.h"
  22    :  #include "base/strings/string16.h"
  23    :  #include "syzygy/pe/pe_file.h"
  24    :  #include "syzygy/refinery/core/address.h"
  25    :  #include "syzygy/refinery/symbols/simple_cache.h"
  26    :  #include "syzygy/refinery/types/type_repository.h"
  27    :  
  28  m :  namespace refinery {
  29    :  
  30    :  // The SymbolProvider provides symbol information. See DiaSymbolProvider for an
  31    :  // alternative.
  32  m :  class SymbolProvider : public base::RefCounted<SymbolProvider> {
  33  m :   public:
  34  m :    SymbolProvider();
  35    :    // @note virtual to enable mocking.
  36  m :    virtual ~SymbolProvider();
  37    :  
  38    :    // Retrieves or creates a TypeRepository for the module  corresponding to @p
  39    :    // signature.
  40    :    // @note virtual to enable mocking.
  41    :    // @param signature the signature of the module for which to get a type
  42    :    //     repository.
  43    :    // @param type_repo on success, returns a type repository for the module. On
  44    :    //     failure, contains nullptr.
  45    :    // @returns true on success, false on failure.
  46  m :    virtual bool FindOrCreateTypeRepository(
  47  m :        const pe::PEFile::Signature& signature,
  48  m :        scoped_refptr<TypeRepository>* type_repo);
  49    :  
  50    :    // Retrieves or creates a TypeNameIndex for the module  corresponding to @p
  51    :    // signature.
  52    :    // @param signature the signature of the module for which to get a type
  53    :    //     repository.
  54    :    // @param type_repo on success, returns a typename index for the module. On
  55    :    //     failure, contains nullptr.
  56    :    // @returns true on success, false on failure.
  57  m :    bool FindOrCreateTypeNameIndex(const pe::PEFile::Signature& signature,
  58  m :                                   scoped_refptr<TypeNameIndex>* typename_index);
  59    :  
  60  m :   private:
  61  m :    static void GetCacheKey(const pe::PEFile::Signature& signature,
  62  m :                            base::string16* cache_key);
  63    :  
  64    :    // Creates a type repository (without caching it).
  65  m :    bool CreateTypeRepository(const pe::PEFile::Signature& signature,
  66  m :                              scoped_refptr<TypeRepository>* type_repo);
  67    :  
  68    :    // Creates a type name index (without caching it).
  69  m :    bool CreateTypeNameIndex(const pe::PEFile::Signature& signature,
  70  m :                             scoped_refptr<TypeNameIndex>* index);
  71    :  
  72    :    // Caching for type repositories and typename indices. The cache key is
  73    :    // "<basename>:<size>:<checksum>:<timestamp>". The caches may contain
  74    :    // negative entries (indicating a failed attempt at creating a session) in the
  75    :    // form of null pointers.
  76  m :    SimpleCache<TypeRepository> type_repos_;
  77  m :    SimpleCache<TypeNameIndex> typename_indices_;
  78    :  
  79  m :    DISALLOW_COPY_AND_ASSIGN(SymbolProvider);
  80  m :  };
  81    :  
  82  m :  }  // namespace refinery
  83    :  
  84    :  #endif  // SYZYGY_REFINERY_SYMBOLS_SYMBOL_PROVIDER_H_

Coverage information generated Thu Jan 14 17:40:38 2016.