Coverage for /Syzygy/agent/asan/reporters/crashpad_reporter.h

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

Line-by-line coverage:

   1    :  // Copyright 2016 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_REPORTERS_CRASHPAD_REPORTER_H_
  16    :  #define SYZYGY_AGENT_ASAN_REPORTERS_CRASHPAD_REPORTER_H_
  17    :  
  18    :  #include <windows.h>
  19    :  #include <memory>
  20    :  
  21    :  #include "base/callback.h"
  22    :  #include "client/crashpad_info.h"
  23    :  #include "syzygy/agent/asan/reporter.h"
  24    :  
  25    :  namespace agent {
  26    :  namespace asan {
  27    :  namespace reporters {
  28    :  
  29    :  // Implements Crashpad crash reporting integration. Use of this class is not
  30    :  // thread safe.
  31    :  class CrashpadReporter : public ReporterInterface {
  32    :   public:
  33    :    // The name of this reporter, as returned by GetName.
  34    :    static const char kName[];
  35    :  
  36    :    // Factory for a CrashpadReporter. This returns null if the running process
  37    :    // does not support Crashpad crash reporting. Support is decided by examining
  38    :    // the exports of the running executable, and looking for Crashpad's expected
  39    :    // exports.
  40    :    // @returns an allocated CrashpadReporter
  41    :    static std::unique_ptr<CrashpadReporter> Create();
  42    :  
  43  E :    virtual ~CrashpadReporter() {}
  44    :  
  45    :    // @name ReporterInterface implementation.
  46    :    // @{
  47    :    const char* GetName() const override;
  48    :    uint32_t GetFeatures() const override;
  49    :    // This can fail when the underlying Crashpad dictionary is full.
  50    :    bool SetCrashKey(base::StringPiece key, base::StringPiece value) override;
  51    :    // This can fail if the underlying Crashpad struct is full. Even when it
  52    :    // fails it will have stored as many memory_ranges as possible.
  53    :    bool SetMemoryRanges(const MemoryRanges& memory_ranges) override;
  54    :    // NOTE: This should only be called once for a given stream ID, as Crashpad
  55    :    // doesn't allow overwriting. Calling repeatedly with the same ID will
  56    :    // currently cause the Crashpad minidump writer to explode.
  57    :    bool SetCustomStream(uint32_t stream_type,
  58    :                         const uint8_t* stream_data,
  59    :                         size_t stream_length) override;
  60    :    void DumpAndCrash(EXCEPTION_POINTERS* exception_pointers) override;
  61    :    bool DumpWithoutCrash(const CONTEXT& context) override;
  62    :    // @}
  63    :  
  64    :   private:
  65    :    friend class CrashpadReporterTest;
  66    :  
  67    :    explicit CrashpadReporter(crashpad::CrashpadInfo* crashpad_info);
  68    :  
  69    :    crashpad::CrashpadInfo* crashpad_info_;
  70    :    std::unique_ptr<crashpad::SimpleAddressRangeBag> crash_ranges_;
  71    :    std::unique_ptr<crashpad::SimpleStringDictionary> crash_keys_;
  72    :  
  73    :    DISALLOW_COPY_AND_ASSIGN(CrashpadReporter);
  74    :  };
  75    :  
  76    :  }  // namespace reporters
  77    :  }  // namespace asan
  78    :  }  // namespace agent
  79    :  
  80    :  #endif  // SYZYGY_AGENT_ASAN_REPORTERS_CRASHPAD_REPORTER_H_

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