LCOV - code coverage report
Current view: top level - toolkit/components/telemetry - ProcessedStack.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef ProcessedStack_h__
       7             : #define ProcessedStack_h__
       8             : 
       9             : #include <string>
      10             : #include <vector>
      11             : #include "nsString.h"
      12             : 
      13             : namespace mozilla {
      14             : namespace Telemetry {
      15             : 
      16             : // This class represents a stack trace and the modules referenced in that trace.
      17             : // It is designed to be easy to read and write to disk or network and doesn't
      18             : // include any logic on how to collect or read the information it stores.
      19           0 : class ProcessedStack
      20             : {
      21             : public:
      22             :   ProcessedStack();
      23             :   size_t GetStackSize() const;
      24             :   size_t GetNumModules() const;
      25             : 
      26             :   struct Frame
      27             :   {
      28             :     // The offset of this program counter in its module or an absolute pc.
      29             :     uintptr_t mOffset;
      30             :     // The index to pass to GetModule to get the module this program counter
      31             :     // was in.
      32             :     uint16_t mModIndex;
      33             :   };
      34           0 :   struct Module
      35             :   {
      36             :     // The file name, /foo/bar/libxul.so for example.
      37             :     // It can contain unicode characters.
      38             :     nsString mName;
      39             :     std::string mBreakpadId;
      40             : 
      41             :     bool operator==(const Module& other) const;
      42             :   };
      43             : 
      44             :   const Frame &GetFrame(unsigned aIndex) const;
      45             :   void AddFrame(const Frame& aFrame);
      46             :   const Module &GetModule(unsigned aIndex) const;
      47             :   void AddModule(const Module& aFrame);
      48             : 
      49             :   void Clear();
      50             : 
      51             : private:
      52             :   std::vector<Module> mModules;
      53             :   std::vector<Frame> mStack;
      54             : };
      55             : 
      56             : // Get the current list of loaded modules, filter and pair it to the provided
      57             : // stack. We let the caller collect the stack since different callers have
      58             : // different needs (current thread X main thread, stopping the thread, etc).
      59             : ProcessedStack
      60             : GetStackAndModules(const std::vector<uintptr_t> &aPCs);
      61             : 
      62             : } // namespace Telemetry
      63             : } // namespace mozilla
      64             : 
      65             : #endif // ProcessedStack_h__

Generated by: LCOV version 1.13