Coverage for /Syzygy/agent/asan/asan_logger.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%440.C++source

Line-by-line coverage:

   1    :  // Copyright 2012 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_AGENT_ASAN_ASAN_LOGGER_H_
  16    :  #define SYZYGY_AGENT_ASAN_ASAN_LOGGER_H_
  17    :  
  18    :  #include <string>
  19    :  
  20    :  #include "base/logging.h"
  21    :  #include "syzygy/trace/rpc/rpc_helpers.h"
  22    :  
  23    :  namespace agent {
  24    :  namespace asan {
  25    :  
  26    :  // A wrapper class to manage the singleton ASAN RPC logger instance.
  27    :  class AsanLogger {
  28    :   public:
  29    :    AsanLogger();
  30    :  
  31    :    // Set the RPC instance ID to use. If an instance-id is to be used by the
  32    :    // logger, it must be set before calling Init().
  33  E :    void set_instance_id(const base::StringPiece16& instance_id) {
  34  E :      DCHECK(rpc_binding_.Get() == NULL);
  35  E :      instance_id_.assign(instance_id.begin(), instance_id.end());
  36  E :    }
  37    :  
  38    :    // Initialize the logger.
  39    :    void Init();
  40    :  
  41    :    // Write a @p message to the logger.
  42    :    void Write(const std::string& message);
  43    :  
  44    :    // Write a @p message to the logger, and have the logger include the most
  45    :    // detailed and accurate stack trace it can derive given the execution
  46    :    // @p context .
  47    :    void WriteWithContext(const std::string& message, const CONTEXT& context);
  48    :  
  49    :    // Write a @p message to the logger, with an optional stack @p trace
  50    :    // containing @p trace_length elements.
  51    :    void WriteWithStackTrace(const std::string& message,
  52    :                             const void* const* trace_data,
  53    :                             size_t trace_length);
  54    :  
  55    :   protected:
  56    :    // The RPC binding.
  57    :    trace::client::ScopedRpcBinding rpc_binding_;
  58    :  
  59    :    // The logger's instance id.
  60    :    std::wstring instance_id_;
  61    :  
  62    :   private:
  63    :    DISALLOW_COPY_AND_ASSIGN(AsanLogger);
  64    :  };
  65    :  
  66    :  }  // namespace asan
  67    :  }  // namespace agent
  68    :  
  69    :  #endif  // SYZYGY_AGENT_ASAN_ASAN_LOGGER_H_

Coverage information generated Thu Mar 14 11:53:36 2013.