summaryrefslogtreecommitdiff
path: root/lldb/tools/lldb-mi/MICmnResources.cpp
blob: e32a816fc9f157f141d01ece90a37040a07e2000 (plain)
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
//===-- MICmnResources.cpp --------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// Third party headers
#include "assert.h"
#include <inttypes.h> // For PRIx64

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

// Instantiations:
const CMICmnResources::SRsrcTextData
    CMICmnResources::ms_pResourceId2TextData[] = {
        {IDS_PROJNAME,
         "LLDB Machine Interface Driver (MI) All rights reserved"},
        {IDS_MI_VERSION_DESCRIPTION_DEBUG,
         "Version: 1.0.0.9 (Debug)"}, // See version history in MIDriverMain.cpp
        {IDS_MI_VERSION_DESCRIPTION, "Version: 1.0.0.9"},
        {IDS_MI_APPNAME_SHORT, "MI"},
        {IDS_MI_APPNAME_LONG, "Machine Interface Driver"},
        {IDS_MI_APP_FILEPATHNAME, "Application: %s"},
        {IDS_MI_APP_ARGS, "Command line args: "},
        {IDE_MI_VERSION_GDB, "Version: GNU gdb (GDB) 7.4 \n(This is a MI stub "
                             "on top of LLDB and not GDB)\nAll rights "
                             "reserved.\n"}, // *** Eclipse needs this
                                             // exactly!!
        {IDS_UTIL_FILE_ERR_INVALID_PATHNAME,
         "File Handler. Invalid file name path"},
        {IDS_UTIL_FILE_ERR_OPENING_FILE, "File Handler. Error %s opening '%s'"},
        {IDS_UTIL_FILE_ERR_OPENING_FILE_UNKNOWN,
         "File Handler. Unknown error opening '%s'"},
        {IDE_UTIL_FILE_ERR_WRITING_FILE, "File Handler. Error %s writing '%s'"},
        {IDE_UTIL_FILE_ERR_WRITING_NOTOPEN,
         "File Handler. File '%s' not open for write"},
        {IDS_RESOURCES_ERR_STRING_NOT_FOUND,
         "Resources. String (%d) not found in resources"},
        {IDS_RESOURCES_ERR_STRING_TABLE_INVALID,
         "Resources. String resource table is not set up"},
        {IDS_MI_CLIENT_MSG, "Client message: \"%s\""},
        {IDS_LOG_MSG_CREATION_DATE, "Creation date %s time %s%s"},
        {IDS_LOG_MSG_FILE_LOGGER_PATH, "File logger path: %s%s"},
        {IDS_LOG_MSG_VERSION, "Version: %s%s"},
        {IDS_LOG_ERR_FILE_LOGGER_DISABLED,
         "Log. File logger temporarily disabled due to file error '%s'"},
        {IDS_LOG_MEDIUM_ERR_INIT, "Log. Medium '%s' initialise failed. %s"},
        {IDS_LOG_MEDIUM_ERR_WRITE_ANY,
         "Log. Failed to write log data to any medium."},
        {IDS_LOG_MEDIUM_ERR_WRITE_MEDIUMFAIL,
         "Log. One or mediums failed writing log data."},
        {IDS_MEDIUMFILE_NAME, "File"},
        {IDS_MEDIUMFILE_ERR_INVALID_PATH, "<Invalid - not set>"},
        {IDS_MEDIUMFILE_ERR_FILE_HEADER, "<Invalid - header not set>"},
        {IDS_MEDIUMFILE_NAME_LOG, "File medium. %s"},
        {IDE_OS_ERR_UNKNOWN, "Unknown OS error"},
        {IDE_OS_ERR_RETRIEVING, "Unabled to retrieve OS error message"},
        {IDS_DRIVERMGR_DRIVER_ERR_INIT,
         "Driver Manager. Driver '%s' (ID:'%s') initialise failed. %s"},
        {IDE_MEDIUMSTDERR_NAME, "Stderr"},
        {IDE_MEDIUMSTDOUT_NAME, "Stdout"},
        {IDE_MI_APP_DESCRIPTION,
         "Description:\nThe Machine Interface Driver (MI Driver) is a stand "
         "alone executable\nthat either be used via "
         "a client i.e. Eclipse or directly from the command\nline. It "
         "processes MI commands, actions those commands "
         "using the internal\ndebugger then forms MI response formatted text "
         "which is returned to the\nclient."},
        {IDE_MI_APP_INFORMATION,
         "Information:\nCurrent limitations. The MI Driver currently only "
         "handles remote target\ndebugging. Local "
         "debugging has not been implemented. The MI Driver has\nbeen designed "
         "primarily to be used with Eclipse Juno "
         "and a custom plugin.\nThe custom plugin is not necessary to operate "
         "the MI Driver."},
        {IDE_MI_APP_ARG_USAGE, "\nMI driver usage:\n\n\tlldb-mi [--longOption] "
                               "[-s hortOption] [executeable]\n\n[] = optional "
                               "argument."},
        {IDE_MI_APP_ARG_HELP, "-h\n--help\n\tPrints out usage information for "
                              "the MI debugger. Exit the MI\n\tDriver "
                              "immediately."},
        {IDE_MI_APP_ARG_VERSION, "--version\n\tPrints out GNU (gdb) version "
                                 "information. Exit the MI "
                                 "Driver\n\timmediately."},
        {IDE_MI_APP_ARG_VERSION_LONG, "--versionLong\n\tPrints out MI Driver "
                                      "version information. Exit the MI "
                                      "Driver\n\timmediately."},
        {IDE_MI_APP_ARG_INTERPRETER, "--interpreter\n\t This option is kept "
                                     "for backward compatibility. This "
                                     "executable always run in MI mode"},
        {IDE_MI_APP_ARG_EXECUTEABLE, "--executable\n\tUse the MI Driver in MI "
                                     "mode for the debugging the specified "
                                     "executable."},
        {IDE_MI_APP_ARG_SOURCE, "-s <filename>\n--source <filename>\n\t"
                                "Tells the debugger to read in and execute the "
                                "lldb commands in the\n\t"
                                "given file, after any file provided on the "
                                "command line has been\n\tloaded."},
        {IDE_MI_APP_ARG_APP_LOG, "--log\n\tUse this argument to tell the MI "
                                 "Driver to update it's log\n\tfile '%s'."},
        {IDE_MI_APP_ARG_APP_LOG_DIR,
         "--log-dir\n\tUse this argument to specify the directory the MI "
         "Driver\n\twill place the log file in, i.e --log-dir=/tmp."},
        {IDE_MI_APP_ARG_EXAMPLE, "Example MI command:\n\t3-info-gdb-mi-command "
                                 "gdb-set\n\t3^done,command={exists=\"true\"}"},
        {IDE_MI_APP_ARG_EXECUTABLE, "executable (NOT IMPLEMENTED)\n\tThe file "
                                    "path to the executable i.e. '\"C:\\My "
                                    "Dev\\foo.exe\"'."},
        {IDE_MI_APP_ARG_SYNCHRONOUS, "--synchronous\n\tBlock until each command "
                                     "has finished executing.\n\tUsed for testing only."},
        {IDS_STDIN_ERR_INVALID_PROMPT,
         "Stdin. Invalid prompt description '%s'"},
        {IDS_STDIN_ERR_THREAD_CREATION_FAILED,
         "Stdin. Thread creation failed '%s'"},
        {IDS_STDIN_ERR_THREAD_DELETE, "Stdin. Thread failed to delete '%s'"},
        {IDS_STDIN_ERR_CHKING_BYTE_AVAILABLE,
         "Stdin. Peeking on stdin stream '%s'"},
        {IDS_STDIN_INPUT_CTRL_CHARS,
         "Stdin. Receive characters not handled as a command: "},
        {IDS_CMD_QUIT_HELP,
         "MI Driver Command: quit\n\tExit the MI Driver application."},
        {IDS_THREADMGR_ERR_THREAD_ID_INVALID,
         "Thread Mgr. Thread ID '%s' is not valid"},
        {IDS_THREADMGR_ERR_THREAD_FAIL_CREATE,
         "Thread Mgr: Failed to create thread '%s'"},
        {IDS_THREADMGR_ERR_THREAD_ID_NOT_FOUND,
         "Thread Mgr: Thread with ID '%s' not found"},
        {IDS_THREADMGR_ERR_THREAD_STILL_ALIVE, "Thread Mgr: The thread(s) are "
                                               "still alive at Thread Mgr "
                                               "shutdown: %s"},
        {IDS_FALLTHRU_DRIVER_CMD_RECEIVED,
         "Fall Thru Driver. Received command '%s'. Is was %shandled"},
        {IDS_CMDFACTORY_ERR_INVALID_CMD_NAME,
         "Command factory. MI command name '%s' is invalid"},
        {IDS_CMDFACTORY_ERR_INVALID_CMD_CR8FN,
         "Command factory. Command creation function invalid for command '%s'. "
         "Does function exist? Pointer assigned to it?"},
        {IDS_CMDFACTORY_ERR_CMD_NOT_REGISTERED,
         "Command factory. Command '%s' not registered"},
        {IDS_CMDFACTORY_ERR_CMD_ALREADY_REGED,
         "Command factory. Command '%s' by that name already registered"},
        {IDS_CMDMGR_ERR_CMD_FAILED_CREATE,
         "Command manager. Command creation failed. %s"},
        {IDS_CMDMGR_ERR_CMD_INVOKER, "Command manager. %s "},
        {IDS_MI_INIT_ERR_LOG, "Log. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_RESOURCES,
         "Resources. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_INIT,
         "Driver. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_STREAMSTDIN,
         "Stdin. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_STREAMSTDIN_OSHANDLER, "Stdin. The OS specific stdin "
                                                "stream handler has not been "
                                                "specified for this OS"},
        {IDS_MI_INIT_ERR_OS_STDIN_HANDLER,
         "Stdin handler. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_STREAMSTDOUT,
         "Stdout. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_STREAMSTDERR,
         "Stderr. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_FALLTHRUDRIVER,
         "Fall Through Driver. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_THREADMGR,
         "Thread Mgr. Error occurred during initialisation %s"},
        {IDS_MI_INIT_ERR_CMDINTERPRETER, "Command interpreter. %s"},
        {IDS_MI_INIT_ERR_CMDMGR, "Command manager. %s"},
        {IDS_MI_INIT_ERR_CMDFACTORY, "Command factory. %s"},
        {IDS_MI_INIT_ERR_CMDINVOKER, "Command invoker. %s"},
        {IDS_MI_INIT_ERR_CMDMONITOR, "Command monitor. %s"},
        {IDS_MI_INIT_ERR_LLDBDEBUGGER, "LLDB Debugger. %s"},
        {IDS_MI_INIT_ERR_DRIVERMGR, "Driver manager. %s"},
        {IDS_MI_INIT_ERR_DRIVER, "Driver. %s"},
        {IDS_MI_INIT_ERR_OUTOFBANDHANDLER, "Out-of-band handler. %s "},
        {IDS_MI_INIT_ERR_DEBUGSESSIONINFO, "LLDB debug session info. %s "},
        {IDS_MI_INIT_ERR_THREADMANAGER, "Unable to init thread manager."},
        {IDS_MI_INIT_ERR_CLIENT_USING_DRIVER,
         "Initialising the client to this driver failed."},
        {IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION,
         "Initialising a local debug session failed."},
        {IDS_CODE_ERR_INVALID_PARAMETER_VALUE,
         "Code. Invalid parameter passed to function '%s'"},
        {IDS_CODE_ERR_INVALID_PARAM_NULL_POINTER,
         "Code. NULL pointer passes as a parameter to function '%s'"},
        {IDS_CODE_ERR_INVALID_ENUMERATION_VALUE,
         "Code. Invalid enumeration value encountered in function '%s'"},
        {
            IDS_LLDBDEBUGGER_ERR_INVALIDLISTENER,
            "LLDB Debugger. LLDB Listener is not valid",
        },
        {
            IDS_LLDBDEBUGGER_ERR_INVALIDDEBUGGER,
            "LLDB Debugger. LLDB Debugger is not valid",
        },
        {IDS_LLDBDEBUGGER_ERR_CLIENTDRIVER,
         "LLDB Debugger. CMIDriverBase derived driver needs to be set prior to "
         "CMICmnLLDBDDebugger initialisation"},
        {IDS_LLDBDEBUGGER_ERR_STARTLISTENER,
         "LLDB Debugger. Starting listening events for '%s' failed"},
        {IDS_LLDBDEBUGGER_ERR_THREADCREATIONFAIL,
         "LLDB Debugger. Thread creation failed '%s'"},
        {IDS_LLDBDEBUGGER_ERR_THREAD_DELETE,
         "LLDB Debugger. Thread failed to delete '%s'"},
        {IDS_LLDBDEBUGGER_ERR_INVALIDBROADCASTER,
         "LLDB Debugger. Invalid SB broadcaster class name '%s' "},
        {IDS_LLDBDEBUGGER_ERR_INVALIDCLIENTNAME,
         "LLDB Debugger. Invalid client name '%s' "},
        {IDS_LLDBDEBUGGER_ERR_CLIENTNOTREGISTERED,
         "LLDB Debugger. Client name '%s' not registered for listening events"},
        {IDS_LLDBDEBUGGER_ERR_STOPLISTENER, "LLDB Debugger. Failure occurred "
                                            "stopping event for client '%s' "
                                            "SBBroadcaster '%s'"},
        {IDS_LLDBDEBUGGER_ERR_BROADCASTER_NAME,
         "LLDB Debugger. Broadcaster's name '%s' is not valid"},
        {IDS_LLDBDEBUGGER_WRN_UNKNOWN_EVENT,
         "LLDB Debugger. Unhandled event '%s'"},
        {IDS_LLDBOUTOFBAND_ERR_UNKNOWN_EVENT,
         "LLDB Out-of-band. Handling event for '%s', an event enumeration '%d' "
         "not recognised"},
        {IDS_LLDBOUTOFBAND_ERR_PROCESS_INVALID,
         "LLDB Out-of-band. Invalid '%s' in '%s'"},
        {IDS_LLDBOUTOFBAND_ERR_BRKPT_NOTFOUND, "LLDB Out-of-band. %s. "
                                               "Breakpoint information for "
                                               "breakpoint ID %d not found"},
        {IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_GET,
         "LLDB Out-of-band. %s. Failed to retrieve breakpoint information for "
         "for breakpoint ID %d"},
        {IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_SET, "LLDB Out-of-band. %s. Failed "
                                               "to set breakpoint information "
                                               "for for breakpoint ID %d"},
        {IDS_LLDBOUTOFBAND_ERR_FORM_MI_RESPONSE,
         "LLDB Out-of-band. %s. Failed to form the MI Out-of-band response"},
        {IDS_LLDBOUTOFBAND_ERR_FRAME_INFO_GET,
         "LLDB Out-of-band. %s. Failed to retrieve frame information"},
        {IDS_LLDBOUTOFBAND_ERR_SETNEWDRIVERSTATE,
         "LLDB Out-of-band. %s. Event handler tried to set new MI Driver "
         "running state and failed. %s"},
        {IDS_LLDBOUTOFBAND_ERR_BRKPT_CNT_EXCEEDED,
         "LLDB Out-of-band. '%s'. Number of valid breakpoint exceeded %d. "
         "Cannot create new breakpoint with ID %d"},
        {IDS_DBGSESSION_ERR_SHARED_DATA_ADD, "LLDB debug session info. Failed "
                                             "to add '%s' data to the shared "
                                             "data command container"},
        {IDS_MI_SHTDWN_ERR_LOG, "Log. Error occurred during shutdown. %s"},
        {IDS_MI_SHUTDOWN_ERR, "Server shutdown failure. %s"},
        {IDE_MI_SHTDWN_ERR_RESOURCES,
         "Resources. Error occurred during shutdown. %s"},
        {IDE_MI_SHTDWN_ERR_STREAMSTDIN,
         "Stdin. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_OS_STDIN_HANDLER,
         "Stdin handler. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_STREAMSTDOUT,
         "Stdout. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_STREAMSTDERR,
         "Stderr. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_THREADMGR,
         "Thread Mgr. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_CMDINTERPRETER,
         "Command interpreter. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_CMDMGR,
         "Command manager. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_CMDFACTORY,
         "Command factory. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_CMDMONITOR,
         "Command invoker. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_CMDINVOKER,
         "Command monitor. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_LLDBDEBUGGER,
         "LLDB Debugger. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_DRIVERMGR,
         "Driver manager. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_DRIVER,
         "Driver. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_OUTOFBANDHANDLER,
         "Out-of-band handler. Error occurred during shutdown. %s"},
        {IDS_MI_SHTDWN_ERR_DEBUGSESSIONINFO,
         "LLDB debug session info. Error occurred during shutdown. %s"},
        {IDE_MI_SHTDWN_ERR_THREADMANAGER, "Unable to shutdown thread manager"},
        {IDS_DRIVER_ERR_PARSE_ARGS,
         "Driver. Driver '%s'. Parse args error '%s'"},
        {IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN,
         "Driver. Driver '%s'. Parse args error unknown"},
        {IDS_DRIVER_ERR_CURRENT_NOT_SET,
         "Driver. Current working driver has not been set. Call "
         "CMIDriverMgr::SetUseThisDriverToDoWork()"},
        {IDS_DRIVER_ERR_NON_REGISTERED, "Driver. No suitable drivers "
                                        "registered with the CMIDriverMgr to "
                                        "do work"},
        {IDS_DRIVER_SAY_DRIVER_USING, "Driver. Using driver '%s' internally"},
        {IDS_DRIVER_ERR_ID_INVALID, "Driver. Driver '%s' invalid ID '%s'"},
        {IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR,
         "Driver. Fall through driver '%s' (ID:'%s') error '%s'"},
        {IDS_DRIVER_CMD_RECEIVED,
         "Driver. Received command '%s'. It was %shandled%s"},
        {IDS_DRIVER_CMD_NOT_IN_FACTORY,
         ". Command '%s' not in Command Factory"},
        {
            IDS_DRIVER_ERR_DRIVER_STATE_ERROR,
            "Driver. Driver running state error. Cannot go to next state from "
            "present state as not allowed",
        },
        {IDS_DRIVER_WAITING_STDIN_DATA, "Driver. Main thread suspended waiting "
                                        "on Stdin Monitor to resume main "
                                        "thread"},
        {IDS_DRIVER_ERR_MAINLOOP, "Driver. Error in do main loop. %s"},
        {IDS_DRIVER_ERR_LOCAL_DEBUG_NOT_IMPL, "Driver. --executable argument "
                                              "given. Local debugging is not "
                                              "implemented."},
        {IDS_DRIVER_ERR_LOCAL_DEBUG_INIT, "Driver. --executable argument "
                                          "given. Initialising local debugging "
                                          "failed."},
        {IDS_STDERR_ERR_NOT_ALL_DATA_WRITTEN,
         "Stderr. Not all data was written to stream. The data '%s'"},
        {IDS_CMD_ARGS_ERR_OPTION_NOT_FOUND,
         "Command Args. Option '%s' not found"},
        {IDS_CMD_ARGS_ERR_VALIDATION_MANDATORY, "Mandatory args not found: %s"},
        {IDS_CMD_ARGS_ERR_VALIDATION_INVALID, "Invalid args: %s"},
        {IDS_CMD_ARGS_ERR_VALIDATION_MAN_INVALID,
         "Mandatory args not found: %s. Invalid args: %s"},
        {IDS_CMD_ARGS_ERR_VALIDATION_MISSING_INF,
         "Args missing additional information: %s"},
        {IDS_CMD_ARGS_ERR_CONTEXT_NOT_ALL_EATTEN,
         "Not all arguments or options were recognised: %s"},
        {IDS_CMD_ARGS_ERR_PREFIX_MSG, "Command Args. Validation failed. "},
        {IDS_VARIANT_ERR_USED_BASECLASS, "Variant container: Variant object "
                                         "used the base class. See "
                                         "CMIUtilVariant"},
        {IDS_VARIANT_ERR_MAP_KEY_INVALID, "Variant container: Invalid ID '%s'"},
        {IDS_WORD_INVALIDBRKTS, "<Invalid>"},
        {IDS_WORD_NONE, "None"},
        {IDS_WORD_NOT, "not"},
        {IDS_WORD_INVALIDEMPTY, "<empty>"},
        {IDS_WORD_INVALIDNULLPTR, "<NULL ptr>"},
        {IDS_WORD_UNKNOWNBRKTS, "<unknown>"},
        {IDS_WORD_NOT_IMPLEMENTED, "Not implemented"},
        {IDS_WORD_NOT_IMPLEMENTED_BRKTS, "<not implemented>"},
        {IDS_WORD_UNKNOWNTYPE_BRKTS, "<unknowntype>"},
        {IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS,
         "<error message not implemented>"},
        {IDS_CMD_ERR_N_OPTIONS_REQUIRED,
         "Command '%s'. Missing options, %d required"},
        {IDS_CMD_ERR_OPTION_NOT_FOUND, "Command '%s'. Option '%s' not found"},
        {IDS_CMD_ERR_ARGS, "Command '%s'. %s"},
        {IDS_CMD_WRN_ARGS_NOT_HANDLED, "Command '%s'. Warning the following "
                                       "options not handled by the command: "
                                       "%s"},
        {IDS_CMD_ERR_FNFAILED, "Command '%s'. Fn '%s' failed"},
        {IDS_CMD_ERR_SHARED_DATA_NOT_FOUND,
         "Command '%s'. Shared data '%s' not found"},
        {IDS_CMD_ERR_LLDBPROCESS_DETACH,
         "Command '%s'. Process detach failed. '%s'"},
        {IDS_CMD_ERR_LLDBPROCESS_DESTROY,
         "Command '%s'. Process destroy failed. '%s'"},
        {IDS_CMD_ERR_SETWKDIR,
         "Command '%s'. Failed to set working directory '%s'"},
        {IDS_CMD_ERR_INVALID_TARGET,
         "Command '%s'. Target binary '%s' is invalid. %s"},
        {IDS_CMD_ERR_INVALID_TARGET_CURRENT,
         "Command '%s'. Current SBTarget is invalid"},
        {IDS_CMD_ERR_INVALID_TARGET_TYPE,
         "Command '%s'. Target type '%s' is not recognised"},
        {IDS_CMD_ERR_INVALID_TARGET_PLUGIN,
         "Command '%s'. Target plugin is invalid. %s"},
        {IDS_CMD_ERR_CONNECT_TO_TARGET,
         "Command '%s'. Error connecting to target: '%s'"},
        {IDS_CMD_ERR_INVALID_TARGETPLUGINCURRENT,
         "Command '%s'. Current target plugin is invalid"},
        {IDS_CMD_ERR_NOT_IMPLEMENTED, "Command '%s'. Command not implemented"},
        {IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED,
         "Command '%s'. Command not implemented as it has been deprecated"},
        {IDS_CMD_ERR_CREATE_TARGET, "Command '%s'. Create target failed: %s"},
        {IDS_CMD_ERR_BRKPT_LOCATION_FORMAT,
         "Command '%s'. Incorrect format for breakpoint location '%s'"},
        {IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND,
         "Command '%s'. Breakpoint location '%s' not found"},
        {IDS_CMD_ERR_BRKPT_INVALID, "Command '%s'. Breakpoint '%s' invalid"},
        {IDS_CMD_ERR_BRKPT_CNT_EXCEEDED, "Command '%s'. Number of valid "
                                         "breakpoint exceeded %d. Cannot "
                                         "create new breakpoint '%s'"},
        {IDS_CMD_ERR_SOME_ERROR, "Command '%s'. Error: %s"},
        {IDS_CMD_ERR_THREAD_INVALID, "Command '%s'. Thread ID invalid"},
        {IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID,
         "Command '%s'. Thread frame range invalid"},
        {IDS_CMD_ERR_FRAME_INVALID, "Command '%s'. Frame ID invalid"},
        {IDS_CMD_ERR_VARIABLE_DOESNOTEXIST,
         "Command '%s'. Variable '%s' does not exist"},
        {IDS_CMD_ERR_VARIABLE_ENUM_INVALID, "Command '%s'. Invalid enumeration "
                                            "for variable '%s' formatted "
                                            "string '%s'"},
        {IDS_CMD_ERR_VARIABLE_EXPRESSIONPATH,
         "Command '%s'. Failed to get expression for variable '%s'"},
        {IDS_CMD_ERR_VARIABLE_CREATION_FAILED,
         "Failed to create variable object for '%s'"},
        {IDS_CMD_ERR_VARIABLE_CHILD_RANGE_INVALID,
         "Command '%s'. Variable children range invalid"},
        {IDS_CMD_ERR_CMD_RUN_BUT_NO_ACTION, "<Error: Command run but command "
                                            "did not do anything useful. No MI "
                                            "response formed>"},
        {IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION,
         "<Error: Command run and event caught, did nothing useful. No MI "
         "Out-of-Bound formed>"},
        {IDS_CMD_ERR_DISASM_ADDR_START_INVALID,
         "Command '%s'. Invalid start value '%s'"},
        {IDS_CMD_ERR_DISASM_ADDR_END_INVALID,
         "Command '%s'. Invalid end value '%s'"},
        {IDS_CMD_ERR_MEMORY_ALLOC_FAILURE,
         "Command '%s'. Failed to allocate memory %d bytes"},
        {IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK,
         "Command '%s'. LLDB unable to read entire memory block of %u bytes at "
         "address 0x%016" PRIx64},
        {IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to read "
                                              "memory block of %u bytes at "
                                              "address 0x%016" PRIx64 ": %s "},
        {IDS_CMD_ERR_INVALID_PROCESS,
         "Command '%s'. Invalid process during debug session"},
        {IDS_CMD_ERR_INVALID_PRINT_VALUES,
         "Command '%s'. Unknown value for PRINT_VALUES: must be: 0 or "
         "\"--no-values\", 1 or \"--all-values\", 2 or \"--simple-values\""},
        {IDS_CMD_ERR_INVALID_LOCATION_FORMAT,
         "Command '%s'. Invalid location format '%s'"},
        {IDS_CMD_ERR_INVALID_FORMAT_TYPE,
         "Command '%s'. Invalid var format type '%s'"},
        {IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND,
         "Command '%s'. Breakpoint information for breakpoint ID %d not found"},
        {IDS_CMD_ERR_LLDB_ERR_WRITE_MEM_BYTES, "Command '%s'. Unable to write "
                                               "memory block of %u bytes at "
                                               "address 0x%016" PRIx64 ": %s "},
        {IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK,
         "Command '%s'. LLDB unable to write entire memory block of %u bytes "
         "at address 0x%016" PRIX64},
        {IDS_CMD_ERR_SET_NEW_DRIVER_STATE, "Command '%s'. Command tried to set "
                                           "new MI Driver running state and "
                                           "failed. %s"},
        {IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND,
         "The request '%s' was not recognised, not implemented"},
        {IDS_CMD_ERR_INFO_PRINTFN_FAILED, "The request '%s' failed."},
        {IDS_CMD_ERR_GDBSET_OPT_TARGETASYNC,
         "'target-async' expects \"on\" or \"off\""},
        {IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH,
         "'solib-search-path' requires at least one argument"},
        {IDS_CMD_ERR_GDBSET_OPT_PRINT_BAD_ARGS,
         "'print' expects option-name and \"on\" or \"off\""},
        {IDS_CMD_ERR_GDBSET_OPT_PRINT_UNKNOWN_OPTION,
         "'print' error. The option '%s' not found"},
        {IDS_CMD_ERR_GDBSHOW_OPT_PRINT_BAD_ARGS,
         "'print' expects option-name and \"on\" or \"off\""},
        {IDS_CMD_ERR_GDBSHOW_OPT_PRINT_UNKNOWN_OPTION,
         "'print' error. The option '%s' not found"},
        {IDS_CMD_ERR_EXPR_INVALID, "Failed to evaluate expression: %s"},
        {IDS_CMD_ERR_ATTACH_FAILED,
         "Command '%s'. Attach to process failed: %s"},
        {IDS_CMD_ERR_ATTACH_BAD_ARGS,
         "Command '%s'. Must specify either a PID or a Name"}};

