197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// Copyright (c) 2006, Google Inc.
297d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// All rights reserved.
397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai//
497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// Redistribution and use in source and binary forms, with or without
597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// modification, are permitted provided that the following conditions are
697d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// met:
797d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai//
897d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai//     * Redistributions of source code must retain the above copyright
997d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// notice, this list of conditions and the following disclaimer.
1097d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai//     * Redistributions in binary form must reproduce the above
1197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// copyright notice, this list of conditions and the following disclaimer
1297d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// in the documentation and/or other materials provided with the
1397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// distribution.
1497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai//     * Neither the name of Google Inc. nor the names of its
1597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// contributors may be used to endorse or promote products derived from
1697d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// this software without specific prior written permission.
1797d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai//
1897d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1997d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2097d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2297d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2697d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2797d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2897d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2997d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
3097d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// system_info.h: Information about the system that was running a program
3197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// when a crash report was produced.
3297d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai//
3397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai// Author: Mark Mentovai
3497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
35e5dc60822e5938fea2ae892ccddb906641ba174emmentovai#ifndef GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
36e5dc60822e5938fea2ae892ccddb906641ba174emmentovai#define GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
3797d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
3897d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai#include <string>
3997d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
404e518a4357a2d1c379d4a91df6d4e153ee791101ivan.penkov@gmail.com#include "common/using_std_string.h"
4197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
424e518a4357a2d1c379d4a91df6d4e153ee791101ivan.penkov@gmail.comnamespace google_breakpad {
4397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
4497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovaistruct SystemInfo {
4597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai public:
4690e050e5982a5cddc3d544d103eccc06be42f184ted.mielczarek  SystemInfo() : os(), os_short(), os_version(), cpu(), cpu_info(),
4790e050e5982a5cddc3d544d103eccc06be42f184ted.mielczarek    cpu_count(0) {}
4890e050e5982a5cddc3d544d103eccc06be42f184ted.mielczarek
4997d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // Resets the SystemInfo object to its default values.
5097d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  void Clear() {
5197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai    os.clear();
5297d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai    os_short.clear();
5397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai    os_version.clear();
5497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai    cpu.clear();
5597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai    cpu_info.clear();
5690e050e5982a5cddc3d544d103eccc06be42f184ted.mielczarek    cpu_count = 0;
5797d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  }
5897d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
5997d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // A string identifying the operating system, such as "Windows NT",
6097d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // "Mac OS X", or "Linux".  If the information is present in the dump but
6197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // its value is unknown, this field will contain a numeric value.  If
6297d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // the information is not present in the dump, this field will be empty.
6397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  string os;
6497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
6597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // A short form of the os string, using lowercase letters and no spaces,
6600de8ca0a0384924b127937a24525ee473e2d367mseaborn@chromium.org  // suitable for use in a filesystem.  Possible values include "windows",
6700de8ca0a0384924b127937a24525ee473e2d367mseaborn@chromium.org  // "mac", "linux" and "nacl".  Empty if the information is not present
6800de8ca0a0384924b127937a24525ee473e2d367mseaborn@chromium.org  // in the dump or if the OS given by the dump is unknown.  The values
6900de8ca0a0384924b127937a24525ee473e2d367mseaborn@chromium.org  // stored in this field should match those used by
7000de8ca0a0384924b127937a24525ee473e2d367mseaborn@chromium.org  // MinidumpSystemInfo::GetOS.
7197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  string os_short;
7297d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
7397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // A string identifying the version of the operating system, such as
7497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // "5.1.2600 Service Pack 2" or "10.4.8 8L2127".  If the dump does not
7597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // contain this information, this field will be empty.
7697d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  string os_version;
7797d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
7897d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // A string identifying the basic CPU family, such as "x86" or "ppc".
7997d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // If this information is present in the dump but its value is unknown,
8097d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // this field will contain a numeric value.  If the information is not
8197d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // present in the dump, this field will be empty.  The values stored in
8297d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // this field should match those used by MinidumpSystemInfo::GetCPU.
8397d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  string cpu;
8497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
8597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // A string further identifying the specific CPU, such as
8697d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // "GenuineIntel level 6 model 13 stepping 8".  If the information is not
8797d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // present in the dump, or additional identifying information is not
8897d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  // defined for the CPU family, this field will be empty.
8997d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai  string cpu_info;
9090e050e5982a5cddc3d544d103eccc06be42f184ted.mielczarek
9190e050e5982a5cddc3d544d103eccc06be42f184ted.mielczarek  // The number of processors in the system.  Will be greater than one for
9290e050e5982a5cddc3d544d103eccc06be42f184ted.mielczarek  // multi-core systems.
9390e050e5982a5cddc3d544d103eccc06be42f184ted.mielczarek  int cpu_count;
9497d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai};
9597d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
96e5dc60822e5938fea2ae892ccddb906641ba174emmentovai}  // namespace google_breakpad
9797d392dc4b60f0099cd7ad8c8a5f06581a532392mmentovai
98e5dc60822e5938fea2ae892ccddb906641ba174emmentovai#endif  // GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
99