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

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

Issue 1364803004: win: Save contents of TEBs allowing !teb and !gle to work in windbg (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@dump-without-crashing
Patch Set: rebase Created 5 years, 2 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
OLDNEW
1 // Copyright 2015 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 #include "snapshot/win/thread_snapshot_win.h" 15 #include "snapshot/win/thread_snapshot_win.h"
16 16
17 #include <vector>
18
17 #include "base/logging.h" 19 #include "base/logging.h"
18 #include "snapshot/win/cpu_context_win.h" 20 #include "snapshot/win/cpu_context_win.h"
19 #include "snapshot/win/process_reader_win.h" 21 #include "snapshot/win/process_reader_win.h"
20 22
21 namespace crashpad { 23 namespace crashpad {
22 namespace internal { 24 namespace internal {
23 25
24 ThreadSnapshotWin::ThreadSnapshotWin() 26 ThreadSnapshotWin::ThreadSnapshotWin()
25 : ThreadSnapshot(), context_(), stack_(), thread_(), initialized_() { 27 : ThreadSnapshot(),
28 context_(),
29 stack_(),
30 teb_(),
31 thread_(),
32 initialized_() {
26 } 33 }
27 34
28 ThreadSnapshotWin::~ThreadSnapshotWin() { 35 ThreadSnapshotWin::~ThreadSnapshotWin() {
29 } 36 }
30 37
31 bool ThreadSnapshotWin::Initialize( 38 bool ThreadSnapshotWin::Initialize(
32 ProcessReaderWin* process_reader, 39 ProcessReaderWin* process_reader,
33 const ProcessReaderWin::Thread& process_reader_thread) { 40 const ProcessReaderWin::Thread& process_reader_thread) {
34 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); 41 INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
35 42
36 thread_ = process_reader_thread; 43 thread_ = process_reader_thread;
37 stack_.Initialize( 44 stack_.Initialize(
38 process_reader, thread_.stack_region_address, thread_.stack_region_size); 45 process_reader, thread_.stack_region_address, thread_.stack_region_size);
46 teb_.Initialize(process_reader, thread_.teb_address, thread_.teb_size);
39 47
40 #if defined(ARCH_CPU_X86_64) 48 #if defined(ARCH_CPU_X86_64)
41 if (process_reader->Is64Bit()) { 49 if (process_reader->Is64Bit()) {
42 context_.architecture = kCPUArchitectureX86_64; 50 context_.architecture = kCPUArchitectureX86_64;
43 context_.x86_64 = &context_union_.x86_64; 51 context_.x86_64 = &context_union_.x86_64;
44 InitializeX64Context(process_reader_thread.context.native, context_.x86_64); 52 InitializeX64Context(process_reader_thread.context.native, context_.x86_64);
45 } else { 53 } else {
46 context_.architecture = kCPUArchitectureX86; 54 context_.architecture = kCPUArchitectureX86;
47 context_.x86 = &context_union_.x86; 55 context_.x86 = &context_union_.x86;
48 InitializeX86Context(process_reader_thread.context.wow64, context_.x86); 56 InitializeX86Context(process_reader_thread.context.wow64, context_.x86);
(...skipping 28 matching lines...) Expand all
77 return thread_.suspend_count; 85 return thread_.suspend_count;
78 } 86 }
79 87
80 int ThreadSnapshotWin::Priority() const { 88 int ThreadSnapshotWin::Priority() const {
81 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 89 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
82 return thread_.priority; 90 return thread_.priority;
83 } 91 }
84 92
85 uint64_t ThreadSnapshotWin::ThreadSpecificDataAddress() const { 93 uint64_t ThreadSnapshotWin::ThreadSpecificDataAddress() const {
86 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 94 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
87 return thread_.teb; 95 return thread_.teb_address;
96 }
97
98 std::vector<const MemorySnapshot*> ThreadSnapshotWin::ExtraMemory() const {
99 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
100 std::vector<const MemorySnapshot*> extra_memory;
Mark Mentovai 2015/10/01 20:28:05 (1, &teb_)
scottmg 2015/10/01 21:01:07 Done.
101 extra_memory.push_back(&teb_);
Mark Mentovai 2015/10/01 20:28:05 I’ll give you a pass on this for now, as long as y
scottmg 2015/10/01 21:01:07 I'm probably not fearful enough. Added TODO links.
102 return extra_memory;
88 } 103 }
89 104
90 } // namespace internal 105 } // namespace internal
91 } // namespace crashpad 106 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698