//++
//------------------------------------------------------------------------------------
// Details: CMICmnResources constructor.
// Type:    Method.
// Args:    None.
// Return:  None.
// Throws:  None.
//--
CMICmnResources::CMICmnResources() : m_nResourceId2TextDataSize(0) {
  // Do not use this constructor, use Initialize()
}

//++
//------------------------------------------------------------------------------------
// Details: CMICmnResources destructor.
// Type:    Overridden.
// Args:    None.
// Return:  None.
// Throws:  None.
//--
CMICmnResources::~CMICmnResources() {
  // Do not use this destructor, use Shutdown()
}

//++
//------------------------------------------------------------------------------------
// Details: Initialize the resources and set locality for the server.
// Type:    Method.
// Args:    None.
// Return:  MIstatus::success - Functional succeeded.
//          MIstatus::failure - Functional failed.
// Throws:  None.
//--
bool CMICmnResources::Initialize() {
  m_clientUsageRefCnt++;

  if (m_bInitialized)
    return MIstatus::success;

  m_bInitialized = ReadResourceStringData();

  return m_bInitialized;
}

//++
//------------------------------------------------------------------------------------
// Details: Release resources for *this object.
// Type:    Method.
// Args:    None.
// Return:  MIstatus::success - Functional succeeded.
//          MIstatus::failure - Functional failed.
// Throws:  None.
//--
bool CMICmnResources::Shutdown() {
  if (--m_clientUsageRefCnt > 0)
    return MIstatus::success;

  if (!m_bInitialized)
    return MIstatus::success;

  // Tear down resource explicitly
  m_mapRscrIdToTextData.clear();

  m_bInitialized = false;

  return MIstatus::success;
}

