aboutsummaryrefslogtreecommitdiff
path: root/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.h
blob: 65b397c13fd96b105bd34843516a77ac8c9d0113 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//===-- MICmnLLDBDebuggerHandleEvents.h -------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

//++
// File:        MICmnLLDBDebuggerHandleEvents.h
//
// Overview:    CMICmnLLDBDebuggerHandleEvents interface.
//
// Environment: Compilers:  Visual C++ 12.
//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
//              Libraries:  See MIReadmetxt.
//
// Copyright:   None.
//--

#pragma once

// In-house headers:
#include "MICmnBase.h"
#include "MICmnMIValueTuple.h"
#include "MIUtilSingletonBase.h"

// Declarations:
class CMICmnLLDBDebugSessionInfo;
class CMICmnMIResultRecord;
class CMICmnStreamStdout;
class CMICmnMIOutOfBandRecord;

//++ ============================================================================
// Details: MI class to take LLDB SBEvent objects, filter them and form
//          MI Out-of-band records from the information inside the event object.
//          These records are then pushed to stdout.
//          A singleton class.
// Gotchas: None.
// Authors: Illya Rudkin 02/03/2014.
// Changes: None.
//--
class CMICmnLLDBDebuggerHandleEvents : public CMICmnBase, public MI::ISingleton<CMICmnLLDBDebuggerHandleEvents>
{
    friend class MI::ISingleton<CMICmnLLDBDebuggerHandleEvents>;

    // Methods:
  public:
    bool Initialize(void);
    bool Shutdown(void);
    //
    bool HandleEvent(const lldb::SBEvent &vEvent, bool &vrbHandledEvent, bool &vrbExitAppEvent);

    // Methods:
  private:
    /* ctor */ CMICmnLLDBDebuggerHandleEvents(void);
    /* ctor */ CMICmnLLDBDebuggerHandleEvents(const CMICmnLLDBDebuggerHandleEvents &);
    void operator=(const CMICmnLLDBDebuggerHandleEvents &);
    //
    bool ChkForStateChanges(void);
    bool GetProcessStdout(void);
    bool GetProcessStderr(void);
    bool HandleEventSBBreakPoint(const lldb::SBEvent &vEvent);
    bool HandleEventSBBreakpointCmn(const lldb::SBEvent &vEvent);
    bool HandleEventSBBreakpointAdded(const lldb::SBEvent &vEvent);
    bool HandleEventSBBreakpointLocationsAdded(const lldb::SBEvent &vEvent);
    bool HandleEventSBProcess(const lldb::SBEvent &vEvent, bool &vrbExitAppEvent);
    bool HandleEventSBThread(const lldb::SBEvent &vEvent);
    bool HandleEventSBThreadBitStackChanged(const lldb::SBEvent &vEvent);
    bool HandleEventSBThreadSuspended(const lldb::SBEvent &vEvent);
    bool HandleEventSBCommandInterpreter(const lldb::SBEvent &vEvent);
    bool HandleProcessEventBroadcastBitStateChanged(const lldb::SBEvent &vEvent, bool &vrbExitAppEvent);
    bool HandleProcessEventStateRunning(void);
    bool HandleProcessEventStateExited(void);
    bool HandleProcessEventStateStopped(bool &vwrbShouldBrk);
    bool HandleProcessEventStopReasonTrace(void);
    bool HandleProcessEventStopReasonBreakpoint(void);
    bool HandleProcessEventStopSignal(bool &vwrbShouldBrk);
    bool HandleProcessEventStateSuspended(const lldb::SBEvent &vEvent);
    bool MiHelpGetCurrentThreadFrame(CMICmnMIValueTuple &vwrMiValueTuple);
    bool MiResultRecordToStdout(const CMICmnMIResultRecord &vrMiResultRecord);
    bool MiOutOfBandRecordToStdout(const CMICmnMIOutOfBandRecord &vrMiResultRecord);
    bool MiStoppedAtBreakPoint(const MIuint64 vBrkPtId, const lldb::SBBreakpoint &vBrkPt);
    bool TextToStdout(const CMIUtilString &vrTxt);
    bool TextToStderr(const CMIUtilString &vrTxt);
    bool UpdateSelectedThread(void);
    bool ConvertPrintfCtrlCodeToString(const MIchar vCtrl, CMIUtilString &vwrStrEquivalent);

    // Overridden:
  private:
    // From CMICmnBase
    /* dtor */ virtual ~CMICmnLLDBDebuggerHandleEvents(void);
};