]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmnResources.cpp
Update ena-com HAL to v1.1.4.3 and update driver accordingly
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmnResources.cpp
1 //===-- MICmnResources.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 // Third party headers
11 #include "assert.h"
12 #include <inttypes.h> // For PRIx64
13
14 // In-house headers:
15 #include "MICmnResources.h"
16
17 // Instantiations:
18 const CMICmnResources::SRsrcTextData
19     CMICmnResources::ms_pResourceId2TextData[] = {
20         {IDS_PROJNAME,
21          "LLDB Machine Interface Driver (MI) All rights reserved"},
22         {IDS_MI_VERSION_DESCRIPTION_DEBUG,
23          "Version: 1.0.0.9 (Debug)"}, // See version history in MIDriverMain.cpp
24         {IDS_MI_VERSION_DESCRIPTION, "Version: 1.0.0.9"},
25         {IDS_MI_APPNAME_SHORT, "MI"},
26         {IDS_MI_APPNAME_LONG, "Machine Interface Driver"},
27         {IDS_MI_APP_FILEPATHNAME, "Application: %s"},
28         {IDS_MI_APP_ARGS, "Command line args: "},
29         {IDE_MI_VERSION_GDB, "Version: GNU gdb (GDB) 7.4 \n(This is a MI stub "
30                              "on top of LLDB and not GDB)\nAll rights "
31                              "reserved.\n"}, // *** Eclipse needs this
32                                              // exactly!!
33         {IDS_UTIL_FILE_ERR_INVALID_PATHNAME,
34          "File Handler. Invalid file name path"},
35         {IDS_UTIL_FILE_ERR_OPENING_FILE, "File Handler. Error %s opening '%s'"},
36         {IDS_UTIL_FILE_ERR_OPENING_FILE_UNKNOWN,
37          "File Handler. Unknown error opening '%s'"},
38         {IDE_UTIL_FILE_ERR_WRITING_FILE, "File Handler. Error %s writing '%s'"},
39         {IDE_UTIL_FILE_ERR_WRITING_NOTOPEN,
40          "File Handler. File '%s' not open for write"},
41         {IDS_RESOURCES_ERR_STRING_NOT_FOUND,
42          "Resources. String (%d) not found in resources"},
43         {IDS_RESOURCES_ERR_STRING_TABLE_INVALID,
44          "Resources. String resource table is not set up"},
45         {IDS_MI_CLIENT_MSG, "Client message: \"%s\""},
46         {IDS_LOG_MSG_CREATION_DATE, "Creation date %s time %s%s"},
47         {IDS_LOG_MSG_FILE_LOGGER_PATH, "File logger path: %s%s"},
48         {IDS_LOG_MSG_VERSION, "Version: %s%s"},
49         {IDS_LOG_ERR_FILE_LOGGER_DISABLED,
50          "Log. File logger temporarily disabled due to file error '%s'"},
51         {IDS_LOG_MEDIUM_ERR_INIT, "Log. Medium '%s' initialise failed. %s"},
52         {IDS_LOG_MEDIUM_ERR_WRITE_ANY,
53          "Log. Failed to write log data to any medium."},
54         {IDS_LOG_MEDIUM_ERR_WRITE_MEDIUMFAIL,
55          "Log. One or mediums failed writing log data."},
56         {IDS_MEDIUMFILE_NAME, "File"},
57         {IDS_MEDIUMFILE_ERR_INVALID_PATH, "<Invalid - not set>"},
58         {IDS_MEDIUMFILE_ERR_FILE_HEADER, "<Invalid - header not set>"},
59         {IDS_MEDIUMFILE_NAME_LOG, "File medium. %s"},
60         {IDE_OS_ERR_UNKNOWN, "Unknown OS error"},
61         {IDE_OS_ERR_RETRIEVING, "Unabled to retrieve OS error message"},
62         {IDS_DRIVERMGR_DRIVER_ERR_INIT,
63          "Driver Manager. Driver '%s' (ID:'%s') initialise failed. %s"},
64         {IDE_MEDIUMSTDERR_NAME, "Stderr"},
65         {IDE_MEDIUMSTDOUT_NAME, "Stdout"},
66         {IDE_MI_APP_DESCRIPTION,
67          "Description:\nThe Machine Interface Driver (MI Driver) is a stand "
68          "alone executable\nthat either be used via "
69          "a client i.e. Eclipse or directly from the command\nline. It "
70          "processes MI commands, actions those commands "
71          "using the internal\ndebugger then forms MI response formatted text "
72          "which is returned to the\nclient."},
73         {IDE_MI_APP_INFORMATION,
74          "Information:\nCurrent limitations. The MI Driver currently only "
75          "handles remote target\ndebugging. Local "
76          "debugging has not been implemented. The MI Driver has\nbeen designed "
77          "primarily to be used with Eclipse Juno "
78          "and a custom plugin.\nThe custom plugin is not necessary to operate "
79          "the MI Driver."},
80         {IDE_MI_APP_ARG_USAGE, "\nMI driver usage:\n\n\tlldb-mi [--longOption] "
81                                "[-s hortOption] [executeable]\n\n[] = optional "
82                                "argument."},
83         {IDE_MI_APP_ARG_HELP, "-h\n--help\n\tPrints out usage information for "
84                               "the MI debugger. Exit the MI\n\tDriver "
85                               "immediately."},
86         {IDE_MI_APP_ARG_VERSION, "--version\n\tPrints out GNU (gdb) version "
87                                  "information. Exit the MI "
88                                  "Driver\n\timmediately."},
89         {IDE_MI_APP_ARG_VERSION_LONG, "--versionLong\n\tPrints out MI Driver "
90                                       "version information. Exit the MI "
91                                       "Driver\n\timmediately."},
92         {IDE_MI_APP_ARG_INTERPRETER, "--interpreter\n\t This option is kept "
93                                      "for backward compatibility. This "
94                                      "executable always run in MI mode"},
95         {IDE_MI_APP_ARG_EXECUTEABLE, "--executable\n\tUse the MI Driver in MI "
96                                      "mode for the debugging the specified "
97                                      "executable."},
98         {IDE_MI_APP_ARG_SOURCE, "-s <filename>\n--source <filename>\n\t"
99                                 "Tells the debugger to read in and execute the "
100                                 "lldb commands in the\n\t"
101                                 "given file, after any file provided on the "
102                                 "command line has been\n\tloaded."},
103         {IDE_MI_APP_ARG_APP_LOG, "--log\n\tUse this argument to tell the MI "
104                                  "Driver to update it's log\n\tfile '%s'."},
105         {IDE_MI_APP_ARG_APP_LOG_DIR,
106          "--log-dir\n\tUse this argument to specify the directory the MI "
107          "Driver\n\twill place the log file in, i.e --log-dir=/tmp."},
108         {IDE_MI_APP_ARG_EXAMPLE, "Example MI command:\n\t3-info-gdb-mi-command "
109                                  "gdb-set\n\t3^done,command={exists=\"true\"}"},
110         {IDE_MI_APP_ARG_EXECUTABLE, "executable (NOT IMPLEMENTED)\n\tThe file "
111                                     "path to the executable i.e. '\"C:\\My "
112                                     "Dev\\foo.exe\"'."},
113         {IDS_STDIN_ERR_INVALID_PROMPT,
114          "Stdin. Invalid prompt description '%s'"},
115         {IDS_STDIN_ERR_THREAD_CREATION_FAILED,
116          "Stdin. Thread creation failed '%s'"},
117         {IDS_STDIN_ERR_THREAD_DELETE, "Stdin. Thread failed to delete '%s'"},
118         {IDS_STDIN_ERR_CHKING_BYTE_AVAILABLE,
119          "Stdin. Peeking on stdin stream '%s'"},
120         {IDS_STDIN_INPUT_CTRL_CHARS,
121          "Stdin. Receive characters not handled as a command: "},
122         {IDS_CMD_QUIT_HELP,
123          "MI Driver Command: quit\n\tExit the MI Driver application."},
124         {IDS_THREADMGR_ERR_THREAD_ID_INVALID,
125          "Thread Mgr. Thread ID '%s' is not valid"},
126         {IDS_THREADMGR_ERR_THREAD_FAIL_CREATE,
127          "Thread Mgr: Failed to create thread '%s'"},
128         {IDS_THREADMGR_ERR_THREAD_ID_NOT_FOUND,
129          "Thread Mgr: Thread with ID '%s' not found"},
130         {IDS_THREADMGR_ERR_THREAD_STILL_ALIVE, "Thread Mgr: The thread(s) are "
131                                                "still alive at Thread Mgr "
132                                                "shutdown: %s"},
133         {IDS_FALLTHRU_DRIVER_CMD_RECEIVED,
134          "Fall Thru Driver. Received command '%s'. Is was %shandled"},
135         {IDS_CMDFACTORY_ERR_INVALID_CMD_NAME,
136          "Command factory. MI command name '%s' is invalid"},
137         {IDS_CMDFACTORY_ERR_INVALID_CMD_CR8FN,
138          "Command factory. Command creation function invalid for command '%s'. "
139          "Does function exist? Pointer assigned to it?"},
140         {IDS_CMDFACTORY_ERR_CMD_NOT_REGISTERED,
141          "Command factory. Command '%s' not registered"},
142         {IDS_CMDFACTORY_ERR_CMD_ALREADY_REGED,
143          "Command factory. Command '%s' by that name already registered"},
144         {IDS_CMDMGR_ERR_CMD_FAILED_CREATE,
145          "Command manager. Command creation failed. %s"},
146         {IDS_CMDMGR_ERR_CMD_INVOKER, "Command manager. %s "},
147         {IDS_MI_INIT_ERR_LOG, "Log. Error occurred during initialisation %s"},
148         {IDS_MI_INIT_ERR_RESOURCES,
149          "Resources. Error occurred during initialisation %s"},
150         {IDS_MI_INIT_ERR_INIT,
151          "Driver. Error occurred during initialisation %s"},
152         {IDS_MI_INIT_ERR_STREAMSTDIN,
153          "Stdin. Error occurred during initialisation %s"},
154         {IDS_MI_INIT_ERR_STREAMSTDIN_OSHANDLER, "Stdin. The OS specific stdin "
155                                                 "stream handler has not been "
156                                                 "specified for this OS"},
157         {IDS_MI_INIT_ERR_OS_STDIN_HANDLER,
158          "Stdin handler. Error occurred during initialisation %s"},
159         {IDS_MI_INIT_ERR_STREAMSTDOUT,
160          "Stdout. Error occurred during initialisation %s"},
161         {IDS_MI_INIT_ERR_STREAMSTDERR,
162          "Stderr. Error occurred during initialisation %s"},
163         {IDS_MI_INIT_ERR_FALLTHRUDRIVER,
164          "Fall Through Driver. Error occurred during initialisation %s"},
165         {IDS_MI_INIT_ERR_THREADMGR,
166          "Thread Mgr. Error occurred during initialisation %s"},
167         {IDS_MI_INIT_ERR_CMDINTERPRETER, "Command interpreter. %s"},
168         {IDS_MI_INIT_ERR_CMDMGR, "Command manager. %s"},
169         {IDS_MI_INIT_ERR_CMDFACTORY, "Command factory. %s"},
170         {IDS_MI_INIT_ERR_CMDINVOKER, "Command invoker. %s"},
171         {IDS_MI_INIT_ERR_CMDMONITOR, "Command monitor. %s"},
172         {IDS_MI_INIT_ERR_LLDBDEBUGGER, "LLDB Debugger. %s"},
173         {IDS_MI_INIT_ERR_DRIVERMGR, "Driver manager. %s"},
174         {IDS_MI_INIT_ERR_DRIVER, "Driver. %s"},
175         {IDS_MI_INIT_ERR_OUTOFBANDHANDLER, "Out-of-band handler. %s "},
176         {IDS_MI_INIT_ERR_DEBUGSESSIONINFO, "LLDB debug session info. %s "},
177         {IDS_MI_INIT_ERR_THREADMANAGER, "Unable to init thread manager."},
178         {IDS_MI_INIT_ERR_CLIENT_USING_DRIVER,
179          "Initialising the client to this driver failed."},
180         {IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION,
181          "Initialising a local debug session failed."},
182         {IDS_CODE_ERR_INVALID_PARAMETER_VALUE,
183          "Code. Invalid parameter passed to function '%s'"},
184         {IDS_CODE_ERR_INVALID_PARAM_NULL_POINTER,
185          "Code. NULL pointer passes as a parameter to function '%s'"},
186         {IDS_CODE_ERR_INVALID_ENUMERATION_VALUE,
187          "Code. Invalid enumeration value encountered in function '%s'"},
188         {
189             IDS_LLDBDEBUGGER_ERR_INVALIDLISTENER,
190             "LLDB Debugger. LLDB Listener is not valid",
191         },
192         {
193             IDS_LLDBDEBUGGER_ERR_INVALIDDEBUGGER,
194             "LLDB Debugger. LLDB Debugger is not valid",
195         },
196         {IDS_LLDBDEBUGGER_ERR_CLIENTDRIVER,
197          "LLDB Debugger. CMIDriverBase derived driver needs to be set prior to "
198          "CMICmnLLDBDDebugger initialisation"},
199         {IDS_LLDBDEBUGGER_ERR_STARTLISTENER,
200          "LLDB Debugger. Starting listening events for '%s' failed"},
201         {IDS_LLDBDEBUGGER_ERR_THREADCREATIONFAIL,
202          "LLDB Debugger. Thread creation failed '%s'"},
203         {IDS_LLDBDEBUGGER_ERR_THREAD_DELETE,
204          "LLDB Debugger. Thread failed to delete '%s'"},
205         {IDS_LLDBDEBUGGER_ERR_INVALIDBROADCASTER,
206          "LLDB Debugger. Invalid SB broadcaster class name '%s' "},
207         {IDS_LLDBDEBUGGER_ERR_INVALIDCLIENTNAME,
208          "LLDB Debugger. Invalid client name '%s' "},
209         {IDS_LLDBDEBUGGER_ERR_CLIENTNOTREGISTERED,
210          "LLDB Debugger. Client name '%s' not registered for listening events"},
211         {IDS_LLDBDEBUGGER_ERR_STOPLISTENER, "LLDB Debugger. Failure occurred "
212                                             "stopping event for client '%s' "
213                                             "SBBroadcaster '%s'"},
214         {IDS_LLDBDEBUGGER_ERR_BROADCASTER_NAME,
215          "LLDB Debugger. Broadcaster's name '%s' is not valid"},
216         {IDS_LLDBDEBUGGER_WRN_UNKNOWN_EVENT,
217          "LLDB Debugger. Unhandled event '%s'"},
218         {IDS_LLDBOUTOFBAND_ERR_UNKNOWN_EVENT,
219          "LLDB Out-of-band. Handling event for '%s', an event enumeration '%d' "
220          "not recognised"},
221         {IDS_LLDBOUTOFBAND_ERR_PROCESS_INVALID,
222          "LLDB Out-of-band. Invalid '%s' in '%s'"},
223         {IDS_LLDBOUTOFBAND_ERR_BRKPT_NOTFOUND, "LLDB Out-of-band. %s. "
224                                                "Breakpoint information for "
225                                                "breakpoint ID %d not found"},
226         {IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_GET,
227          "LLDB Out-of-band. %s. Failed to retrieve breakpoint information for "
228          "for breakpoint ID %d"},
229         {IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_SET, "LLDB Out-of-band. %s. Failed "
230                                                "to set breakpoint information "
231                                                "for for breakpoint ID %d"},
232         {IDS_LLDBOUTOFBAND_ERR_FORM_MI_RESPONSE,
233          "LLDB Out-of-band. %s. Failed to form the MI Out-of-band response"},
234         {IDS_LLDBOUTOFBAND_ERR_FRAME_INFO_GET,
235          "LLDB Out-of-band. %s. Failed to retrieve frame information"},
236         {IDS_LLDBOUTOFBAND_ERR_SETNEWDRIVERSTATE,
237          "LLDB Out-of-band. %s. Event handler tried to set new MI Driver "
238          "running state and failed. %s"},
239         {IDS_LLDBOUTOFBAND_ERR_BRKPT_CNT_EXCEEDED,
240          "LLDB Out-of-band. '%s'. Number of valid breakpoint exceeded %d. "
241          "Cannot create new breakpoint with ID %d"},
242         {IDS_DBGSESSION_ERR_SHARED_DATA_ADD, "LLDB debug session info. Failed "
243                                              "to add '%s' data to the shared "
244                                              "data command container"},
245         {IDS_MI_SHTDWN_ERR_LOG, "Log. Error occurred during shutdown. %s"},
246         {IDS_MI_SHUTDOWN_ERR, "Server shutdown failure. %s"},
247         {IDE_MI_SHTDWN_ERR_RESOURCES,
248          "Resources. Error occurred during shutdown. %s"},
249         {IDE_MI_SHTDWN_ERR_STREAMSTDIN,
250          "Stdin. Error occurred during shutdown. %s"},
251         {IDS_MI_SHTDWN_ERR_OS_STDIN_HANDLER,
252          "Stdin handler. Error occurred during shutdown. %s"},
253         {IDS_MI_SHTDWN_ERR_STREAMSTDOUT,
254          "Stdout. Error occurred during shutdown. %s"},
255         {IDS_MI_SHTDWN_ERR_STREAMSTDERR,
256          "Stderr. Error occurred during shutdown. %s"},
257         {IDS_MI_SHTDWN_ERR_THREADMGR,
258          "Thread Mgr. Error occurred during shutdown. %s"},
259         {IDS_MI_SHTDWN_ERR_CMDINTERPRETER,
260          "Command interpreter. Error occurred during shutdown. %s"},
261         {IDS_MI_SHTDWN_ERR_CMDMGR,
262          "Command manager. Error occurred during shutdown. %s"},
263         {IDS_MI_SHTDWN_ERR_CMDFACTORY,
264          "Command factory. Error occurred during shutdown. %s"},
265         {IDS_MI_SHTDWN_ERR_CMDMONITOR,
266          "Command invoker. Error occurred during shutdown. %s"},
267         {IDS_MI_SHTDWN_ERR_CMDINVOKER,
268          "Command monitor. Error occurred during shutdown. %s"},
269         {IDS_MI_SHTDWN_ERR_LLDBDEBUGGER,
270          "LLDB Debugger. Error occurred during shutdown. %s"},
271         {IDS_MI_SHTDWN_ERR_DRIVERMGR,
272          "Driver manager. Error occurred during shutdown. %s"},
273         {IDS_MI_SHTDWN_ERR_DRIVER,
274          "Driver. Error occurred during shutdown. %s"},
275         {IDS_MI_SHTDWN_ERR_OUTOFBANDHANDLER,
276          "Out-of-band handler. Error occurred during shutdown. %s"},
277         {IDS_MI_SHTDWN_ERR_DEBUGSESSIONINFO,
278          "LLDB debug session info. Error occurred during shutdown. %s"},
279         {IDE_MI_SHTDWN_ERR_THREADMANAGER, "Unable to shutdown thread manager"},
280         {IDS_DRIVER_ERR_PARSE_ARGS,
281          "Driver. Driver '%s'. Parse args error '%s'"},
282         {IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN,
283          "Driver. Driver '%s'. Parse args error unknown"},
284         {IDS_DRIVER_ERR_CURRENT_NOT_SET,
285          "Driver. Current working driver has not been set. Call "
286          "CMIDriverMgr::SetUseThisDriverToDoWork()"},
287         {IDS_DRIVER_ERR_NON_REGISTERED, "Driver. No suitable drivers "
288                                         "registered with the CMIDriverMgr to "
289                                         "do work"},
290         {IDS_DRIVER_SAY_DRIVER_USING, "Driver. Using driver '%s' internally"},
291         {IDS_DRIVER_ERR_ID_INVALID, "Driver. Driver '%s' invalid ID '%s'"},
292         {IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR,
293          "Driver. Fall through driver '%s' (ID:'%s') error '%s'"},
294         {IDS_DRIVER_CMD_RECEIVED,
295          "Driver. Received command '%s'. It was %shandled%s"},
296         {IDS_DRIVER_CMD_NOT_IN_FACTORY,
297          ". Command '%s' not in Command Factory"},
298         {
299             IDS_DRIVER_ERR_DRIVER_STATE_ERROR,
300             "Driver. Driver running state error. Cannot go to next state from "
301             "present state as not allowed",
302         },
303         {IDS_DRIVER_WAITING_STDIN_DATA, "Driver. Main thread suspended waiting "
304                                         "on Stdin Monitor to resume main "
305                                         "thread"},
306         {IDS_DRIVER_ERR_MAINLOOP, "Driver. Error in do main loop. %s"},
307         {IDS_DRIVER_ERR_LOCAL_DEBUG_NOT_IMPL, "Driver. --executable argument "
308                                               "given. Local debugging is not "
309                                               "implemented."},
310         {IDS_DRIVER_ERR_LOCAL_DEBUG_INIT, "Driver. --executable argument "
311                                           "given. Initialising local debugging "
312                                           "failed."},
313         {IDS_STDERR_ERR_NOT_ALL_DATA_WRITTEN,
314          "Stderr. Not all data was written to stream. The data '%s'"},
315         {IDS_CMD_ARGS_ERR_OPTION_NOT_FOUND,
316          "Command Args. Option '%s' not found"},
317         {IDS_CMD_ARGS_ERR_VALIDATION_MANDATORY, "Mandatory args not found: %s"},
318         {IDS_CMD_ARGS_ERR_VALIDATION_INVALID, "Invalid args: %s"},
319         {IDS_CMD_ARGS_ERR_VALIDATION_MAN_INVALID,
320          "Mandatory args not found: %s. Invalid args: %s"},
321         {IDS_CMD_ARGS_ERR_VALIDATION_MISSING_INF,
322          "Args missing additional information: %s"},
323         {IDS_CMD_ARGS_ERR_CONTEXT_NOT_ALL_EATTEN,
324          "Not all arguments or options were recognised: %s"},
325         {IDS_CMD_ARGS_ERR_PREFIX_MSG, "Command Args. Validation failed. "},
326         {IDS_VARIANT_ERR_USED_BASECLASS, "Variant container: Variant object "
327                                          "used the base class. See "
328                                          "CMIUtilVariant"},
329         {IDS_VARIANT_ERR_MAP_KEY_INVALID, "Variant container: Invalid ID '%s'"},
330         {IDS_WORD_INVALIDBRKTS, "<Invalid>"},
331         {IDS_WORD_NONE, "None"},
332         {IDS_WORD_NOT, "not"},
333         {IDS_WORD_INVALIDEMPTY, "<empty>"},
334         {IDS_WORD_INVALIDNULLPTR, "<NULL ptr>"},
335         {IDS_WORD_UNKNOWNBRKTS, "<unknown>"},
336         {IDS_WORD_NOT_IMPLEMENTED, "Not implemented"},
337         {IDS_WORD_NOT_IMPLEMENTED_BRKTS, "<not implemented>"},
338         {IDS_WORD_UNKNOWNTYPE_BRKTS, "<unknowntype>"},
339         {IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS,
340          "<error message not implemented>"},
341         {IDS_CMD_ERR_N_OPTIONS_REQUIRED,
342          "Command '%s'. Missing options, %d required"},
343         {IDS_CMD_ERR_OPTION_NOT_FOUND, "Command '%s'. Option '%s' not found"},
344         {IDS_CMD_ERR_ARGS, "Command '%s'. %s"},
345         {IDS_CMD_WRN_ARGS_NOT_HANDLED, "Command '%s'. Warning the following "
346                                        "options not handled by the command: "
347                                        "%s"},
348         {IDS_CMD_ERR_FNFAILED, "Command '%s'. Fn '%s' failed"},
349         {IDS_CMD_ERR_SHARED_DATA_NOT_FOUND,
350          "Command '%s'. Shared data '%s' not found"},
351         {IDS_CMD_ERR_LLDBPROCESS_DETACH,
352          "Command '%s'. Process detach failed. '%s'"},
353         {IDS_CMD_ERR_LLDBPROCESS_DESTROY,
354          "Command '%s'. Process destroy failed. '%s'"},
355         {IDS_CMD_ERR_SETWKDIR,
356          "Command '%s'. Failed to set working directory '%s'"},
357         {IDS_CMD_ERR_INVALID_TARGET,
358          "Command '%s'. Target binary '%s' is invalid. %s"},
359         {IDS_CMD_ERR_INVALID_TARGET_CURRENT,
360          "Command '%s'. Current SBTarget is invalid"},
361         {IDS_CMD_ERR_INVALID_TARGET_TYPE,
362          "Command '%s'. Target type '%s' is not recognised"},
363         {IDS_CMD_ERR_INVALID_TARGET_PLUGIN,
364          "Command '%s'. Target plugin is invalid. %s"},
365         {IDS_CMD_ERR_CONNECT_TO_TARGET,
366          "Command '%s'. Error connecting to target: '%s'"},
367         {IDS_CMD_ERR_INVALID_TARGETPLUGINCURRENT,
368          "Command '%s'. Current target plugin is invalid"},
369         {IDS_CMD_ERR_NOT_IMPLEMENTED, "Command '%s'. Command not implemented"},
370         {IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED,
371          "Command '%s'. Command not implemented as it has been deprecated"},
372         {IDS_CMD_ERR_CREATE_TARGET, "Command '%s'. Create target failed: %s"},
373         {IDS_CMD_ERR_BRKPT_LOCATION_FORMAT,
374          "Command '%s'. Incorrect format for breakpoint location '%s'"},
375         {IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND,
376          "Command '%s'. Breakpoint location '%s' not found"},
377         {IDS_CMD_ERR_BRKPT_INVALID, "Command '%s'. Breakpoint '%s' invalid"},
378         {IDS_CMD_ERR_BRKPT_CNT_EXCEEDED, "Command '%s'. Number of valid "
379                                          "breakpoint exceeded %d. Cannot "
380                                          "create new breakpoint '%s'"},
381         {IDS_CMD_ERR_SOME_ERROR, "Command '%s'. Error: %s"},
382         {IDS_CMD_ERR_THREAD_INVALID, "Command '%s'. Thread ID invalid"},
383         {IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID,
384          "Command '%s'. Thread frame range invalid"},
385         {IDS_CMD_ERR_FRAME_INVALID, "Command '%s'. Frame ID invalid"},
386         {IDS_CMD_ERR_VARIABLE_DOESNOTEXIST,
387          "Command '%s'. Variable '%s' does not exist"},
388         {IDS_CMD_ERR_VARIABLE_ENUM_INVALID, "Command '%s'. Invalid enumeration "
389                                             "for variable '%s' formatted "
390                                             "string '%s'"},
391         {IDS_CMD_ERR_VARIABLE_EXPRESSIONPATH,
392          "Command '%s'. Failed to get expression for variable '%s'"},
393         {IDS_CMD_ERR_VARIABLE_CREATION_FAILED,
394          "Failed to create variable object for '%s'"},
395         {IDS_CMD_ERR_VARIABLE_CHILD_RANGE_INVALID,
396          "Command '%s'. Variable children range invalid"},
397         {IDS_CMD_ERR_CMD_RUN_BUT_NO_ACTION, "<Error: Command run but command "
398                                             "did not do anything useful. No MI "
399                                             "response formed>"},
400         {IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION,
401          "<Error: Command run and event caught, did nothing useful. No MI "
402          "Out-of-Bound formed>"},
403         {IDS_CMD_ERR_DISASM_ADDR_START_INVALID,
404          "Command '%s'. Invalid start value '%s'"},
405         {IDS_CMD_ERR_DISASM_ADDR_END_INVALID,
406          "Command '%s'. Invalid end value '%s'"},
407         {IDS_CMD_ERR_MEMORY_ALLOC_FAILURE,
408          "Command '%s'. Failed to allocate memory %d bytes"},
409         {IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK,
410          "Command '%s'. LLDB unable to read entire memory block of %u bytes at "
411          "address 0x%016" PRIx64},
412         {IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to read "
413                                               "memory block of %u bytes at "
414                                               "address 0x%016" PRIx64 ": %s "},
415         {IDS_CMD_ERR_INVALID_PROCESS,
416          "Command '%s'. Invalid process during debug session"},
417         {IDS_CMD_ERR_INVALID_PRINT_VALUES,
418          "Command '%s'. Unknown value for PRINT_VALUES: must be: 0 or "
419          "\"--no-values\", 1 or \"--all-values\", 2 or \"--simple-values\""},
420         {IDS_CMD_ERR_INVALID_LOCATION_FORMAT,
421          "Command '%s'. Invalid location format '%s'"},
422         {IDS_CMD_ERR_INVALID_FORMAT_TYPE,
423          "Command '%s'. Invalid var format type '%s'"},
424         {IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND,
425          "Command '%s'. Breakpoint information for breakpoint ID %d not found"},
426         {IDS_CMD_ERR_LLDB_ERR_WRITE_MEM_BYTES, "Command '%s'. Unable to write "
427                                                "memory block of %u bytes at "
428                                                "address 0x%016" PRIx64 ": %s "},
429         {IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK,
430          "Command '%s'. LLDB unable to write entire memory block of %u bytes "
431          "at address 0x%016" PRIX64},
432         {IDS_CMD_ERR_SET_NEW_DRIVER_STATE, "Command '%s'. Command tried to set "
433                                            "new MI Driver running state and "
434                                            "failed. %s"},
435         {IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND,
436          "The request '%s' was not recognised, not implemented"},
437         {IDS_CMD_ERR_INFO_PRINTFN_FAILED, "The request '%s' failed."},
438         {IDS_CMD_ERR_GDBSET_OPT_TARGETASYNC,
439          "'target-async' expects \"on\" or \"off\""},
440         {IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH,
441          "'solib-search-path' requires at least one argument"},
442         {IDS_CMD_ERR_GDBSET_OPT_PRINT_BAD_ARGS,
443          "'print' expects option-name and \"on\" or \"off\""},
444         {IDS_CMD_ERR_GDBSET_OPT_PRINT_UNKNOWN_OPTION,
445          "'print' error. The option '%s' not found"},
446         {IDS_CMD_ERR_GDBSHOW_OPT_PRINT_BAD_ARGS,
447          "'print' expects option-name and \"on\" or \"off\""},
448         {IDS_CMD_ERR_GDBSHOW_OPT_PRINT_UNKNOWN_OPTION,
449          "'print' error. The option '%s' not found"},
450         {IDS_CMD_ERR_EXPR_INVALID, "Failed to evaluate expression: %s"},
451         {IDS_CMD_ERR_ATTACH_FAILED,
452          "Command '%s'. Attach to processs failed: %s"},
453         {IDS_CMD_ERR_ATTACH_BAD_ARGS,
454          "Command '%s'. Must specify either a PID or a Name"}};
455
456 //++
457 //------------------------------------------------------------------------------------
458 // Details: CMICmnResources constructor.
459 // Type:    Method.
460 // Args:    None.
461 // Return:  None.
462 // Throws:  None.
463 //--
464 CMICmnResources::CMICmnResources() : m_nResourceId2TextDataSize(0) {
465   // Do not use this constructor, use Initialize()
466 }
467
468 //++
469 //------------------------------------------------------------------------------------
470 // Details: CMICmnResources destructor.
471 // Type:    Overridden.
472 // Args:    None.
473 // Return:  None.
474 // Throws:  None.
475 //--
476 CMICmnResources::~CMICmnResources() {
477   // Do not use this destructor, use Shutdown()
478 }
479
480 //++
481 //------------------------------------------------------------------------------------
482 // Details: Initialize the resources and set locality for the server.
483 // Type:    Method.
484 // Args:    None.
485 // Return:  MIstatus::success - Functional succeeded.
486 //          MIstatus::failure - Functional failed.
487 // Throws:  None.
488 //--
489 bool CMICmnResources::Initialize() {
490   m_clientUsageRefCnt++;
491
492   if (m_bInitialized)
493     return MIstatus::success;
494
495   m_bInitialized = ReadResourceStringData();
496
497   return m_bInitialized;
498 }
499
500 //++
501 //------------------------------------------------------------------------------------
502 // Details: Release resources for *this object.
503 // Type:    Method.
504 // Args:    None.
505 // Return:  MIstatus::success - Functional succeeded.
506 //          MIstatus::failure - Functional failed.
507 // Throws:  None.
508 //--
509 bool CMICmnResources::Shutdown() {
510   if (--m_clientUsageRefCnt > 0)
511     return MIstatus::success;
512
513   if (!m_bInitialized)
514     return MIstatus::success;
515
516   // Tear down resource explicitly
517   m_mapRscrIdToTextData.clear();
518
519   m_bInitialized = false;
520
521   return MIstatus::success;
522 }
523
524 //++
525 //------------------------------------------------------------------------------------
526 // Details: Initialize the resources and set locality for the server.
527 // Type:    Method.
528 // Args:    None.
529 // Return:  MIstatus::success - Functional succeeded.
530 //          MIstatus::failure - Functional failed.
531 // Throws:  None.
532 //--
533 bool CMICmnResources::ReadResourceStringData() {
534   m_nResourceId2TextDataSize =
535       sizeof ms_pResourceId2TextData / sizeof ms_pResourceId2TextData[0];
536   for (MIuint i = 0; i < m_nResourceId2TextDataSize; i++) {
537     const SRsrcTextData *pRscrData = &ms_pResourceId2TextData[i];
538     MapPairRscrIdToTextData_t pr(pRscrData->id, pRscrData->pTextData);
539     m_mapRscrIdToTextData.insert(pr);
540   }
541
542   return MIstatus::success;
543 }
544
545 //++
546 //------------------------------------------------------------------------------------
547 // Details: Retrieve the corresponding text assigned to the resource ID.
548 // Type:    Method.
549 // Args:    vResourceId - (R) MI resource ID.
550 // Return:  CMIUtilString - Resource text.
551 // Throws:  None.
552 //--
553 CMIUtilString CMICmnResources::GetString(const MIuint vResourceId) const {
554   CMIUtilString str;
555   const bool bFound = GetStringFromResource(vResourceId, str);
556   MIunused(bFound);
557   assert(bFound);
558
559   return str;
560 }
561
562 //++
563 //------------------------------------------------------------------------------------
564 // Details: Determine the MI resource ID existings.
565 // Type:    Method.
566 // Args:    vResourceId - (R) MI resource ID.
567 // Return:  True - Exists.
568 //          False - Not found.
569 // Throws:  None.
570 //--
571 bool CMICmnResources::HasString(const MIuint vResourceId) const {
572   CMIUtilString str;
573   return GetStringFromResource(vResourceId, str);
574 }
575
576 //++
577 //------------------------------------------------------------------------------------
578 // Details: Retrieve the resource text data for the given resource ID. If a
579 // resource ID
580 //          cannot be found and error is given returning the ID of the resource
581 //          that
582 //          cannot be located.
583 // Type:    Method.
584 // Args:    vResourceId         - (R) MI resource ID.
585 //          vrwResourceString   - (W) Text.
586 // Return:  MIstatus::success - Functional succeeded.
587 //          MIstatus::failure - Functional failed.
588 // Throws:  None.
589 //--
590 bool CMICmnResources::GetStringFromResource(
591     const MIuint vResourceId, CMIUtilString &vrwResourceString) const {
592   MapRscrIdToTextData_t::const_iterator it =
593       m_mapRscrIdToTextData.find(vResourceId);
594   if (it == m_mapRscrIdToTextData.end()) {
595     // Check this is a static variable init that needs this before we are ready
596     if (!m_bInitialized) {
597       (const_cast<CMICmnResources *>(this))->Initialize();
598       it = m_mapRscrIdToTextData.find(vResourceId);
599       if (it == m_mapRscrIdToTextData.end()) {
600         vrwResourceString = MIRSRC(IDS_RESOURCES_ERR_STRING_TABLE_INVALID);
601         return MIstatus::failure;
602       }
603     }
604
605     if (it == m_mapRscrIdToTextData.end()) {
606       vrwResourceString = CMIUtilString::Format(
607           MIRSRC(IDS_RESOURCES_ERR_STRING_NOT_FOUND), vResourceId);
608       return MIstatus::failure;
609     }
610   }
611
612   const MIuint nRsrcId((*it).first);
613   MIunused(nRsrcId);
614   const char *pRsrcData((*it).second);
615
616   // Return result
617   vrwResourceString = pRsrcData;
618
619   return MIstatus::success;
620 }