blob: 8840261eaa57ebc87814b19d2b35432406bee421 [file] [log] [blame]
Deepak Panickal6f9c4682014-05-16 10:51:01 +00001//===-- 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
Deepak Panickal6f9c4682014-05-16 10:51:01 +000010// In-house headers:
11#include "MICmnLLDBBroadcaster.h"
12
Kate Stoneb9c1b512016-09-06 20:57:50 +000013//++
14//------------------------------------------------------------------------------------
Zachary Turner1d6af022014-11-17 18:06:21 +000015// Details: CMICmnLLDBBroadcaster constructor.
16// Type: Method.
17// Args: None.
18// Return: None.
19// Throws: None.
Deepak Panickal6f9c4682014-05-16 10:51:01 +000020//--
Bruce Mitchenere2453af2015-08-04 10:24:20 +000021CMICmnLLDBBroadcaster::CMICmnLLDBBroadcaster()
Kate Stoneb9c1b512016-09-06 20:57:50 +000022 : lldb::SBBroadcaster("MI driver") {}
Deepak Panickal6f9c4682014-05-16 10:51:01 +000023
Kate Stoneb9c1b512016-09-06 20:57:50 +000024//++
25//------------------------------------------------------------------------------------
Zachary Turner1d6af022014-11-17 18:06:21 +000026// Details: CMICmnLLDBBroadcaster destructor.
27// Type: Overridable.
28// Args: None.
29// Return: None.
30// Throws: None.
Deepak Panickal6f9c4682014-05-16 10:51:01 +000031//--
Kate Stoneb9c1b512016-09-06 20:57:50 +000032CMICmnLLDBBroadcaster::~CMICmnLLDBBroadcaster() { Shutdown(); }
Deepak Panickal6f9c4682014-05-16 10:51:01 +000033
Kate Stoneb9c1b512016-09-06 20:57:50 +000034//++
35//------------------------------------------------------------------------------------
Bruce Mitchenerae4c0262015-07-07 14:04:40 +000036// Details: Initialize resources for *this broadcaster object.
Zachary Turner1d6af022014-11-17 18:06:21 +000037// Type: Method.
38// Args: None.
39// Return: MIstatus::success - Functionality succeeded.
40// MIstatus::failure - Functionality failed.
41// Throws: None.
Deepak Panickal6f9c4682014-05-16 10:51:01 +000042//--
Kate Stoneb9c1b512016-09-06 20:57:50 +000043bool CMICmnLLDBBroadcaster::Initialize() {
44 m_clientUsageRefCnt++;
Deepak Panickal6f9c4682014-05-16 10:51:01 +000045
Kate Stoneb9c1b512016-09-06 20:57:50 +000046 if (m_bInitialized)
47 return MIstatus::success;
Deepak Panickal6f9c4682014-05-16 10:51:01 +000048
Kate Stoneb9c1b512016-09-06 20:57:50 +000049 m_bInitialized = MIstatus::success;
Zachary Turner1d6af022014-11-17 18:06:21 +000050
Kate Stoneb9c1b512016-09-06 20:57:50 +000051 return m_bInitialized;
Deepak Panickal6f9c4682014-05-16 10:51:01 +000052}
53
Kate Stoneb9c1b512016-09-06 20:57:50 +000054//++
55//------------------------------------------------------------------------------------
Bruce Mitchenerae4c0262015-07-07 14:04:40 +000056// Details: Release resources for *this broadcaster object.
Zachary Turner1d6af022014-11-17 18:06:21 +000057// Type: Method.
58// Args: None.
59// Return: MIstatus::success - Functionality succeeded.
60// MIstatus::failure - Functionality failed.
61// Throws: None.
Deepak Panickal6f9c4682014-05-16 10:51:01 +000062//--
Kate Stoneb9c1b512016-09-06 20:57:50 +000063bool CMICmnLLDBBroadcaster::Shutdown() {
64 if (--m_clientUsageRefCnt > 0)
Zachary Turner1d6af022014-11-17 18:06:21 +000065 return MIstatus::success;
Kate Stoneb9c1b512016-09-06 20:57:50 +000066
67 if (!m_bInitialized)
68 return MIstatus::success;
69
70 m_bInitialized = false;
71
72 return MIstatus::success;
Zachary Turner1d6af022014-11-17 18:06:21 +000073}