OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. 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 CRASHPAD_SNAPSHOT_SYSTEM_SNAPSHOT_MAC_H_ |
| 16 #define CRASHPAD_SNAPSHOT_SYSTEM_SNAPSHOT_MAC_H_ |
| 17 |
| 18 #include <stdint.h> |
| 19 |
| 20 #include <string> |
| 21 |
| 22 #include "base/basictypes.h" |
| 23 #include "snapshot/system_snapshot.h" |
| 24 #include "util/misc/initialization_state_dcheck.h" |
| 25 |
| 26 namespace crashpad { |
| 27 |
| 28 class ProcessReader; |
| 29 |
| 30 namespace internal { |
| 31 |
| 32 //! \brief A SystemSnapshot of the running system, when the system runs Mac OS |
| 33 //! X. |
| 34 class SystemSnapshotMac final : public SystemSnapshot { |
| 35 public: |
| 36 SystemSnapshotMac(); |
| 37 ~SystemSnapshotMac(); |
| 38 |
| 39 //! \brief Initializes the object. |
| 40 //! |
| 41 //! \param[in] process_reader A reader for the process being snapshotted. |
| 42 //! \n\n |
| 43 //! It seems odd that a system snapshot implementation would need a |
| 44 //! ProcessReader, but some of the information reported about the system |
| 45 //! depends on the process it’s being reported for. For example, the |
| 46 //! architecture returned by GetCPUArchitecture() should be the |
| 47 //! architecture of the process, which may be different than the native |
| 48 //! architecture of the system: an x86_64 system can run both x86_64 and |
| 49 //! 32-bit x86 processes. |
| 50 //! \param[in] snapshot_time The time of the snapshot being taken. |
| 51 //! \n\n |
| 52 //! This parameter is necessary for TimeZone() to determine whether |
| 53 //! daylight saving time was in effect at the time the snapshot was taken. |
| 54 //! Otherwise, it would need to base its determination on the current |
| 55 //! time, which may be different than the snapshot time for snapshots |
| 56 //! generated around the daylight saving transition time. |
| 57 void Initialize(ProcessReader* process_reader, const timeval* snapshot_time); |
| 58 |
| 59 // SystemSnapshot: |
| 60 |
| 61 virtual CPUArchitecture GetCPUArchitecture() const override; |
| 62 virtual uint32_t CPURevision() const override; |
| 63 virtual uint8_t CPUCount() const override; |
| 64 virtual std::string CPUVendor() const override; |
| 65 virtual void CPUFrequency(uint64_t* current_hz, |
| 66 uint64_t* max_hz) const override; |
| 67 virtual uint32_t CPUX86Signature() const override; |
| 68 virtual uint64_t CPUX86Features() const override; |
| 69 virtual uint64_t CPUX86ExtendedFeatures() const override; |
| 70 virtual uint32_t CPUX86Leaf7Features() const override; |
| 71 virtual bool CPUX86SupportsDAZ() const override; |
| 72 virtual OperatingSystem GetOperatingSystem() const override; |
| 73 virtual bool OSServer() const override; |
| 74 virtual void OSVersion(int* major, |
| 75 int* minor, |
| 76 int* bugfix, |
| 77 std::string* build) const override; |
| 78 virtual std::string OSVersionFull() const override; |
| 79 virtual bool NXEnabled() const override; |
| 80 virtual std::string MachineDescription() const override; |
| 81 virtual void TimeZone(DaylightSavingTimeStatus* dst_status, |
| 82 int* standard_offset_seconds, |
| 83 int* daylight_offset_seconds, |
| 84 std::string* standard_name, |
| 85 std::string* daylight_name) const override; |
| 86 |
| 87 private: |
| 88 std::string os_version_full_; |
| 89 std::string os_version_build_; |
| 90 ProcessReader* process_reader_; // weak |
| 91 const timeval* snapshot_time_; // weak |
| 92 int os_version_major_; |
| 93 int os_version_minor_; |
| 94 int os_version_bugfix_; |
| 95 bool os_server_; |
| 96 InitializationStateDcheck initialized_; |
| 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(SystemSnapshotMac); |
| 99 }; |
| 100 |
| 101 } // namespace internal |
| 102 } // namespace crashpad |
| 103 |
| 104 #endif // CRASHPAD_SNAPSHOT_SYSTEM_SNAPSHOT_MAC_H_ |
OLD | NEW |