LLDB mainline
RegisterContextMach_i386.cpp
Go to the documentation of this file.
1//===-- RegisterContextMach_i386.cpp --------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#if defined(__APPLE__)
10
11#include <mach/thread_act.h>
12
14
15using namespace lldb;
16using namespace lldb_private;
17
19 uint32_t concrete_frame_idx)
20 : RegisterContextDarwin_i386(thread, concrete_frame_idx) {}
21
23
24int RegisterContextMach_i386::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) {
25 mach_msg_type_number_t count = GPRWordCount;
26 return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count);
27}
28
29int RegisterContextMach_i386::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) {
30 mach_msg_type_number_t count = FPUWordCount;
31 return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count);
32}
33
34int RegisterContextMach_i386::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
35 mach_msg_type_number_t count = EXCWordCount;
36 return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count);
37}
38
40 const GPR &gpr) {
41 return ::thread_set_state(
42 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
44}
45
47 const FPU &fpu) {
48 return ::thread_set_state(
49 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
51}
52
54 const EXC &exc) {
55 return ::thread_set_state(
56 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),
58}
59
60#endif
~RegisterContextMach_i386() override
int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) override
int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) override
RegisterContextMach_i386(lldb_private::Thread &thread, uint32_t concrete_frame_idx)
int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) override
int DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) override
int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) override
int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) override
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
uint64_t tid_t
Definition: lldb-types.h:84