LLDB mainline
StopInfoMachException.h
Go to the documentation of this file.
1//===-- StopInfoMachException.h ---------------------------------*- C++ -*-===//
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#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_STOPINFOMACHEXCEPTION_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_STOPINFOMACHEXCEPTION_H
11
12#include <optional>
13#include <string>
14
16
17#if defined(__APPLE__)
18// Needed for the EXC_* defines
19#include <mach/exception.h>
20#endif
21
22namespace lldb_private {
23
25 /// Determine the pointer-authentication related failure that caused this
26 /// exception. Returns true and fills out the failure description if there
27 /// is auth-related failure, and returns false otherwise.
29
31
32public:
33 // Constructors and Destructors
34 StopInfoMachException(Thread &thread, uint32_t exc_type,
35 uint32_t exc_data_count, uint64_t exc_code,
36 uint64_t exc_subcode,
37 bool not_stepping_but_got_singlestep_exception)
38 : StopInfo(thread, exc_type), m_exc_data_count(exc_data_count),
39 m_exc_code(exc_code), m_exc_subcode(exc_subcode),
41 not_stepping_but_got_singlestep_exception) {}
42
43 ~StopInfoMachException() override = default;
44
47 }
48
49 const char *GetDescription() override;
50
51#if defined(__APPLE__)
52 struct MachException {
53 static const char *Name(exception_type_t exc_type);
54 static std::optional<exception_type_t> ExceptionCode(const char *name);
55 };
56#endif
57
58 // Since some mach exceptions will be reported as breakpoints, signals,
59 // or trace, we use this static accessor which will translate the mach
60 // exception into the correct StopInfo.
62 Thread &thread, uint32_t exc_type, uint32_t exc_data_count,
63 uint64_t exc_code, uint64_t exc_sub_code, uint64_t exc_sub_sub_code,
64 bool pc_already_adjusted = true, bool adjust_pc_if_needed = false);
65
66 bool WasContinueInterrupted(Thread &thread) override;
67
68protected:
70 uint64_t m_exc_code;
71 uint64_t m_exc_subcode;
72
74};
75
76} // namespace lldb_private
77
78#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_STOPINFOMACHEXCEPTION_H
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool DetermineTagMismatch(ExecutionContext &exe_ctx)
bool DeterminePtrauthFailure(ExecutionContext &exe_ctx)
Determine the pointer-authentication related failure that caused this exception.
bool WasContinueInterrupted(Thread &thread) override
A Continue operation can result in a false stop event before any execution has happened.
lldb::StopReason GetStopReason() const override
static lldb::StopInfoSP CreateStopReasonWithMachException(Thread &thread, uint32_t exc_type, uint32_t exc_data_count, uint64_t exc_code, uint64_t exc_sub_code, uint64_t exc_sub_sub_code, bool pc_already_adjusted=true, bool adjust_pc_if_needed=false)
~StopInfoMachException() override=default
StopInfoMachException(Thread &thread, uint32_t exc_type, uint32_t exc_data_count, uint64_t exc_code, uint64_t exc_subcode, bool not_stepping_but_got_singlestep_exception)
friend class Thread
Definition StopInfo.h:245
StopInfo(Thread &thread, uint64_t value)
Definition StopInfo.cpp:34
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
StopReason
Thread stop reasons.
@ eStopReasonException