1 //===-- StopInfoMachException.h ---------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef liblldb_StopInfoMachException_h_
11 #define liblldb_StopInfoMachException_h_
12 
13 #include <string>
14 
15 #include "lldb/Target/StopInfo.h"
16 
17 namespace lldb_private {
18 
19 class StopInfoMachException : public StopInfo {
20 public:
21   //------------------------------------------------------------------
22   // Constructors and Destructors
23   //------------------------------------------------------------------
StopInfoMachException(Thread & thread,uint32_t exc_type,uint32_t exc_data_count,uint64_t exc_code,uint64_t exc_subcode)24   StopInfoMachException(Thread &thread, uint32_t exc_type,
25                         uint32_t exc_data_count, uint64_t exc_code,
26                         uint64_t exc_subcode)
27       : StopInfo(thread, exc_type), m_exc_data_count(exc_data_count),
28         m_exc_code(exc_code), m_exc_subcode(exc_subcode) {}
29 
30   ~StopInfoMachException() override = default;
31 
GetStopReason()32   lldb::StopReason GetStopReason() const override {
33     return lldb::eStopReasonException;
34   }
35 
36   const char *GetDescription() override;
37 
38   // Since some mach exceptions will be reported as breakpoints, signals,
39   // or trace, we use this static accessor which will translate the mach
40   // exception into the correct StopInfo.
41   static lldb::StopInfoSP CreateStopReasonWithMachException(
42       Thread &thread, uint32_t exc_type, uint32_t exc_data_count,
43       uint64_t exc_code, uint64_t exc_sub_code, uint64_t exc_sub_sub_code,
44       bool pc_already_adjusted = true, bool adjust_pc_if_needed = false);
45 
46 protected:
47   uint32_t m_exc_data_count;
48   uint64_t m_exc_code;
49   uint64_t m_exc_subcode;
50 };
51 
52 } // namespace lldb_private
53 
54 #endif // liblldb_StopInfoMachException_h_
55