1 //===-- RegisterContextMach_i386.cpp --------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 #include <mach/thread_act.h>
13 #include "RegisterContextMach_i386.h"
16 using namespace lldb_private
;
18 RegisterContextMach_i386::RegisterContextMach_i386(Thread
&thread
,
19 uint32_t concrete_frame_idx
)
20 : RegisterContextDarwin_i386(thread
, concrete_frame_idx
) {}
22 RegisterContextMach_i386::~RegisterContextMach_i386() = default;
24 int 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
);
29 int 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
);
34 int 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
);
39 int RegisterContextMach_i386::DoWriteGPR(lldb::tid_t tid
, int flavor
,
41 return ::thread_set_state(
42 tid
, flavor
, reinterpret_cast<thread_state_t
>(const_cast<GPR
*>(&gpr
)),
46 int RegisterContextMach_i386::DoWriteFPU(lldb::tid_t tid
, int flavor
,
48 return ::thread_set_state(
49 tid
, flavor
, reinterpret_cast<thread_state_t
>(const_cast<FPU
*>(&fpu
)),
53 int RegisterContextMach_i386::DoWriteEXC(lldb::tid_t tid
, int flavor
,
55 return ::thread_set_state(
56 tid
, flavor
, reinterpret_cast<thread_state_t
>(const_cast<EXC
*>(&exc
)),