Chromium Code Reviews| Index: snapshot/win/thread_snapshot_win.cc |
| diff --git a/snapshot/win/thread_snapshot_win.cc b/snapshot/win/thread_snapshot_win.cc |
| index 689e79ca40aadef791ac06199ec935851b8883fb..973ab3a8e5665f20207b6a080c58a00a855a8a63 100644 |
| --- a/snapshot/win/thread_snapshot_win.cc |
| +++ b/snapshot/win/thread_snapshot_win.cc |
| @@ -20,6 +20,51 @@ |
| namespace crashpad { |
| namespace internal { |
| +namespace { |
| + |
| +void InitializeX64Context(const CONTEXT& context, |
| + CPUContextX86_64* out) { |
| + out->rax = context.Rax; |
| + out->rbx = context.Rbx; |
| + out->rcx = context.Rcx; |
| + out->rdx = context.Rdx; |
| + out->rdi = context.Rdi; |
| + out->rsi = context.Rsi; |
| + out->rbp = context.Rbp; |
| + out->rsp = context.Rsp; |
| + out->r8 = context.R8; |
| + out->r9 = context.R9; |
| + out->r10 = context.R10; |
| + out->r11 = context.R11; |
| + out->r12 = context.R12; |
| + out->r13 = context.R13; |
| + out->r14 = context.R14; |
| + out->r15 = context.R15; |
| + out->rip = context.Rip; |
| + out->rflags = context.EFlags; |
|
cpu_(ooo_6.6-7.5)
2015/05/12 01:06:50
44 is the only one that breaks uniform naming... i
scottmg
2015/05/12 19:37:05
Do you mean the capitalization of the name? (This
|
| + out->cs = context.SegCs; |
| + out->fs = context.SegFs; |
| + out->gs = context.SegGs; |
| + |
| + out->dr0 = context.Dr0; |
| + out->dr1 = context.Dr1; |
| + out->dr2 = context.Dr2; |
| + out->dr3 = context.Dr3; |
| + out->dr6 = context.Dr6; |
| + out->dr7 = context.Dr7; |
| + |
| + static_assert(sizeof(out->fxsave) == sizeof(context.FltSave), |
| + "types must be equivalent"); |
| + memcpy(&out->fxsave, &context.FltSave.ControlWord, sizeof(out->fxsave)); |
| +} |
| + |
| +void InitializeX86Context(const CONTEXT& context, |
| + CPUContextX86* out) { |
| + CHECK(false) << "TODO(scottmg) InitializeX86Context()"; |
| +} |
| + |
| +} // namespace |
| + |
| ThreadSnapshotWin::ThreadSnapshotWin() |
| : ThreadSnapshot(), context_(), stack_(), thread_(), initialized_() { |
| } |
| @@ -36,13 +81,24 @@ bool ThreadSnapshotWin::Initialize( |
| stack_.Initialize( |
| process_reader, thread_.stack_region_address, thread_.stack_region_size); |
| +#if defined(ARCH_CPU_X86_FAMILY) |
| + if (process_reader->Is64Bit()) { |
| + context_.architecture = kCPUArchitectureX86_64; |
| + context_.x86_64 = &context_union_.x86_64; |
| + InitializeX64Context(process_reader_thread.context, context_.x86_64); |
| + } else { |
| + context_.architecture = kCPUArchitectureX86; |
| + context_.x86 = &context_union_.x86; |
| + InitializeX86Context(process_reader_thread.context, context_.x86); |
| + } |
| +#endif |
| + |
| INITIALIZATION_STATE_SET_VALID(initialized_); |
| return true; |
| } |
| const CPUContext* ThreadSnapshotWin::Context() const { |
| INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| - LOG(ERROR) << "TODO(scottmg): CPUContext"; |
| return &context_; |
| } |