Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: snapshot/win/thread_snapshot_win.h

Issue 1131473005: win: Add thread snapshot and memory snapshot for stacks (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: comment Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/win/process_snapshot_win.cc ('k') | snapshot/win/thread_snapshot_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_SNAPSHOT_MAC_THREAD_SNAPSHOT_MAC_H_ 15 #ifndef CRASHPAD_SNAPSHOT_WIN_THREAD_SNAPSHOT_WIN_H_
16 #define CRASHPAD_SNAPSHOT_MAC_THREAD_SNAPSHOT_MAC_H_ 16 #define CRASHPAD_SNAPSHOT_WIN_THREAD_SNAPSHOT_WIN_H_
17 17
18 #include <mach/mach.h>
19 #include <stdint.h> 18 #include <stdint.h>
20 19
21 #include "base/basictypes.h" 20 #include "base/basictypes.h"
22 #include "build/build_config.h"
23 #include "snapshot/cpu_context.h" 21 #include "snapshot/cpu_context.h"
24 #include "snapshot/mac/memory_snapshot_mac.h"
25 #include "snapshot/memory_snapshot.h" 22 #include "snapshot/memory_snapshot.h"
26 #include "snapshot/thread_snapshot.h" 23 #include "snapshot/thread_snapshot.h"
24 #include "snapshot/win/memory_snapshot_win.h"
25 #include "snapshot/win/process_reader_win.h"
27 #include "util/misc/initialization_state_dcheck.h" 26 #include "util/misc/initialization_state_dcheck.h"
28 27
29 namespace crashpad { 28 namespace crashpad {
30 29
31 class ProcessReader; 30 class ProcessReaderWin;
32 31
33 namespace internal { 32 namespace internal {
34 33
35 //! \brief A ThreadSnapshot of a thread in a running (or crashed) process on a 34 //! \brief A ThreadSnapshot of a thread in a running (or crashed) process on a
36 //! Mac OS X system. 35 //! Windows system.
37 class ThreadSnapshotMac final : public ThreadSnapshot { 36 class ThreadSnapshotWin final : public ThreadSnapshot {
38 public: 37 public:
39 ThreadSnapshotMac(); 38 ThreadSnapshotWin();
40 ~ThreadSnapshotMac() override; 39 ~ThreadSnapshotWin() override;
41 40
42 //! \brief Initializes the object. 41 //! \brief Initializes the object.
43 //! 42 //!
44 //! \param[in] process_reader A ProcessReader for the task containing the 43 //! \param[in] process_reader A ProcessReaderWin for the process containing
45 //! thread. 44 //! the thread.
46 //! \param[in] process_reader_thread The thread within the ProcessReader for 45 //! \param[in] process_reader_thread The thread within the ProcessReaderWin
47 //! which the snapshot should be created. 46 //! for which the snapshot should be created.
48 //! 47 //!
49 //! \return `true` if the snapshot could be created, `false` otherwise with 48 //! \return `true` if the snapshot could be created, `false` otherwise with
50 //! an appropriate message logged. 49 //! an appropriate message logged.
51 bool Initialize(ProcessReader* process_reader, 50 bool Initialize(ProcessReaderWin* process_reader,
52 const ProcessReader::Thread& process_reader_thread); 51 const ProcessReaderWin::Thread& process_reader_thread);
53 52
54 // ThreadSnapshot: 53 // ThreadSnapshot:
55 54
56 const CPUContext* Context() const override; 55 const CPUContext* Context() const override;
57 const MemorySnapshot* Stack() const override; 56 const MemorySnapshot* Stack() const override;
58 uint64_t ThreadID() const override; 57 uint64_t ThreadID() const override;
59 int SuspendCount() const override; 58 int SuspendCount() const override;
60 int Priority() const override; 59 int Priority() const override;
61 uint64_t ThreadSpecificDataAddress() const override; 60 uint64_t ThreadSpecificDataAddress() const override;
62 61
63 private: 62 private:
64 #if defined(ARCH_CPU_X86_FAMILY)
65 union {
66 CPUContextX86 x86;
67 CPUContextX86_64 x86_64;
68 } context_union_;
69 #endif
70 CPUContext context_; 63 CPUContext context_;
71 MemorySnapshotMac stack_; 64 MemorySnapshotWin stack_;
72 uint64_t thread_id_; 65 ProcessReaderWin::Thread thread_;
73 uint64_t thread_specific_data_address_;
74 thread_t thread_;
75 int suspend_count_;
76 int priority_;
77 InitializationStateDcheck initialized_; 66 InitializationStateDcheck initialized_;
78 67
79 DISALLOW_COPY_AND_ASSIGN(ThreadSnapshotMac); 68 DISALLOW_COPY_AND_ASSIGN(ThreadSnapshotWin);
80 }; 69 };
81 70
82 } // namespace internal 71 } // namespace internal
83 } // namespace crashpad 72 } // namespace crashpad
84 73
85 #endif // CRASHPAD_SNAPSHOT_MAC_THREAD_SNAPSHOT_MAC_H_ 74 #endif // CRASHPAD_SNAPSHOT_WIN_THREAD_SNAPSHOT_WIN_H_
OLDNEW
« no previous file with comments | « snapshot/win/process_snapshot_win.cc ('k') | snapshot/win/thread_snapshot_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698