/ src / google_breakpad / processor / system_info.h
system_info.h
  1  // Copyright 2006 Google LLC
  2  //
  3  // Redistribution and use in source and binary forms, with or without
  4  // modification, are permitted provided that the following conditions are
  5  // met:
  6  //
  7  //     * Redistributions of source code must retain the above copyright
  8  // notice, this list of conditions and the following disclaimer.
  9  //     * Redistributions in binary form must reproduce the above
 10  // copyright notice, this list of conditions and the following disclaimer
 11  // in the documentation and/or other materials provided with the
 12  // distribution.
 13  //     * Neither the name of Google LLC nor the names of its
 14  // contributors may be used to endorse or promote products derived from
 15  // this software without specific prior written permission.
 16  //
 17  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 19  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 20  // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 21  // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 22  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 23  // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 24  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 25  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 26  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 27  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 28  
 29  // system_info.h: Information about the system that was running a program
 30  // when a crash report was produced.
 31  //
 32  // Author: Mark Mentovai
 33  
 34  #ifndef GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
 35  #define GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
 36  
 37  #include <string>
 38  
 39  #include "common/using_std_string.h"
 40  
 41  namespace google_breakpad {
 42  
 43  struct SystemInfo {
 44   public:
 45    SystemInfo() : os(), os_short(), os_version(), cpu(), cpu_info(),
 46      cpu_count(0), gl_version(), gl_vendor(), gl_renderer() {}
 47  
 48    // Resets the SystemInfo object to its default values.
 49    void Clear() {
 50      os.clear();
 51      os_short.clear();
 52      os_version.clear();
 53      cpu.clear();
 54      cpu_info.clear();
 55      cpu_count = 0;
 56      gl_version.clear();
 57      gl_vendor.clear();
 58      gl_renderer.clear();
 59    }
 60  
 61    // A string identifying the operating system, such as "Windows NT",
 62    // "Mac OS X", or "Linux".  If the information is present in the dump but
 63    // its value is unknown, this field will contain a numeric value.  If
 64    // the information is not present in the dump, this field will be empty.
 65    string os;
 66  
 67    // A short form of the os string, using lowercase letters and no spaces,
 68    // suitable for use in a filesystem.  Possible values include "windows",
 69    // "mac", "linux" and "nacl".  Empty if the information is not present
 70    // in the dump or if the OS given by the dump is unknown.  The values
 71    // stored in this field should match those used by
 72    // MinidumpSystemInfo::GetOS.
 73    string os_short;
 74  
 75    // A string identifying the version of the operating system, such as
 76    // "5.1.2600 Service Pack 2" or "10.4.8 8L2127".  If the dump does not
 77    // contain this information, this field will be empty.
 78    string os_version;
 79  
 80    // A string identifying the basic CPU family, such as "x86" or "ppc".
 81    // If this information is present in the dump but its value is unknown,
 82    // this field will contain a numeric value.  If the information is not
 83    // present in the dump, this field will be empty.  The values stored in
 84    // this field should match those used by MinidumpSystemInfo::GetCPU.
 85    string cpu;
 86  
 87    // A string further identifying the specific CPU, such as
 88    // "GenuineIntel level 6 model 13 stepping 8".  If the information is not
 89    // present in the dump, or additional identifying information is not
 90    // defined for the CPU family, this field will be empty.
 91    string cpu_info;
 92  
 93    // The number of processors in the system.  Will be greater than one for
 94    // multi-core systems.
 95    int cpu_count;
 96  
 97    // The GPU information. Currently only populated in microdumps.
 98    string gl_version;
 99    string gl_vendor;
100    string gl_renderer;
101  };
102  
103  }  // namespace google_breakpad
104  
105  #endif  // GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__