]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmnResources.cpp
Merge ^/head r275715 through r275748.
[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 //++
11 // File:                MICmnResources.cpp
12 //
13 // Overview:    CMICmnResources implementation.
14 //
15 // Environment: Compilers:      Visual C++ 12.
16 //                                                      gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 //                              Libraries:      See MIReadmetxt. 
18 //
19 // Copyright:   None.
20 //--
21
22 // Third party headers
23 #include "assert.h"
24
25 // In-house headers:
26 #include "MICmnResources.h"
27
28 // Instantiations:
29 const CMICmnResources::SRsrcTextData    CMICmnResources::ms_pResourceId2TextData[] = 
30 {
31         { IDS_PROJNAME,                                                         "LLDB Machine Interface Driver (MI) All rights reserved" },
32         { IDS_MI_VERSION_DESCRIPTION_DEBUG,                     "Version: 1.0.0.9 (Debug)" }, // See version history in MIDriverMain.cpp
33         { IDS_MI_VERSION_DESCRIPTION,                           "Version: 1.0.0.9" },
34         { IDS_MI_APPNAME_SHORT,                                         "MI" },
35         { IDS_MI_APPNAME_LONG,                                          "Machine Interface Driver" },
36         { IDS_MI_APP_FILEPATHNAME,                                      "Application: %s" },
37         { IDS_MI_APP_ARGS,                                                      "Command line args: " },
38         { 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!!
39         { IDS_UTIL_FILE_ERR_INVALID_PATHNAME,           "File Handler. Invalid file name path" },
40         { IDS_UTIL_FILE_ERR_OPENING_FILE,                       "File Handler. Error %s opening '%s'" },
41         { IDS_UTIL_FILE_ERR_OPENING_FILE_UNKNOWN,       "File Handler. Unknown error opening '%s'" },
42         { IDE_UTIL_FILE_ERR_WRITING_FILE,                       "File Handler. Error %s writing '%s'" },
43         { IDE_UTIL_FILE_ERR_WRITING_NOTOPEN,            "File Handler. File '%s' not open for write" },
44         { IDS_RESOURCES_ERR_STRING_NOT_FOUND,           "Resources. String (%d) not found in resources" },
45         { IDS_RESOURCES_ERR_STRING_TABLE_INVALID,       "Resources. String resource table is not set up" },
46         { IDS_MI_CLIENT_MSG,                                            "Client message: \"%s\"" },
47         { IDS_LOG_MSG_CREATION_DATE,                            "Creation date %s time %s%s" },
48         { IDS_LOG_MSG_FILE_LOGGER_PATH,                         "File logger path: %s%s" },     
49         { IDS_LOG_MSG_VERSION,                                          "Version: %s%s" },
50         { IDS_LOG_ERR_FILE_LOGGER_DISABLED,                     "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,                         "Log. Failed to write log data to any medium." },
53         { IDS_LOG_MEDIUM_ERR_WRITE_MEDIUMFAIL,          "Log. One or mediums failed writing log data." },
54         { IDS_MEDIUMFILE_NAME,                                          "File" },
55         { IDS_MEDIUMFILE_ERR_INVALID_PATH,                      "<Invalid - not set>" },
56         { IDS_MEDIUMFILE_ERR_FILE_HEADER,                       "<Invalid - header not set>" },
57         { IDS_MEDIUMFILE_NAME_LOG,                                      "File medium. %s" },
58         { IDE_MEDIUMFILE_ERR_GET_FILE_PATHNAME_SYS,     "File Medium. Failed to retrieve the system/executable path for the Log file" },
59         { IDE_OS_ERR_UNKNOWN,                                           "Unknown OS error" },
60         { IDE_OS_ERR_RETRIEVING,                                        "Unabled to retrieve OS error message" },
61         { IDS_DRIVERMGR_DRIVER_ERR_INIT,                        "Driver Manager. Driver '%s' (ID:'%s') initialise failed. %s" },
62         { IDE_MEDIUMSTDERR_NAME,                                        "Stderr" },
63         { IDE_MEDIUMSTDOUT_NAME,                                        "Stdout" },
64         { IDE_MI_APP_EXIT_OK,                                           "Program exited OK" },
65         { IDE_MI_APP_EXIT_WITH_PROBLEM,                         "Program exited with a problem, see '%s' file" },       
66         { IDE_MI_APP_EXIT_WITH_PROBLEM_NO_LOG,          "Program exited with a problem, the application's log file '%s' was disabled" },        
67         { 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." },                
68         { 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." },             
69         { IDE_MI_APP_ARG_USAGE,                                         "\nMI driver usage:\n\n\tlldb-mi [--longOption] [-s hortOption] [executeable]\n\n[] = optional argument." },
70         { IDE_MI_APP_ARG_HELP,                                          "-h\n--help\n\tPrints out usage information for the MI debugger. Exit the MI\n\tDriver immediately." },
71         { IDE_MI_APP_ARG_VERSION,                                       "--version\n\tPrints out GNU (gdb) version information. Exit the MI Driver\n\timmediately." },
72         { IDE_MI_APP_ARG_VERSION_LONG,                          "--versionLong\n\tPrints out MI Driver version information. Exit the MI Driver\n\timmediately." },
73         { IDE_MI_APP_ARG_INTERPRETER,                           "--interpreter\n\tUse the MI Driver for the debugger (MI mode)(Default is the\n\tLLDB driver). Any LLDB command line options are ignored even\n\tif the MI Driver falls through to the LLDB driver. (Depends\n\ton the build configuration see MICmnConfig.h)\n\tNormally specified by the driver client i.e. Eclipse.\n\tCannot specify an executable with this option, use --executable." },
74         { IDE_MI_APP_ARG_EXECUTEABLE,                           "--executable\n\tUse the MI Driver in MI mode for the debugging the specified\n\texecutable. Any LLDB command line options are ignored even\n\tif the MI Driver falls through to the LLDB driver. (Depends\n\ton the build configuration see MICmnConfig.h)\n\tNormally specified from the command line." },
75         { IDE_MI_APP_ARG_NO_APP_LOG,                            "--noLog\n\tUse this argument to tell the MI Driver not to update it's log\n\tfile '%s'." },
76         { IDE_MI_APP_ARG_EXAMPLE,                                       "Example MI command:\n\t3-info-gdb-mi-command gdb-set\n\t3^done,command={exists=\"true\"}" },
77         { IDE_MI_APP_ARG_EXECUTABLE,                            "executable (NOT IMPLEMENTED)\n\tThe file path to the executable i.e. '\"C:\\My Dev\\foo.exe\"'." },
78         { IDS_STDIN_ERR_INVALID_PROMPT,                         "Stdin. Invalid prompt description '%s'" },
79         { IDS_STDIN_ERR_THREAD_CREATION_FAILED,         "Stdin. Thread creation failed '%s'" },
80         { IDS_STDIN_ERR_THREAD_DELETE,                          "Stdin. Thread failed to delete '%s'" },
81         { IDS_STDIN_ERR_CHKING_BYTE_AVAILABLE,          "Stdin. Peeking on stdin stream '%s'" },
82         { IDS_STDIN_INPUT_CTRL_CHARS,                           "Stdin. Receive characters not handled as a command: " },       
83         { IDS_CMD_QUIT_HELP,                                            "MI Driver Command: quit\n\tExit the MI Driver application." },
84         { IDS_THREADMGR_ERR_THREAD_ID_INVALID,          "Thread Mgr. Thread ID '%s' is not valid" },
85         { IDS_THREADMGR_ERR_THREAD_FAIL_CREATE,         "Thread Mgr: Failed to create thread '%s'" },
86         { IDS_THREADMGR_ERR_THREAD_ID_NOT_FOUND,        "Thread Mgr: Thread with ID '%s' not found" },
87         { IDS_THREADMGR_ERR_THREAD_STILL_ALIVE,     "Thread Mgr: The thread(s) are still alive at Thread Mgr shutdown: %s" },
88         { IDS_FALLTHRU_DRIVER_CMD_RECEIVED,                     "Fall Thru Driver. Received command '%s'. Is was %shandled" },  
89         { IDS_CMDFACTORY_ERR_INVALID_CMD_NAME,          "Command factory. MI command name '%s' is invalid" },   
90         { IDS_CMDFACTORY_ERR_INVALID_CMD_CR8FN,         "Command factory. Command creation function invalid for command '%s'. Does function exist? Pointer assigned to it?" },  
91         { IDS_CMDFACTORY_ERR_CMD_NOT_REGISTERED,        "Command factory. Command '%s' not registered" },
92         { IDS_CMDFACTORY_ERR_CMD_ALREADY_REGED,         "Command factory. Command '%s' by that name already registered" },
93         { IDS_CMDMGR_ERR_CMD_FAILED_CREATE,                     "Command manager. Command creation failed. %s" },
94         { IDS_CMDMGR_ERR_CMD_INVOKER,                           "Command manager. %s " },
95         { IDS_PROCESS_SIGNAL_RECEIVED,                          "Process signal. Application received signal '%s' (%d)" },
96         { IDS_MI_INIT_ERR_LOG,                                          "Log. Error occurred during initialisation %s" },
97         { IDS_MI_INIT_ERR_RESOURCES,                            "Resources. Error occurred during initialisation %s" },
98         { IDS_MI_INIT_ERR_INIT,                                         "Driver. Error occurred during initialisation %s" },
99         { IDS_MI_INIT_ERR_STREAMSTDIN,                          "Stdin. Error occurred during initialisation %s" },
100         { IDS_MI_INIT_ERR_STREAMSTDIN_OSHANDLER,        "Stdin. The OS specific stdin stream handler has not been specified for this OS" },
101         { IDS_MI_INIT_ERR_OS_STDIN_HANDLER,                     "Stdin handler. Error occurred during initialisation %s" },
102         { IDS_MI_INIT_ERR_STREAMSTDOUT,                         "Stdout. Error occurred during initialisation %s" },
103         { IDS_MI_INIT_ERR_STREAMSTDERR,                         "Stderr. Error occurred during initialisation %s" },
104         { IDS_MI_INIT_ERR_FALLTHRUDRIVER,                       "Fall Through Driver. Error occurred during initialisation %s" },               
105         { IDS_MI_INIT_ERR_THREADMGR,                            "Thread Mgr. Error occurred during initialisation %s" },                
106         { IDS_MI_INIT_ERR_CMDINTERPRETER,                       "Command interpreter. %s" },
107         { IDS_MI_INIT_ERR_CMDMGR,                                       "Command manager. %s" },
108         { IDS_MI_INIT_ERR_CMDFACTORY,                           "Command factory. %s" },
109         { IDS_MI_INIT_ERR_CMDINVOKER,                           "Command invoker. %s" },
110         { IDS_MI_INIT_ERR_CMDMONITOR,                           "Command monitor. %s" },
111         { IDS_MI_INIT_ERR_LLDBDEBUGGER,                         "LLDB Debugger. %s" },
112         { IDS_MI_INIT_ERR_DRIVERMGR,                            "Driver manager. %s" },
113         { IDS_MI_INIT_ERR_DRIVER,                                       "Driver. %s" },
114         { IDS_MI_INIT_ERR_OUTOFBANDHANDLER,                     "Out-of-band handler. %s " },           
115         { IDS_MI_INIT_ERR_DEBUGSESSIONINFO,                     "LLDB debug session info. %s " },
116         { IDS_MI_INIT_ERR_THREADMANAGER,                        "Unable to init thread manager." },
117         { IDS_MI_INIT_ERR_CLIENT_USING_DRIVER,          "Initialising the client to this driver failed." },
118         { IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION,      "Initialising a local debug session failed." }, 
119         { IDS_CODE_ERR_INVALID_PARAMETER_VALUE,         "Code. Invalid parameter passed to function '%s'" },
120         { IDS_CODE_ERR_INVALID_PARAM_NULL_POINTER,      "Code. NULL pointer passes as a parameter to function '%s'" },
121         { IDS_CODE_ERR_INVALID_ENUMERATION_VALUE,       "Code. Invalid enumeration value encountered in function '%s'" },
122         { IDS_LLDBDEBUGGER_ERR_INVALIDLISTENER,         "LLDB Debugger. LLDB Listener is not valid", },
123         { IDS_LLDBDEBUGGER_ERR_INVALIDDEBUGGER,         "LLDB Debugger. LLDB Debugger is not valid", },
124         { IDS_LLDBDEBUGGER_ERR_CLIENTDRIVER,            "LLDB Debugger. CMIDriverBase derived driver needs to be set prior to CMICmnLLDBDDebugger initialisation" },
125         { IDS_LLDBDEBUGGER_ERR_STARTLISTENER,           "LLDB Debugger. Starting listening events for '%s' failed" },
126         { IDS_LLDBDEBUGGER_ERR_THREADCREATIONFAIL,      "LLDB Debugger. Thread creation failed '%s'" },
127         { IDS_LLDBDEBUGGER_ERR_THREAD_DELETE,           "LLDB Debugger. Thread failed to delete '%s'" },
128         { IDS_LLDBDEBUGGER_ERR_INVALIDBROADCASTER,      "LLDB Debugger. Invalid SB broadcaster class name '%s' " },
129         { IDS_LLDBDEBUGGER_ERR_INVALIDCLIENTNAME,       "LLDB Debugger. Invalid client name '%s' " },
130         { IDS_LLDBDEBUGGER_ERR_CLIENTNOTREGISTERD,      "LLDB Debugger. Client name '%s' not registered for listening events" },
131         { IDS_LLDBDEBUGGER_ERR_STOPLISTENER,            "LLDB Debugger. Failure occurred stopping event for client '%s' SBBroadcaster '%s'" },
132         { IDS_LLDBDEBUGGER_ERR_BROARDCASTER_NAME,       "LLDB Debugger. Broardcaster's name '%s' is not valid" },
133         { IDS_LLDBDEBUGGER_WRN_UNKNOWN_EVENT,           "LLDB Debugger. Unhandled event '%s'" },
134         { IDS_LLDBOUTOFBAND_ERR_UNKNOWN_EVENT,          "LLDB Out-of-band. Handling event for '%s', an event enumeration '%d' not recognised" },
135         { IDS_LLDBOUTOFBAND_ERR_PROCESS_INVALID,        "LLDB Out-of-band. Invalid '%s' in '%s'" },
136         { IDS_LLDBOUTOFBAND_ERR_BRKPT_NOTFOUND,         "LLDB Out-of-band. %s. Breakpoint information for breakpoint ID %d not found" },
137         { IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_GET,         "LLDB Out-of-band. %s. Failed to retrieve breakpoint information for for breakpoint ID %d" },
138         { IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_SET,         "LLDB Out-of-band. %s. Failed to set breakpoint information for for breakpoint ID %d" },
139         { IDS_LLDBOUTOFBAND_ERR_FORM_MI_RESPONSE,       "LLDB Out-of-band. %s. Failed to form the MI Out-of-band response" },
140         { IDS_LLDBOUTOFBAND_ERR_FRAME_INFO_GET,         "LLDB Out-of-band. %s. Failed to retrieve frame information" },
141         { IDS_LLDBOUTOFBAND_ERR_SETNEWDRIVERSTATE,  "LLDB Out-of-band. %s. Event handler tried to set new MI Driver running state and failed. %s" },
142         { IDS_LLDBOUTOFBAND_ERR_BRKPT_CNT_EXCEEDED,     "LLDB Out-of-band. '%s'. Number of valid breakpoint exceeded %d. Cannot create new breakpoint with ID %d" },
143         { IDS_DBGSESSION_ERR_SHARED_DATA_RELEASE,       "LLDB debug session info. Release some or all of the data shared across command instances failed" },
144         { IDS_DBGSESSION_ERR_SHARED_DATA_ADD,           "LLDB debug session info. Failed to add '%s' data to the shared data command container" },
145         { IDS_MI_SHTDWN_ERR_LOG,                                        "Log. Error occurred during shutdown. %s" },
146         { IDS_MI_SHUTDOWN_ERR,                                          "Server shutdown failure. %s" },
147         { IDE_MI_SHTDWN_ERR_RESOURCES,                          "Resources. Error occurred during shutdown. %s" },
148         { IDE_MI_SHTDWN_ERR_STREAMSTDIN,                        "Stdin. Error occurred during shutdown. %s" },
149         { IDS_MI_SHTDWN_ERR_OS_STDIN_HANDLER,           "Stdin handler. Error occurred during shutdown. %s" },
150     { IDS_MI_SHTDWN_ERR_STREAMSTDOUT,                   "Stdout. Error occurred during shutdown. %s" }, 
151         { IDS_MI_SHTDWN_ERR_STREAMSTDERR,                       "Stderr. Error occurred during shutdown. %s" }, 
152         { IDS_MI_SHTDWN_ERR_THREADMGR,                          "Thread Mgr. Error occurred during shutdown. %s" },                     
153         { IDS_MI_SHTDWN_ERR_CMDINTERPRETER,                     "Command interpreter. Error occurred during shutdown. %s" },
154         { IDS_MI_SHTDWN_ERR_CMDMGR,                                     "Command manager. Error occurred during shutdown. %s" },
155         { IDS_MI_SHTDWN_ERR_CMDFACTORY,                         "Command factory. Error occurred during shutdown. %s" },
156         { IDS_MI_SHTDWN_ERR_CMDMONITOR,                         "Command invoker. Error occurred during shutdown. %s" },
157         { IDS_MI_SHTDWN_ERR_CMDINVOKER,                         "Command monitor. Error occurred during shutdown. %s" },
158         { IDS_MI_SHTDWN_ERR_LLDBDEBUGGER,                       "LLDB Debugger. Error occurred during shutdown. %s" },
159         { IDS_MI_SHTDWN_ERR_DRIVERMGR,                          "Driver manager. Error occurred during shutdown. %s" },
160         { IDS_MI_SHTDWN_ERR_DRIVER,                                     "Driver. Error occurred during shutdown. %s" },
161         { IDS_MI_SHTDWN_ERR_OUTOFBANDHANDLER,           "Out-of-band handler. Error occurred during shutdown. %s" },
162         { IDS_MI_SHTDWN_ERR_DEBUGSESSIONINFO,           "LLDB debug session info. Error occurred during shutdown. %s" },
163         { IDE_MI_SHTDWN_ERR_THREADMANAGER,                      "Unable to shutdown thread manager" },
164         { IDS_DRIVER_ERR_PARSE_ARGS,                            "Driver. Driver '%s'. Parse args error '%s'" },
165         { IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN,            "Driver. Driver '%s'. Parse args error unknown" },      
166         { IDS_DRIVER_ERR_CURRENT_NOT_SET,                       "Driver. Current working driver has not been set. Call CMIDriverMgr::SetUseThisDriverToDoWork()" },
167         { IDS_DRIVER_ERR_NON_REGISTERED,                        "Driver. No suitable drivers registered with the CMIDriverMgr to do work" },    
168         { IDS_DRIVER_SAY_DRIVER_USING,                          "Driver. Using driver '%s' internally" },       
169         { IDS_DRIVER_ERR_ID_INVALID,                            "Driver. Driver '%s' invalid ID '%s'" },
170         { IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR,           "Driver. Fall through driver '%s' (ID:'%s') error '%s'" },      
171         { IDS_DRIVER_CMD_RECEIVED,                                      "Driver. Received command '%s'. It was %shandled%s" },  
172         { IDS_DRIVER_CMD_NOT_IN_FACTORY,                        ". Command '%s' not in Command Factory" },      
173         { IDS_DRIVER_ERR_DRIVER_STATE_ERROR,            "Driver. Driver running state error. Cannot go to next state from present state as not allowed", },     
174         { IDS_DRIVER_WAITING_STDIN_DATA,                        "Driver. Main thread suspended waiting on Stdin Monitor to resume main thread" },
175         { IDS_DRIVER_ERR_MAINLOOP,                                      "Driver. Error in do main loop. %s" },                          
176         { IDS_DRIVER_ERR_LOCAL_DEBUG_NOT_IMPL,          "Driver. --executable argument given. Local debugging is not implemented." },   
177         { IDS_DRIVER_ERR_LOCAL_DEBUG_INIT,                      "Driver. --executable argument given. Initialising local debugging failed." },  
178         { IDS_STDOUT_ERR_NOT_ALL_DATA_WRITTEN,          "Stdout. Not all data was written to stream. The data '%s'" },
179         { IDS_STDERR_ERR_NOT_ALL_DATA_WRITTEN,          "Stderr. Not all data was written to stream. The data '%s'" },
180         { IDS_CMD_ARGS_ERR_N_OPTIONS_REQUIRED,          "Command Args. Missing options, %d or more required" },
181         { IDS_CMD_ARGS_ERR_OPTION_NOT_FOUND,            "Command Args. Option '%s' not found" },
182         { IDS_CMD_ARGS_ERR_VALIDATION_MANDATORY,        "Mandatory args not found: %s" },
183         { IDS_CMD_ARGS_ERR_VALIDATION_INVALID,          "Invalid args: %s" },
184         { IDS_CMD_ARGS_ERR_VALIDATION_MAN_INVALID,  "Mandatory args not found: %s. Invalid args: %s" },
185         { IDS_CMD_ARGS_ERR_VALIDATION_MISSING_INF,  "Args missing additional information: %s" },
186         { IDS_CMD_ARGS_ERR_CONTEXT_NOT_ALL_EATTEN,      "Not all arguments or options were recognised: %s" },
187         { IDS_CMD_ARGS_ERR_PREFIX_MSG,                          "Command Args. Validation failed. " },
188         { IDS_VARIANT_ERR_USED_BASECLASS,                       "Variant container: Variant object used the base class. See CMIUtilVariant" },
189         { IDS_VARIANT_ERR_MAP_KEY_INVALID,                      "Variant container: Invalid ID '%s'" },
190         { IDS_WORD_INVALIDBRKTS,                                        "<Invalid>" },
191         { IDS_WORD_NONE,                                                        "None" },
192         { IDS_WORD_NOT,                                                         "not" },
193         { IDS_WORD_INVALIDEMPTY,                                        "<empty>" },
194         { IDS_WORD_INVALIDNULLPTR,                                      "<NULL ptr>" },
195         { IDS_WORD_UNKNOWNBRKTS,                                        "<unknown>" },
196         { IDS_WORD_NOT_IMPLEMENTED,                                     "Not implemented" },    
197         { IDS_WORD_NOT_IMPLEMENTED_BRKTS,                       "<not implemented>" },
198         { IDS_WORD_UNKNOWNTYPE_BRKTS,                           "<unknowntype>" },
199         { IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS,       "<error message not implemented>" },
200         { IDS_CMD_ERR_N_OPTIONS_REQUIRED,                       "Command '%s'. Missing options, %d required" },
201         { IDS_CMD_ERR_OPTION_NOT_FOUND,                         "Command '%s'. Option '%s' not found" },
202         { IDS_CMD_ERR_ARGS,                                                     "Command '%s'. %s" },
203         { IDS_CMD_WRN_ARGS_NOT_HANDLED,                         "Command '%s'. Warning the following options not handled by the command: %s" },
204         { IDS_CMD_ERR_FNFAILED,                                         "Command '%s'. Fn '%s' failed" },
205         { IDS_CMD_ERR_SHARED_DATA_NOT_FOUND,            "Command '%s'. Shared data '%s' not found" },
206         { IDS_CMD_ERR_LLDBPROCESS_DETACH,                       "Command '%s'. Process detach failed. '%s'"     },
207         { IDS_CMD_ERR_SETWKDIR,                                         "Command '%s'. Failed to set working directory '%s'" },
208         { IDS_CMD_ERR_INVALID_TARGET,                           "Command '%s'. Target binary '%s' is invalid. %s" },    
209         { IDS_CMD_ERR_INVALID_TARGET_CURRENT,           "Command '%s'. Current SBTarget is invalid" },
210         { IDS_CMD_ERR_INVALID_TARGET_TYPE,                      "Command '%s'. Target type '%s' is not recognised" },
211         { IDS_CMD_ERR_INVALID_TARGET_PLUGIN,            "Command '%s'. Target plugin is invalid. %s" },
212         { IDS_CMD_ERR_CONNECT_TO_TARGET,                        "Command '%s'. Error connecting to target: '%s'" },
213         { IDS_CMD_ERR_INVALID_TARGETPLUGINCURRENT,      "Command '%s'. Current target plugin is invalid" },
214         { IDS_CMD_ERR_NOT_IMPLEMENTED,                          "Command '%s'. Command not implemented" },
215         { IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED,       "Command '%s'. Command not implemented as it has been deprecated" },
216         { IDS_CMD_ERR_CREATE_TARGET,                            "Command '%s'. Create target failed: %s" },
217         { IDS_CMD_ERR_BRKPT_LOCATION_FORMAT,            "Command '%s'. Incorrect format for breakpoint location '%s'" },
218         { IDS_CMD_ERR_BRKPT_INVALID,                            "Command '%s'. Breakpoint '%s' invalid" },
219         { IDS_CMD_ERR_BRKPT_CNT_EXCEEDED,                       "Command '%s'. Number of valid breakpoint exceeded %d. Cannot create new breakpoint '%s'" },
220         { IDS_CMD_ERR_SOME_ERROR,                                       "Command '%s'. Error: %s" },
221         { IDS_CMD_ERR_THREAD_INVALID,                           "Command '%s'. Thread ID invalid" },
222         { IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID,       "Command '%s'. Thread frame range invalid" },
223         { IDS_CMD_ERR_FRAME_INVALID,                            "Command '%s'. Frame ID invalid" },
224         { IDS_CMD_ERR_VARIABLE_DOESNOTEXIST,            "Command '%s'. Variable '%s' does not exist" },
225         { IDS_CMD_ERR_VARIABLE_ENUM_INVALID,            "Command '%s'. Invalid enumeration for variable '%s' formatted string '%s'" },
226         { IDS_CMD_ERR_VARIABLE_EXPRESSIONPATH,          "Command '%s'. Failed to get expression for variable '%s'" },
227         { IDS_CMD_ERR_VARIABLE_CREATION_FAILED,         "Failed to create variable object for '%s'" },
228         { IDS_CMD_ERR_CMD_RUN_BUT_NO_ACTION,            "<Error: Command run but command did not do anything useful. No MI response formed>" },
229         { IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION,  "<Error: Command run and event caught, did nothing useful. No MI Out-of-Bound formed>"},
230         { IDS_CMD_ERR_DISASM_ADDR_START_INVALID,        "Command '%s'. Invalid start value '%s'" },
231         { IDS_CMD_ERR_DISASM_ADDR_END_INVALID,          "Command '%s'. Invalid end value '%s'" },
232         { IDS_CMD_ERR_MEMORY_ALLOC_FAILURE,                     "Command '%s'. Failed to allocate memory %d bytes" },
233         { IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK,  "Command '%s'. LLDB unable to read entire memory block of %u bytes at address 0x%08x" },
234         { IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES,          "Command '%s'. Unable to read memory block of %u bytes at address 0x%08x: %s " },       
235         { IDS_CMD_ERR_INVALID_PROCESS,                          "Command '%s'. Invalid process during debug session" }, 
236         { IDS_CMD_ERR_INVALID_FORMAT_TYPE,                      "Command '%s'. Invalid var format type '%s'" },
237         { IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND,         "Command '%s'. Breakpoint information for breakpoint ID %d not found" },
238         { IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES,          "Command '%s'. Unable to write memory block of %u bytes at address 0x%08x: %s " },      
239         { IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK,      "Command '%s'. LLDB unable to write entire memory block of %u bytes at address 0x%08x" },
240         { IDS_CMD_ERR_SET_NEW_DRIVER_STATE,                     "Command '%s'. Command tried to set new MI Driver running state and failed. %s" },
241         { IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND,           "The request '%s' was not recogised, not implemented" },
242         { IDS_CMD_ERR_INFO_PRINTFN_FAILED,                      "The request '%s' failed." },
243         { IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH,   "'solib-search-path' requires at least one argument" }
244         };
245
246 //++ ------------------------------------------------------------------------------------
247 // Details:     CMICmnResources constructor.
248 // Type:        Method.
249 // Args:        None.
250 // Return:      None.
251 // Throws:      None.
252 //--
253 CMICmnResources::CMICmnResources( void )
254 :       m_nResourceId2TextDataSize( 0 )
255 {
256         // Do not use this constructor, use Initialize()
257 }
258
259 //++ ------------------------------------------------------------------------------------
260 // Details:     CMICmnResources destructor.
261 // Type:        Overridden.
262 // Args:        None.
263 // Return:      None.
264 // Throws:      None.
265 //--
266 CMICmnResources::~CMICmnResources( void )
267 {
268         // Do not use this destructor, use Shutdown()
269 }
270
271 //++ ------------------------------------------------------------------------------------
272 // Details:     Initialize the resources and set locality for the server.
273 // Type:        Method.
274 // Args:        None.
275 // Return:      MIstatus::success - Functional succeeded.
276 //                      MIstatus::failure - Functional failed.
277 // Throws:      None.
278 //--
279 bool CMICmnResources::Initialize( void )
280 {
281         m_clientUsageRefCnt++;
282
283         if( m_bInitialized )
284                 return MIstatus::success;
285
286         m_bInitialized = ReadResourceStringData();
287
288         return m_bInitialized;
289 }
290
291 //++ ------------------------------------------------------------------------------------
292 // Details:     Release resources for *this object.
293 // Type:        Method.
294 // Args:        None.
295 // Return:      MIstatus::success - Functional succeeded.
296 //                      MIstatus::failure - Functional failed.
297 // Throws:      None.
298 //--
299 bool CMICmnResources::Shutdown( void )
300 {
301         if( --m_clientUsageRefCnt > 0 )
302                 return MIstatus::success;
303         
304         if( !m_bInitialized )
305                 return MIstatus::success;
306
307         // Tear down resource explicitly
308         m_mapRscrIdToTextData.clear();
309
310         m_bInitialized = false;
311
312         return MIstatus::success;
313 }
314
315 //++ ------------------------------------------------------------------------------------
316 // Details:     Initialize the resources and set locality for the server.
317 // Type:        Method.
318 // Args:        None.
319 // Return:      MIstatus::success - Functional succeeded.
320 //                      MIstatus::failure - Functional failed.
321 // Throws:      None.
322 //--
323 bool CMICmnResources::ReadResourceStringData( void )
324 {
325         m_nResourceId2TextDataSize = sizeof ms_pResourceId2TextData / sizeof ms_pResourceId2TextData[ 0 ];
326         for( MIuint i = 0; i < m_nResourceId2TextDataSize; i++ )
327         {
328                 const SRsrcTextData * pRscrData = &ms_pResourceId2TextData[ i ];
329                 MapPairRscrIdToTextData_t pr( pRscrData->id, pRscrData->pTextData );
330                 m_mapRscrIdToTextData.insert( pr );
331         }
332         
333         return MIstatus::success;
334 }
335
336 //++ ------------------------------------------------------------------------------------
337 // Details:     Retrieve the corresponding text assigned to the resource ID.
338 // Type:        Method.
339 // Args:        vResourceId     - (R) MI resource ID.
340 // Return:      CMIUtilString - Resource text.
341 // Throws:      None.
342 //--
343 CMIUtilString CMICmnResources::GetString( const MIuint vResourceId ) const
344 {
345         CMIUtilString str;
346         const bool bFound = GetStringFromResource( vResourceId, str );  MIunused( bFound );
347         assert( bFound );
348
349         return str;
350 }
351
352 //++ ------------------------------------------------------------------------------------
353 // Details:     Determine the MI resource ID existings.
354 // Type:        Method.
355 // Args:        vResourceId     - (R) MI resource ID.
356 // Return:      True - Exists.
357 //                      False - Not found.
358 // Throws:      None.
359 //--
360 bool CMICmnResources::HasString( const MIuint vResourceId ) const
361 {
362         CMIUtilString str;
363         return GetStringFromResource( vResourceId, str );
364 }
365
366 //++ ------------------------------------------------------------------------------------
367 // Details:     Retrieve the resource text data for the given resource ID. If a resourse ID
368 //                      cannot be found and error is given returning the ID of the resource that 
369 //                      cannot be located.
370 // Type:        Method.
371 // Args:        vResourceId                     - (R) MI resource ID.
372 //                      vrwResourceString       - (W) Text.
373 // Return:      MIstatus::success - Functional succeeded.
374 //                      MIstatus::failure - Functional failed.
375 // Throws:      None.
376 //--
377 bool CMICmnResources::GetStringFromResource( const MIuint vResourceId, CMIUtilString & vrwResourceString ) const
378 {
379         MapRscrIdToTextData_t::const_iterator it = m_mapRscrIdToTextData.find( vResourceId );
380         if( it == m_mapRscrIdToTextData.end() )
381         {
382                 // Check this is a static variable init that needs this before we are ready 
383                 if( !m_bInitialized )
384                 {       
385                         (const_cast< CMICmnResources * >( this ))->Initialize();
386                         it = m_mapRscrIdToTextData.find( vResourceId );
387                         if( it == m_mapRscrIdToTextData.end() )
388                         {
389                                 vrwResourceString = MIRSRC( IDS_RESOURCES_ERR_STRING_TABLE_INVALID );
390                                 return MIstatus::failure;
391                         }
392                 }
393
394                 if( it == m_mapRscrIdToTextData.end() )
395                 {       
396                         vrwResourceString = CMIUtilString::Format( MIRSRC( IDS_RESOURCES_ERR_STRING_NOT_FOUND ), vResourceId );
397                         return MIstatus::failure;
398                 }
399         }
400
401         const MIuint nRsrcId( (*it).first ); MIunused( nRsrcId );
402         const MIchar * pRsrcData( (*it).second );
403
404         // Return result
405         vrwResourceString = pRsrcData;
406
407         return MIstatus::success;
408 }
409