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

Unified Diff: snapshot/win/thread_snapshot_win.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « snapshot/win/thread_snapshot_win.h ('k') | util/win/process_structs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/win/thread_snapshot_win.cc
diff --git a/snapshot/win/thread_snapshot_win.cc b/snapshot/win/thread_snapshot_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..689e79ca40aadef791ac06199ec935851b8883fb
--- /dev/null
+++ b/snapshot/win/thread_snapshot_win.cc
@@ -0,0 +1,75 @@
+// Copyright 2015 The Crashpad Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "snapshot/win/thread_snapshot_win.h"
+
+#include "base/logging.h"
+#include "snapshot/win/process_reader_win.h"
+
+namespace crashpad {
+namespace internal {
+
+ThreadSnapshotWin::ThreadSnapshotWin()
+ : ThreadSnapshot(), context_(), stack_(), thread_(), initialized_() {
+}
+
+ThreadSnapshotWin::~ThreadSnapshotWin() {
+}
+
+bool ThreadSnapshotWin::Initialize(
+ ProcessReaderWin* process_reader,
+ const ProcessReaderWin::Thread& process_reader_thread) {
+ INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
+
+ thread_ = process_reader_thread;
+ stack_.Initialize(
+ process_reader, thread_.stack_region_address, thread_.stack_region_size);
+
+ INITIALIZATION_STATE_SET_VALID(initialized_);
+ return true;
+}
+
+const CPUContext* ThreadSnapshotWin::Context() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ LOG(ERROR) << "TODO(scottmg): CPUContext";
+ return &context_;
+}
+
+const MemorySnapshot* ThreadSnapshotWin::Stack() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ return &stack_;
+}
+
+uint64_t ThreadSnapshotWin::ThreadID() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ return thread_.id;
+}
+
+int ThreadSnapshotWin::SuspendCount() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ return thread_.suspend_count;
+}
+
+int ThreadSnapshotWin::Priority() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ return thread_.priority;
+}
+
+uint64_t ThreadSnapshotWin::ThreadSpecificDataAddress() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ return thread_.teb;
+}
+
+} // namespace internal
+} // namespace crashpad
« no previous file with comments | « snapshot/win/thread_snapshot_win.h ('k') | util/win/process_structs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698