aboutsummaryrefslogtreecommitdiff
path: root/tools/lldb-mi/MIDriverBase.cpp
blob: 353f5c32a164c4e97e231f8fea18acd3f11109e5 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
//===-- MIDriverBase.cpp ----------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

//++
// File:		MIDriverBase.cpp
//
// Overview:	CMIDriverBase implementation.
//
// Environment:	Compilers:	Visual C++ 12.
//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
//				Libraries:	See MIReadmetxt. 
//
// Copyright:	None.
//--

// Third party headers:
#include <lldb/API/SBEvent.h>
#include <lldb/API/SBBroadcaster.h>

// In-house headers:
#include "MIDriverBase.h"

//++ ------------------------------------------------------------------------------------
// Details:	CMIDriverBase constructor.
// Type:	Method.
// Args:	None.
// Return:	None.
// Throws:	None.
//--
CMIDriverBase::CMIDriverBase( void )
:	m_pDriverFallThru( nullptr )
,	m_pDriverParent( nullptr )
,	m_bExitApp( false )
{
}

//++ ------------------------------------------------------------------------------------
// Details:	CMIDriverBase destructor.
// Type:	Overrideable.
// Args:	None.
// Return:	None.
// Throws:	None.
//--
CMIDriverBase::~CMIDriverBase( void )
{
	m_pDriverFallThru = NULL;
}

//++ ------------------------------------------------------------------------------------
// Details:	This function allows *this driver to call on another driver to perform work
//			should this driver not be able to handle the client data input.
// Type:	Overrideable.
//			Check the error message if the function returns a failure.
// Type:	Overridden.
// Args:	vCmd		- (R) Command instruction to interpret.
//			vwErrMsg	- (W) Error description on command failing.
// Return:	MIstatus::success - Command succeeded.
//			MIstatus::failure - Command failed.
// Throws:	None.
//--
bool CMIDriverBase::DoFallThruToAnotherDriver( const CMIUtilString & vCmd, CMIUtilString & vwErrMsg )
{
	// Do nothing - override and implement. Use m_pDriverFallThru.
	return MIstatus::success;
}

//++ ------------------------------------------------------------------------------------
// Details:	This function allows *this driver to call on another driver to perform work
//			should this driver not be able to handle the client data input.
// Type:	Overrideable.
// Args:	vrOtherDriver	- (R) Reference to another driver object.
// Return:	MIstatus::success - Functional succeeded.
//			MIstatus::failure - Functional failed.
// Throws:	None.
//--
bool CMIDriverBase::SetDriverToFallThruTo( const CMIDriverBase & vrOtherDriver )
{
	MIunused( vrOtherDriver );

	// Do nothing - override and implement. Set m_pDriverFallThru.

	return MIstatus::success;
}

//++ ------------------------------------------------------------------------------------
// Details:	This function allows *this driver to call functionality on the parent driver
//			ask for information for example.
// Type:	Overrideable.
// Args:	vrOtherDriver	- (R) Reference to another driver object.
// Return:	MIstatus::success - Functional succeeded.
//			MIstatus::failure - Functional failed.
// Throws:	None.
//--
bool CMIDriverBase::SetDriverParent( const CMIDriverBase & vrOtherDriver )
{
	MIunused( vrOtherDriver );

	// Do nothing - override and implement. Set m_pDriverParent.

	return MIstatus::success;
}

//++ ------------------------------------------------------------------------------------
// Details:	Retrieve the parent driver to *this driver if one assigned. If assigned *this
//			is the pass through driver that the parent driver passes work to.
// Type:	Method.
// Args:	None.
// Return:	CMIDriverBase *	- Pointer to a driver object.
//								- NULL = there is not parent to *this driver.
// Throws:	None.
//--
CMIDriverBase * CMIDriverBase::GetDriversParent( void ) const
{
	return m_pDriverParent;
}

//++ ------------------------------------------------------------------------------------
// Details:	Retrieve the pointer to the other fall through driver *this driver is using
//			(or not using).
// Type:	Method.
// Args:	None.
// Return:	CMIDriverBase * - Pointer to other driver.
//							 - NULL if no driver set.
// Throws:	None.
//--
CMIDriverBase * CMIDriverBase::GetDriverToFallThruTo( void ) const
{
	return m_pDriverFallThru;
}

//++ ------------------------------------------------------------------------------------
// Details:	*this driver provides a file stream to other drivers on which *this driver
//			write's out to and they read as expected input. *this driver is passing
//			through commands to the (child) pass through assigned driver.
// Type:	Overrideable.
// Args:	None.
// Return:	FILE * - Pointer to stream.
// Throws:	None.
//--
FILE * CMIDriverBase::GetStdin( void ) const
{
	// Do nothing - override and implement
	return nullptr;
}

//++ ------------------------------------------------------------------------------------
// Details:	*this driver provides a file stream to other pass through assigned drivers 
//			so they know what to write to.
// Type:	Overrideable.
// Args:	None.
// Return:	FILE * - Pointer to stream.
// Throws:	None.
//--
FILE * CMIDriverBase::GetStdout( void ) const
{
	// Do nothing - override and implement
	return nullptr;
}

//++ ------------------------------------------------------------------------------------
// Details:	*this driver provides a error file stream to other pass through assigned drivers 
//			so they know what to write to.
// Type:	Overrideable.
// Args:	None.
// Return:	FILE * - Pointer to stream.
// Throws:	None.
//--
FILE * CMIDriverBase::GetStderr( void ) const
{
	// Do nothing - override and implement
	return nullptr;
}

//++ ------------------------------------------------------------------------------------
// Details:	Set the MI Driver's exit application flag. The application checks this flag 
//			after every stdin line is read so the exit may not be instantious.
//			If vbForceExit is false the MI Driver queries its state and determines if is
//			should exit or continue operating depending on that running state.
// Type:	Overrideable.
// Args:	vbForceExit	- (R) True = Do not query, set state to exit, false = query if can/should exit right now.
// Return:	None.
// Throws:	None.
//--
void CMIDriverBase::SetExitApplicationFlag( const bool vbForceExit )
{
	MIunused( vbForceExit );

	// Do nothing - override and implement
}