1 //===-- MICmnLLDBDebuggerHandleEvents.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 #pragma once 11 12 // In-house headers: 13 #include "MICmnBase.h" 14 #include "MICmnMIValueList.h" 15 #include "MICmnMIValueTuple.h" 16 #include "MIUtilSingletonBase.h" 17 18 // Declarations: 19 class CMICmnLLDBDebugSessionInfo; 20 class CMICmnMIResultRecord; 21 class CMICmnStreamStdout; 22 class CMICmnMIOutOfBandRecord; 23 24 //++ ============================================================================ 25 // Details: MI class to take LLDB SBEvent objects, filter them and form 26 // MI Out-of-band records from the information inside the event object. 27 // These records are then pushed to stdout. 28 // A singleton class. 29 // Gotchas: None. 30 // Authors: Illya Rudkin 02/03/2014. 31 // Changes: None. 32 //-- 33 class CMICmnLLDBDebuggerHandleEvents : public CMICmnBase, public MI::ISingleton<CMICmnLLDBDebuggerHandleEvents> 34 { 35 friend class MI::ISingleton<CMICmnLLDBDebuggerHandleEvents>; 36 37 // Methods: 38 public: 39 bool Initialize(void) override; 40 bool Shutdown(void) override; 41 // 42 bool HandleEvent(const lldb::SBEvent &vEvent, bool &vrbHandledEvent); 43 44 // Methods: 45 private: 46 /* ctor */ CMICmnLLDBDebuggerHandleEvents(void); 47 /* ctor */ CMICmnLLDBDebuggerHandleEvents(const CMICmnLLDBDebuggerHandleEvents &); 48 void operator=(const CMICmnLLDBDebuggerHandleEvents &); 49 // 50 bool ChkForStateChanges(void); 51 bool GetProcessStdout(void); 52 bool GetProcessStderr(void); 53 bool HandleEventSBBreakPoint(const lldb::SBEvent &vEvent); 54 bool HandleEventSBBreakpointCmn(const lldb::SBEvent &vEvent); 55 bool HandleEventSBBreakpointAdded(const lldb::SBEvent &vEvent); 56 bool HandleEventSBBreakpointLocationsAdded(const lldb::SBEvent &vEvent); 57 bool HandleEventSBProcess(const lldb::SBEvent &vEvent); 58 bool HandleEventSBTarget(const lldb::SBEvent &vEvent); 59 bool HandleEventSBThread(const lldb::SBEvent &vEvent); 60 bool HandleEventSBThreadBitStackChanged(const lldb::SBEvent &vEvent); 61 bool HandleEventSBThreadSuspended(const lldb::SBEvent &vEvent); 62 bool HandleEventSBCommandInterpreter(const lldb::SBEvent &vEvent); 63 bool HandleProcessEventBroadcastBitStateChanged(const lldb::SBEvent &vEvent); 64 bool HandleProcessEventStateRunning(void); 65 bool HandleProcessEventStateExited(void); 66 bool HandleProcessEventStateStopped(const lldb::SBEvent &vrEvent, bool &vwrbShouldBrk); 67 bool HandleProcessEventStopReasonTrace(void); 68 bool HandleProcessEventStopReasonBreakpoint(void); 69 bool HandleProcessEventStopSignal(const lldb::SBEvent &vrEvent); 70 bool HandleProcessEventStopException(void); 71 bool HandleProcessEventStateSuspended(const lldb::SBEvent &vEvent); 72 bool HandleTargetEventBroadcastBitModulesLoaded(const lldb::SBEvent &vEvent); 73 bool HandleTargetEventBroadcastBitModulesUnloaded(const lldb::SBEvent &vEvent); 74 bool MiHelpGetModuleInfo(const lldb::SBModule &vModule, const bool vbWithExtraFields, 75 CMICmnMIOutOfBandRecord &vwrMiOutOfBandRecord); 76 bool MiHelpGetCurrentThreadFrame(CMICmnMIValueTuple &vwrMiValueTuple); 77 bool MiResultRecordToStdout(const CMICmnMIResultRecord &vrMiResultRecord); 78 bool MiOutOfBandRecordToStdout(const CMICmnMIOutOfBandRecord &vrMiResultRecord); 79 bool MiStoppedAtBreakPoint(const MIuint64 vBrkPtId, const lldb::SBBreakpoint &vBrkPt); 80 bool TextToStdout(const CMIUtilString &vrTxt); 81 bool TextToStderr(const CMIUtilString &vrTxt); 82 bool UpdateSelectedThread(void); 83 84 // Overridden: 85 private: 86 // From CMICmnBase 87 /* dtor */ ~CMICmnLLDBDebuggerHandleEvents(void) override; 88 void InitializeSignals(); 89 bool m_bSignalsInitialized; 90 MIuint64 m_SIGINT; 91 MIuint64 m_SIGSTOP; 92 MIuint64 m_SIGSEGV; 93 MIuint64 m_SIGTRAP; 94 }; 95