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>
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] [executable]\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 {IDE_MI_APP_ARG_SYNCHRONOUS, "--synchronous\n\tBlock until each command "
114 "has finished executing.\n\tUsed for testing only."},
115 {IDS_STDIN_ERR_INVALID_PROMPT,
116 "Stdin. Invalid prompt description '%s'"},
117 {IDS_STDIN_ERR_THREAD_CREATION_FAILED,
118 "Stdin. Thread creation failed '%s'"},
119 {IDS_STDIN_ERR_THREAD_DELETE, "Stdin. Thread failed to delete '%s'"},
120 {IDS_STDIN_ERR_CHKING_BYTE_AVAILABLE,
121 "Stdin. Peeking on stdin stream '%s'"},
122 {IDS_STDIN_INPUT_CTRL_CHARS,
123 "Stdin. Receive characters not handled as a command: "},
124 {IDS_CMD_QUIT_HELP,
125 "MI Driver Command: quit\n\tExit the MI Driver application."},
126 {IDS_THREADMGR_ERR_THREAD_ID_INVALID,
127 "Thread Mgr. Thread ID '%s' is not valid"},
128 {IDS_THREADMGR_ERR_THREAD_FAIL_CREATE,
129 "Thread Mgr: Failed to create thread '%s'"},
130 {IDS_THREADMGR_ERR_THREAD_ID_NOT_FOUND,
131 "Thread Mgr: Thread with ID '%s' not found"},
132 {IDS_THREADMGR_ERR_THREAD_STILL_ALIVE, "Thread Mgr: The thread(s) are "
133 "still alive at Thread Mgr "
134 "shutdown: %s"},
135 {IDS_FALLTHRU_DRIVER_CMD_RECEIVED,
136 "Fall Thru Driver. Received command '%s'. Is was %shandled"},
137 {IDS_CMDFACTORY_ERR_INVALID_CMD_NAME,
138 "Command factory. MI command name '%s' is invalid"},
139 {IDS_CMDFACTORY_ERR_INVALID_CMD_CR8FN,
140 "Command factory. Command creation function invalid for command '%s'. "
141 "Does function exist? Pointer assigned to it?"},
142 {IDS_CMDFACTORY_ERR_CMD_NOT_REGISTERED,
143 "Command factory. Command '%s' not registered"},
144 {IDS_CMDFACTORY_ERR_CMD_ALREADY_REGED,
145 "Command factory. Command '%s' by that name already registered"},
146 {IDS_CMDMGR_ERR_CMD_FAILED_CREATE,
147 "Command manager. Command creation failed. %s"},
148 {IDS_CMDMGR_ERR_CMD_INVOKER, "Command manager. %s "},
149 {IDS_MI_INIT_ERR_LOG, "Log. Error occurred during initialisation %s"},
150 {IDS_MI_INIT_ERR_RESOURCES,
151 "Resources. Error occurred during initialisation %s"},
152 {IDS_MI_INIT_ERR_INIT,
153 "Driver. Error occurred during initialisation %s"},
154 {IDS_MI_INIT_ERR_STREAMSTDIN,
155 "Stdin. Error occurred during initialisation %s"},
156 {IDS_MI_INIT_ERR_STREAMSTDIN_OSHANDLER, "Stdin. The OS specific stdin "
157 "stream handler has not been "
158 "specified for this OS"},
159 {IDS_MI_INIT_ERR_OS_STDIN_HANDLER,
160 "Stdin handler. Error occurred during initialisation %s"},
161 {IDS_MI_INIT_ERR_STREAMSTDOUT,
162 "Stdout. Error occurred during initialisation %s"},
163 {IDS_MI_INIT_ERR_STREAMSTDERR,
164 "Stderr. Error occurred during initialisation %s"},
165 {IDS_MI_INIT_ERR_FALLTHRUDRIVER,
166 "Fall Through Driver. Error occurred during initialisation %s"},
167 {IDS_MI_INIT_ERR_THREADMGR,
168 "Thread Mgr. Error occurred during initialisation %s"},
169 {IDS_MI_INIT_ERR_CMDINTERPRETER, "Command interpreter. %s"},
170 {IDS_MI_INIT_ERR_CMDMGR, "Command manager. %s"},
171 {IDS_MI_INIT_ERR_CMDFACTORY, "Command factory. %s"},
172 {IDS_MI_INIT_ERR_CMDINVOKER, "Command invoker. %s"},
173 {IDS_MI_INIT_ERR_CMDMONITOR, "Command monitor. %s"},
174 {IDS_MI_INIT_ERR_LLDBDEBUGGER, "LLDB Debugger. %s"},
175 {IDS_MI_INIT_ERR_DRIVERMGR, "Driver manager. %s"},
176 {IDS_MI_INIT_ERR_DRIVER, "Driver. %s"},
177 {IDS_MI_INIT_ERR_OUTOFBANDHANDLER, "Out-of-band handler. %s "},
178 {IDS_MI_INIT_ERR_DEBUGSESSIONINFO, "LLDB debug session info. %s "},
179 {IDS_MI_INIT_ERR_THREADMANAGER, "Unable to init thread manager."},
180 {IDS_MI_INIT_ERR_CLIENT_USING_DRIVER,
181 "Initialising the client to this driver failed."},
182 {IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION,
183 "Initialising a local debug session failed."},
184 {IDS_CODE_ERR_INVALID_PARAMETER_VALUE,
185 "Code. Invalid parameter passed to function '%s'"},
186 {IDS_CODE_ERR_INVALID_PARAM_NULL_POINTER,
187 "Code. NULL pointer passes as a parameter to function '%s'"},
188 {IDS_CODE_ERR_INVALID_ENUMERATION_VALUE,
189 "Code. Invalid enumeration value encountered in function '%s'"},
190 {
191 IDS_LLDBDEBUGGER_ERR_INVALIDLISTENER,
192 "LLDB Debugger. LLDB Listener is not valid",
193 },
194 {
195 IDS_LLDBDEBUGGER_ERR_INVALIDDEBUGGER,
196 "LLDB Debugger. LLDB Debugger is not valid",
197 },
198 {IDS_LLDBDEBUGGER_ERR_CLIENTDRIVER,
199 "LLDB Debugger. CMIDriverBase derived driver needs to be set prior to "
200 "CMICmnLLDBDDebugger initialisation"},
201 {IDS_LLDBDEBUGGER_ERR_STARTLISTENER,
202 "LLDB Debugger. Starting listening events for '%s' failed"},
203 {IDS_LLDBDEBUGGER_ERR_THREADCREATIONFAIL,
204 "LLDB Debugger. Thread creation failed '%s'"},
205 {IDS_LLDBDEBUGGER_ERR_THREAD_DELETE,
206 "LLDB Debugger. Thread failed to delete '%s'"},
207 {IDS_LLDBDEBUGGER_ERR_INVALIDBROADCASTER,
208 "LLDB Debugger. Invalid SB broadcaster class name '%s' "},
209 {IDS_LLDBDEBUGGER_ERR_INVALIDCLIENTNAME,
210 "LLDB Debugger. Invalid client name '%s' "},
211 {IDS_LLDBDEBUGGER_ERR_CLIENTNOTREGISTERED,
212 "LLDB Debugger. Client name '%s' not registered for listening events"},
213 {IDS_LLDBDEBUGGER_ERR_STOPLISTENER, "LLDB Debugger. Failure occurred "
214 "stopping event for client '%s' "
215 "SBBroadcaster '%s'"},
216 {IDS_LLDBDEBUGGER_ERR_BROADCASTER_NAME,
217 "LLDB Debugger. Broadcaster's name '%s' is not valid"},
218 {IDS_LLDBDEBUGGER_WRN_UNKNOWN_EVENT,
219 "LLDB Debugger. Unhandled event '%s'"},
220 {IDS_LLDBOUTOFBAND_ERR_UNKNOWN_EVENT,
221 "LLDB Out-of-band. Handling event for '%s', an event enumeration '%d' "
222 "not recognised"},
223 {IDS_LLDBOUTOFBAND_ERR_PROCESS_INVALID,
224 "LLDB Out-of-band. Invalid '%s' in '%s'"},
225 {IDS_LLDBOUTOFBAND_ERR_BRKPT_NOTFOUND, "LLDB Out-of-band. %s. "
226 "Breakpoint information for "
227 "breakpoint ID %d not found"},
228 {IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_GET,
229 "LLDB Out-of-band. %s. Failed to retrieve breakpoint information for "
230 "for breakpoint ID %d"},
231 {IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_SET, "LLDB Out-of-band. %s. Failed "
232 "to set breakpoint information "
233 "for for breakpoint ID %d"},
234 {IDS_LLDBOUTOFBAND_ERR_FORM_MI_RESPONSE,
235 "LLDB Out-of-band. %s. Failed to form the MI Out-of-band response"},
236 {IDS_LLDBOUTOFBAND_ERR_FRAME_INFO_GET,
237 "LLDB Out-of-band. %s. Failed to retrieve frame information"},
238 {IDS_LLDBOUTOFBAND_ERR_SETNEWDRIVERSTATE,
239 "LLDB Out-of-band. %s. Event handler tried to set new MI Driver "
240 "running state and failed. %s"},
241 {IDS_LLDBOUTOFBAND_ERR_BRKPT_CNT_EXCEEDED,
242 "LLDB Out-of-band. '%s'. Number of valid breakpoint exceeded %d. "
243 "Cannot create new breakpoint with ID %d"},
244 {IDS_DBGSESSION_ERR_SHARED_DATA_ADD, "LLDB debug session info. Failed "
245 "to add '%s' data to the shared "
246 "data command container"},
247 {IDS_MI_SHTDWN_ERR_LOG, "Log. Error occurred during shutdown. %s"},
248 {IDS_MI_SHUTDOWN_ERR, "Server shutdown failure. %s"},
249 {IDE_MI_SHTDWN_ERR_RESOURCES,
250 "Resources. Error occurred during shutdown. %s"},
251 {IDE_MI_SHTDWN_ERR_STREAMSTDIN,
252 "Stdin. Error occurred during shutdown. %s"},
253 {IDS_MI_SHTDWN_ERR_OS_STDIN_HANDLER,
254 "Stdin handler. Error occurred during shutdown. %s"},
255 {IDS_MI_SHTDWN_ERR_STREAMSTDOUT,
256 "Stdout. Error occurred during shutdown. %s"},
257 {IDS_MI_SHTDWN_ERR_STREAMSTDERR,
258 "Stderr. Error occurred during shutdown. %s"},
259 {IDS_MI_SHTDWN_ERR_THREADMGR,
260 "Thread Mgr. Error occurred during shutdown. %s"},
261 {IDS_MI_SHTDWN_ERR_CMDINTERPRETER,
262 "Command interpreter. Error occurred during shutdown. %s"},
263 {IDS_MI_SHTDWN_ERR_CMDMGR,
264 "Command manager. Error occurred during shutdown. %s"},
265 {IDS_MI_SHTDWN_ERR_CMDFACTORY,
266 "Command factory. Error occurred during shutdown. %s"},
267 {IDS_MI_SHTDWN_ERR_CMDMONITOR,
268 "Command invoker. Error occurred during shutdown. %s"},
269 {IDS_MI_SHTDWN_ERR_CMDINVOKER,
270 "Command monitor. Error occurred during shutdown. %s"},
271 {IDS_MI_SHTDWN_ERR_LLDBDEBUGGER,
272 "LLDB Debugger. Error occurred during shutdown. %s"},
273 {IDS_MI_SHTDWN_ERR_DRIVERMGR,
274 "Driver manager. Error occurred during shutdown. %s"},
275 {IDS_MI_SHTDWN_ERR_DRIVER,
276 "Driver. Error occurred during shutdown. %s"},
277 {IDS_MI_SHTDWN_ERR_OUTOFBANDHANDLER,
278 "Out-of-band handler. Error occurred during shutdown. %s"},
279 {IDS_MI_SHTDWN_ERR_DEBUGSESSIONINFO,
280 "LLDB debug session info. Error occurred during shutdown. %s"},
281 {IDE_MI_SHTDWN_ERR_THREADMANAGER, "Unable to shutdown thread manager"},
282 {IDS_DRIVER_ERR_PARSE_ARGS,
283 "Driver. Driver '%s'. Parse args error '%s'"},
284 {IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN,
285 "Driver. Driver '%s'. Parse args error unknown"},
286 {IDS_DRIVER_ERR_CURRENT_NOT_SET,
287 "Driver. Current working driver has not been set. Call "
288 "CMIDriverMgr::SetUseThisDriverToDoWork()"},
289 {IDS_DRIVER_ERR_NON_REGISTERED, "Driver. No suitable drivers "
290 "registered with the CMIDriverMgr to "
291 "do work"},
292 {IDS_DRIVER_SAY_DRIVER_USING, "Driver. Using driver '%s' internally"},
293 {IDS_DRIVER_ERR_ID_INVALID, "Driver. Driver '%s' invalid ID '%s'"},
294 {IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR,
295 "Driver. Fall through driver '%s' (ID:'%s') error '%s'"},
296 {IDS_DRIVER_CMD_RECEIVED,
297 "Driver. Received command '%s'. It was %shandled%s"},
298 {IDS_DRIVER_CMD_NOT_IN_FACTORY,
299 ". Command '%s' not in Command Factory"},
300 {
301 IDS_DRIVER_ERR_DRIVER_STATE_ERROR,
302 "Driver. Driver running state error. Cannot go to next state from "
303 "present state as not allowed",
304 },
305 {IDS_DRIVER_WAITING_STDIN_DATA, "Driver. Main thread suspended waiting "
306 "on Stdin Monitor to resume main "
307 "thread"},
308 {IDS_DRIVER_ERR_MAINLOOP, "Driver. Error in do main loop. %s"},
309 {IDS_DRIVER_ERR_LOCAL_DEBUG_NOT_IMPL, "Driver. --executable argument "
310 "given. Local debugging is not "
311 "implemented."},
312 {IDS_DRIVER_ERR_LOCAL_DEBUG_INIT, "Driver. --executable argument "
313 "given. Initialising local debugging "
314 "failed."},
315 {IDS_STDERR_ERR_NOT_ALL_DATA_WRITTEN,
316 "Stderr. Not all data was written to stream. The data '%s'"},
317 {IDS_CMD_ARGS_ERR_OPTION_NOT_FOUND,
318 "Command Args. Option '%s' not found"},
319 {IDS_CMD_ARGS_ERR_VALIDATION_MANDATORY, "Mandatory args not found: %s"},
320 {IDS_CMD_ARGS_ERR_VALIDATION_INVALID, "Invalid args: %s"},
321 {IDS_CMD_ARGS_ERR_VALIDATION_MAN_INVALID,
322 "Mandatory args not found: %s. Invalid args: %s"},
323 {IDS_CMD_ARGS_ERR_VALIDATION_MISSING_INF,
324 "Args missing additional information: %s"},
325 {IDS_CMD_ARGS_ERR_CONTEXT_NOT_ALL_EATTEN,
326 "Not all arguments or options were recognised: %s"},
327 {IDS_CMD_ARGS_ERR_PREFIX_MSG, "Command Args. Validation failed. "},
328 {IDS_VARIANT_ERR_USED_BASECLASS, "Variant container: Variant object "
329 "used the base class. See "
330 "CMIUtilVariant"},
331 {IDS_VARIANT_ERR_MAP_KEY_INVALID, "Variant container: Invalid ID '%s'"},
332 {IDS_WORD_INVALIDBRKTS, "<Invalid>"},
333 {IDS_WORD_NONE, "None"},
334 {IDS_WORD_NOT, "not"},
335 {IDS_WORD_INVALIDEMPTY, "<empty>"},
336 {IDS_WORD_INVALIDNULLPTR, "<NULL ptr>"},
337 {IDS_WORD_UNKNOWNBRKTS, "<unknown>"},
338 {IDS_WORD_NOT_IMPLEMENTED, "Not implemented"},
339 {IDS_WORD_NOT_IMPLEMENTED_BRKTS, "<not implemented>"},
340 {IDS_WORD_UNKNOWNTYPE_BRKTS, "<unknowntype>"},
341 {IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS,
342 "<error message not implemented>"},
343 {IDS_CMD_ERR_N_OPTIONS_REQUIRED,
344 "Command '%s'. Missing options, %d required"},
345 {IDS_CMD_ERR_OPTION_NOT_FOUND, "Command '%s'. Option '%s' not found"},
346 {IDS_CMD_ERR_ARGS, "Command '%s'. %s"},
347 {IDS_CMD_WRN_ARGS_NOT_HANDLED, "Command '%s'. Warning the following "
348 "options not handled by the command: "
349 "%s"},
350 {IDS_CMD_ERR_FNFAILED, "Command '%s'. Fn '%s' failed"},
351 {IDS_CMD_ERR_SHARED_DATA_NOT_FOUND,
352 "Command '%s'. Shared data '%s' not found"},
353 {IDS_CMD_ERR_LLDBPROCESS_DETACH,
354 "Command '%s'. Process detach failed. '%s'"},
355 {IDS_CMD_ERR_LLDBPROCESS_DESTROY,
356 "Command '%s'. Process destroy failed. '%s'"},
357 {IDS_CMD_ERR_SETWKDIR,
358 "Command '%s'. Failed to set working directory '%s'"},
359 {IDS_CMD_ERR_INVALID_TARGET,
360 "Command '%s'. Target binary '%s' is invalid. %s"},
361 {IDS_CMD_ERR_INVALID_TARGET_CURRENT,
362 "Command '%s'. Current SBTarget is invalid"},
363 {IDS_CMD_ERR_INVALID_TARGET_TYPE,
364 "Command '%s'. Target type '%s' is not recognised"},
365 {IDS_CMD_ERR_INVALID_TARGET_PLUGIN,
366 "Command '%s'. Target plugin is invalid. %s"},
367 {IDS_CMD_ERR_CONNECT_TO_TARGET,
368 "Command '%s'. Error connecting to target: '%s'"},
369 {IDS_CMD_ERR_INVALID_TARGETPLUGINCURRENT,
370 "Command '%s'. Current target plugin is invalid"},
371 {IDS_CMD_ERR_NOT_IMPLEMENTED, "Command '%s'. Command not implemented"},
372 {IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED,
373 "Command '%s'. Command not implemented as it has been deprecated"},
374 {IDS_CMD_ERR_CREATE_TARGET, "Command '%s'. Create target failed: %s"},
375 {IDS_CMD_ERR_BRKPT_LOCATION_FORMAT,
376 "Command '%s'. Incorrect format for breakpoint location '%s'"},
377 {IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND,
378 "Command '%s'. Breakpoint location '%s' not found"},
379 {IDS_CMD_ERR_BRKPT_INVALID, "Command '%s'. Breakpoint '%s' invalid"},
380 {IDS_CMD_ERR_BRKPT_CNT_EXCEEDED, "Command '%s'. Number of valid "
381 "breakpoint exceeded %d. Cannot "
382 "create new breakpoint '%s'"},
383 {IDS_CMD_ERR_SOME_ERROR, "Command '%s'. Error: %s"},
384 {IDS_CMD_ERR_THREAD_INVALID, "Command '%s'. Thread ID invalid"},
385 {IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID,
386 "Command '%s'. Thread frame range invalid"},
387 {IDS_CMD_ERR_FRAME_INVALID, "Command '%s'. Frame ID invalid"},
388 {IDS_CMD_ERR_VARIABLE_DOESNOTEXIST,
389 "Command '%s'. Variable '%s' does not exist"},
390 {IDS_CMD_ERR_VARIABLE_ENUM_INVALID, "Command '%s'. Invalid enumeration "
391 "for variable '%s' formatted "
392 "string '%s'"},
393 {IDS_CMD_ERR_VARIABLE_EXPRESSIONPATH,
394 "Command '%s'. Failed to get expression for variable '%s'"},
395 {IDS_CMD_ERR_VARIABLE_CREATION_FAILED,
396 "Failed to create variable object for '%s'"},
397 {IDS_CMD_ERR_VARIABLE_CHILD_RANGE_INVALID,
398 "Command '%s'. Variable children range invalid"},
399 {IDS_CMD_ERR_CMD_RUN_BUT_NO_ACTION, "<Error: Command run but command "
400 "did not do anything useful. No MI "
401 "response formed>"},
402 {IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION,
403 "<Error: Command run and event caught, did nothing useful. No MI "
404 "Out-of-Bound formed>"},
405 {IDS_CMD_ERR_DISASM_ADDR_START_INVALID,
406 "Command '%s'. Invalid start value '%s'"},
407 {IDS_CMD_ERR_DISASM_ADDR_END_INVALID,
408 "Command '%s'. Invalid end value '%s'"},
409 {IDS_CMD_ERR_MEMORY_ALLOC_FAILURE,
410 "Command '%s'. Failed to allocate memory %d bytes"},
411 {IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK,
412 "Command '%s'. LLDB unable to read entire memory block of %u bytes at "
413 "address 0x%016" PRIx64},
414 {IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to read "
415 "memory block of %u bytes at "
416 "address 0x%016" PRIx64 ": %s "},
417 {IDS_CMD_ERR_INVALID_PROCESS,
418 "Command '%s'. Invalid process during debug session"},
419 {IDS_CMD_ERR_INVALID_PRINT_VALUES,
420 "Command '%s'. Unknown value for PRINT_VALUES: must be: 0 or "
421 "\"--no-values\", 1 or \"--all-values\", 2 or \"--simple-values\""},
422 {IDS_CMD_ERR_INVALID_LOCATION_FORMAT,
423 "Command '%s'. Invalid location format '%s'"},
424 {IDS_CMD_ERR_INVALID_FORMAT_TYPE,
425 "Command '%s'. Invalid var format type '%s'"},
426 {IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND,
427 "Command '%s'. Breakpoint information for breakpoint ID %d not found"},
428 {IDS_CMD_ERR_LLDB_ERR_WRITE_MEM_BYTES, "Command '%s'. Unable to write "
429 "memory block of %u bytes at "
430 "address 0x%016" PRIx64 ": %s "},
431 {IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK,
432 "Command '%s'. LLDB unable to write entire memory block of %u bytes "
433 "at address 0x%016" PRIX64},
434 {IDS_CMD_ERR_SET_NEW_DRIVER_STATE, "Command '%s'. Command tried to set "
435 "new MI Driver running state and "
436 "failed. %s"},
437 {IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND,
438 "The request '%s' was not recognised, not implemented"},
439 {IDS_CMD_ERR_INFO_PRINTFN_FAILED, "The request '%s' failed."},
440 {IDS_CMD_ERR_GDBSET_OPT_TARGETASYNC,
441 "'target-async' expects \"on\" or \"off\""},
442 {IDS_CMD_ERR_GDBSET_OPT_BREAKPOINT,
443 "'breakpoint' expects \"pending on\" or \"pending off\""},
444 {IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH,
445 "'solib-search-path' requires at least one argument"},
446 {IDS_CMD_ERR_GDBSET_OPT_PRINT_BAD_ARGS,
447 "'print' expects option-name and \"on\" or \"off\""},
448 {IDS_CMD_ERR_GDBSET_OPT_PRINT_UNKNOWN_OPTION,
449 "'print' error. The option '%s' not found"},
450 {IDS_CMD_ERR_GDBSHOW_OPT_PRINT_BAD_ARGS,
451 "'print' expects option-name and \"on\" or \"off\""},
452 {IDS_CMD_ERR_GDBSHOW_OPT_PRINT_UNKNOWN_OPTION,
453 "'print' error. The option '%s' not found"},
454 {IDS_CMD_ERR_GDBSHOW_OPT_BREAKPOINT_BAD_ARGS,
455 "'breakpoint' expects option-name"},
456 {IDS_CMD_ERR_GDBSHOW_OPT_BREAKPOINT_UNKNOWN_OPTION,
457 "'breakpoint' error. The option '%s' not found"},
458 {IDS_CMD_ERR_EXPR_INVALID, "Failed to evaluate expression: %s"},
459 {IDS_CMD_ERR_ATTACH_FAILED,
460 "Command '%s'. Attach to process failed: %s"},
461 {IDS_CMD_ERR_ATTACH_BAD_ARGS,
462 "Command '%s'. Must specify either a PID or a Name"}};
463
464 //++
465 //------------------------------------------------------------------------------------
466 // Details: CMICmnResources constructor.
467 // Type: Method.
468 // Args: None.
469 // Return: None.
470 // Throws: None.
471 //--
CMICmnResources()472 CMICmnResources::CMICmnResources() : m_nResourceId2TextDataSize(0) {
473 // Do not use this constructor, use Initialize()
474 }
475
476 //++
477 //------------------------------------------------------------------------------------
478 // Details: CMICmnResources destructor.
479 // Type: Overridden.
480 // Args: None.
481 // Return: None.
482 // Throws: None.
483 //--
~CMICmnResources()484 CMICmnResources::~CMICmnResources() {
485 // Do not use this destructor, use Shutdown()
486 }
487
488 //++
489 //------------------------------------------------------------------------------------
490 // Details: Initialize the resources and set locality for the server.
491 // Type: Method.
492 // Args: None.
493 // Return: MIstatus::success - Functional succeeded.
494 // MIstatus::failure - Functional failed.
495 // Throws: None.
496 //--
Initialize()497 bool CMICmnResources::Initialize() {
498 m_clientUsageRefCnt++;
499
500 if (m_bInitialized)
501 return MIstatus::success;
502
503 m_bInitialized = ReadResourceStringData();
504
505 return m_bInitialized;
506 }
507
508 //++
509 //------------------------------------------------------------------------------------
510 // Details: Release resources for *this object.
511 // Type: Method.
512 // Args: None.
513 // Return: MIstatus::success - Functional succeeded.
514 // MIstatus::failure - Functional failed.
515 // Throws: None.
516 //--
Shutdown()517 bool CMICmnResources::Shutdown() {
518 if (--m_clientUsageRefCnt > 0)
519 return MIstatus::success;
520
521 if (!m_bInitialized)
522 return MIstatus::success;
523
524 // Tear down resource explicitly
525 m_mapRscrIdToTextData.clear();
526
527 m_bInitialized = false;
528
529 return MIstatus::success;
530 }
531
532 //++
533 //------------------------------------------------------------------------------------
534 // Details: Initialize the resources and set locality for the server.
535 // Type: Method.
536 // Args: None.
537 // Return: MIstatus::success - Functional succeeded.
538 // MIstatus::failure - Functional failed.
539 // Throws: None.
540 //--
ReadResourceStringData()541 bool CMICmnResources::ReadResourceStringData() {
542 m_nResourceId2TextDataSize =
543 sizeof ms_pResourceId2TextData / sizeof ms_pResourceId2TextData[0];
544 for (MIuint i = 0; i < m_nResourceId2TextDataSize; i++) {
545 const SRsrcTextData *pRscrData = &ms_pResourceId2TextData[i];
546 MapPairRscrIdToTextData_t pr(pRscrData->id, pRscrData->pTextData);
547 m_mapRscrIdToTextData.insert(pr);
548 }
549
550 return MIstatus::success;
551 }
552
553 //++
554 //------------------------------------------------------------------------------------
555 // Details: Retrieve the corresponding text assigned to the resource ID.
556 // Type: Method.
557 // Args: vResourceId - (R) MI resource ID.
558 // Return: CMIUtilString - Resource text.
559 // Throws: None.
560 //--
GetString(const MIuint vResourceId) const561 CMIUtilString CMICmnResources::GetString(const MIuint vResourceId) const {
562 CMIUtilString str;
563 const bool bFound = GetStringFromResource(vResourceId, str);
564 MIunused(bFound);
565 assert(bFound);
566
567 return str;
568 }
569
570 //++
571 //------------------------------------------------------------------------------------
572 // Details: Determine the MI resource ID existings.
573 // Type: Method.
574 // Args: vResourceId - (R) MI resource ID.
575 // Return: True - Exists.
576 // False - Not found.
577 // Throws: None.
578 //--
HasString(const MIuint vResourceId) const579 bool CMICmnResources::HasString(const MIuint vResourceId) const {
580 CMIUtilString str;
581 return GetStringFromResource(vResourceId, str);
582 }
583
584 //++
585 //------------------------------------------------------------------------------------
586 // Details: Retrieve the resource text data for the given resource ID. If a
587 // resource ID
588 // cannot be found and error is given returning the ID of the resource
589 // that
590 // cannot be located.
591 // Type: Method.
592 // Args: vResourceId - (R) MI resource ID.
593 // vrwResourceString - (W) Text.
594 // Return: MIstatus::success - Functional succeeded.
595 // MIstatus::failure - Functional failed.
596 // Throws: None.
597 //--
GetStringFromResource(const MIuint vResourceId,CMIUtilString & vrwResourceString) const598 bool CMICmnResources::GetStringFromResource(
599 const MIuint vResourceId, CMIUtilString &vrwResourceString) const {
600 MapRscrIdToTextData_t::const_iterator it =
601 m_mapRscrIdToTextData.find(vResourceId);
602 if (it == m_mapRscrIdToTextData.end()) {
603 // Check this is a static variable init that needs this before we are ready
604 if (!m_bInitialized) {
605 (const_cast<CMICmnResources *>(this))->Initialize();
606 it = m_mapRscrIdToTextData.find(vResourceId);
607 if (it == m_mapRscrIdToTextData.end()) {
608 vrwResourceString = MIRSRC(IDS_RESOURCES_ERR_STRING_TABLE_INVALID);
609 return MIstatus::failure;
610 }
611 }
612
613 if (it == m_mapRscrIdToTextData.end()) {
614 vrwResourceString = CMIUtilString::Format(
615 MIRSRC(IDS_RESOURCES_ERR_STRING_NOT_FOUND), vResourceId);
616 return MIstatus::failure;
617 }
618 }
619
620 const MIuint nRsrcId((*it).first);
621 MIunused(nRsrcId);
622 const char *pRsrcData((*it).second);
623
624 // Return result
625 vrwResourceString = pRsrcData;
626
627 return MIstatus::success;
628 }
629