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 <string>
13 
14 #include "lldb/Target/StopInfo.h"
15 
16 namespace lldb_private {
17 
19  /// Determine the pointer-authentication related failure that caused this
20  /// exception. Returns true and fills out the failure description if there
21  /// is auth-related failure, and returns false otherwise.
23 
24 public:
25  // Constructors and Destructors
27  uint32_t exc_data_count, uint64_t exc_code,
28  uint64_t exc_subcode)
29  : StopInfo(thread, exc_type), m_exc_data_count(exc_data_count),
30  m_exc_code(exc_code), m_exc_subcode(exc_subcode) {}
31 
32  ~StopInfoMachException() override = default;
33 
34  lldb::StopReason GetStopReason() const override {
36  }
37 
38  const char *GetDescription() override;
39 
40  // Since some mach exceptions will be reported as breakpoints, signals,
41  // or trace, we use this static accessor which will translate the mach
42  // exception into the correct StopInfo.
43  static lldb::StopInfoSP CreateStopReasonWithMachException(
44  Thread &thread, uint32_t exc_type, uint32_t exc_data_count,
45  uint64_t exc_code, uint64_t exc_sub_code, uint64_t exc_sub_sub_code,
46  bool pc_already_adjusted = true, bool adjust_pc_if_needed = false);
47 
48 protected:
50  uint64_t m_exc_code;
51  uint64_t m_exc_subcode;
52 };
53 
54 } // namespace lldb_private
55 
56 #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_STOPINFOMACHEXCEPTION_H
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::StopInfoMachException::StopInfoMachException
StopInfoMachException(Thread &thread, uint32_t exc_type, uint32_t exc_data_count, uint64_t exc_code, uint64_t exc_subcode)
Definition: StopInfoMachException.h:26
lldb_private::StopInfoMachException::GetDescription
const char * GetDescription() override
Definition: StopInfoMachException.cpp:210
lldb::StopReason
StopReason
Thread stop reasons.
Definition: lldb-enumerations.h:239
lldb::eStopReasonException
@ eStopReasonException
Definition: lldb-enumerations.h:246
lldb_private::StopInfoMachException::m_exc_subcode
uint64_t m_exc_subcode
Definition: StopInfoMachException.h:51
lldb_private::StopInfoMachException
Definition: StopInfoMachException.h:18
lldb_private::Thread
Definition: Thread.h:60
lldb_private::StopInfoMachException::m_exc_code
uint64_t m_exc_code
Definition: StopInfoMachException.h:50
uint32_t
StopInfo.h
lldb_private::StopInfoMachException::m_exc_data_count
uint32_t m_exc_data_count
Definition: StopInfoMachException.h:49
lldb_private::StopInfoMachException::~StopInfoMachException
~StopInfoMachException() override=default
lldb_private::StopInfoMachException::CreateStopReasonWithMachException
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)
Definition: StopInfoMachException.cpp:522
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::StopInfo
Definition: StopInfo.h:20
lldb_private::StopInfoMachException::DeterminePtrauthFailure
bool DeterminePtrauthFailure(ExecutionContext &exe_ctx)
Determine the pointer-authentication related failure that caused this exception.
Definition: StopInfoMachException.cpp:74
lldb_private::StopInfoMachException::GetStopReason
lldb::StopReason GetStopReason() const override
Definition: StopInfoMachException.h:34