]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/lldb-mi/MICmnLLDBBroadcaster.cpp
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / tools / lldb-mi / MICmnLLDBBroadcaster.cpp
1 //===-- MICmnLLDBBroadcaster.cpp --------------------------------*- 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 // In-house headers:
11 #include "MICmnLLDBBroadcaster.h"
12
13 //++
14 //------------------------------------------------------------------------------------
15 // Details: CMICmnLLDBBroadcaster constructor.
16 // Type:    Method.
17 // Args:    None.
18 // Return:  None.
19 // Throws:  None.
20 //--
21 CMICmnLLDBBroadcaster::CMICmnLLDBBroadcaster()
22     : lldb::SBBroadcaster("MI driver") {}
23
24 //++
25 //------------------------------------------------------------------------------------
26 // Details: CMICmnLLDBBroadcaster destructor.
27 // Type:    Overridable.
28 // Args:    None.
29 // Return:  None.
30 // Throws:  None.
31 //--
32 CMICmnLLDBBroadcaster::~CMICmnLLDBBroadcaster() { Shutdown(); }
33
34 //++
35 //------------------------------------------------------------------------------------
36 // Details: Initialize resources for *this broadcaster object.
37 // Type:    Method.
38 // Args:    None.
39 // Return:  MIstatus::success - Functionality succeeded.
40 //          MIstatus::failure - Functionality failed.
41 // Throws:  None.
42 //--
43 bool CMICmnLLDBBroadcaster::Initialize() {
44   m_clientUsageRefCnt++;
45
46   if (m_bInitialized)
47     return MIstatus::success;
48
49   m_bInitialized = MIstatus::success;
50
51   return m_bInitialized;
52 }
53
54 //++
55 //------------------------------------------------------------------------------------
56 // Details: Release resources for *this broadcaster object.
57 // Type:    Method.
58 // Args:    None.
59 // Return:  MIstatus::success - Functionality succeeded.
60 //          MIstatus::failure - Functionality failed.
61 // Throws:  None.
62 //--
63 bool CMICmnLLDBBroadcaster::Shutdown() {
64   if (--m_clientUsageRefCnt > 0)
65     return MIstatus::success;
66
67   if (!m_bInitialized)
68     return MIstatus::success;
69
70   m_bInitialized = false;
71
72   return MIstatus::success;
73 }