//++
//------------------------------------------------------------------------------------
// Details: Initialize the resources and set locality for the server.
// Type:    Method.
// Args:    None.
// Return:  MIstatus::success - Functional succeeded.
//          MIstatus::failure - Functional failed.
// Throws:  None.
//--
bool CMICmnResources::ReadResourceStringData() {
  m_nResourceId2TextDataSize =
      sizeof ms_pResourceId2TextData / sizeof ms_pResourceId2TextData[0];
  for (MIuint i = 0; i < m_nResourceId2TextDataSize; i++) {
    const SRsrcTextData *pRscrData = &ms_pResourceId2TextData[i];
    MapPairRscrIdToTextData_t pr(pRscrData->id, pRscrData->pTextData);
    m_mapRscrIdToTextData.insert(pr);
  }

  return MIstatus::success;
}

//++
//------------------------------------------------------------------------------------
// Details: Retrieve the corresponding text assigned to the resource ID.
// Type:    Method.
// Args:    vResourceId - (R) MI resource ID.
// Return:  CMIUtilString - Resource text.
// Throws:  None.
//--
CMIUtilString CMICmnResources::GetString(const MIuint vResourceId) const {
  CMIUtilString str;
  const bool bFound = GetStringFromResource(vResourceId, str);
  MIunused(bFound);
  assert(bFound);

  return str;
}

//++
//------------------------------------------------------------------------------------
// Details: Determine the MI resource ID existings.
// Type:    Method.
// Args:    vResourceId - (R) MI resource ID.
// Return:  True - Exists.
//          False - Not found.
// Throws:  None.
//--
bool CMICmnResources::HasString(const MIuint vResourceId) const {
  CMIUtilString str;
  return GetStringFromResource(vResourceId, str);
}

//++
//------------------------------------------------------------------------------------
// Details: Retrieve the resource text data for the given resource ID. If a
// resource ID
//          cannot be found and error is given returning the ID of the resource
//          that
//          cannot be located.
// Type:    Method.
// Args:    vResourceId         - (R) MI resource ID.
//          vrwResourceString   - (W) Text.
// Return:  MIstatus::success - Functional succeeded.
//          MIstatus::failure - Functional failed.
// Throws:  None.
//--
bool CMICmnResources::GetStringFromResource(
    const MIuint vResourceId, CMIUtilString &vrwResourceString) const {
  MapRscrIdToTextData_t::const_iterator it =
      m_mapRscrIdToTextData.find(vResourceId);
  if (it == m_mapRscrIdToTextData.end()) {
    // Check this is a static variable init that needs this before we are ready
    if (!m_bInitialized) {
      (const_cast<CMICmnResources *>(this))->Initialize();
      it = m_mapRscrIdToTextData.find(vResourceId);
      if (it == m_mapRscrIdToTextData.end()) {
        vrwResourceString = MIRSRC(IDS_RESOURCES_ERR_STRING_TABLE_INVALID);
        return MIstatus::failure;
      }
    }

    if (it == m_mapRscrIdToTextData.end()) {
      vrwResourceString = CMIUtilString::Format(
          MIRSRC(IDS_RESOURCES_ERR_STRING_NOT_FOUND), vResourceId);
      return MIstatus::failure;
    }
  }

  const MIuint nRsrcId((*it).first);
  MIunused(nRsrcId);
  const char *pRsrcData((*it).second);

  // Return result
  vrwResourceString = pRsrcData;

  return MIstatus::success;
}