[Lldb-commits] [lldb] r366465 - [LLDB] Remove lldb-mi
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 18 10:06:07 PDT 2019
Removed: lldb/trunk/tools/lldb-mi/MICmnResources.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnResources.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnResources.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnResources.cpp (removed)
@@ -1,619 +0,0 @@
-//===-- MICmnResources.cpp --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third party headers
-#include "assert.h"
-#include <inttypes.h>
-
-// 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] [executable]\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_BREAKPOINT,
- "'breakpoint' expects \"pending on\" or \"pending 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_GDBSHOW_OPT_BREAKPOINT_BAD_ARGS,
- "'breakpoint' expects option-name"},
- {IDS_CMD_ERR_GDBSHOW_OPT_BREAKPOINT_UNKNOWN_OPTION,
- "'breakpoint' 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;
-}
Removed: lldb/trunk/tools/lldb-mi/MICmnResources.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnResources.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnResources.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnResources.h (removed)
@@ -1,339 +0,0 @@
-//===-- MICmnResources.h ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers
-#include <map>
-
-// In-house headers:
-#include "MICmnBase.h"
-#include "MIUtilSingletonBase.h"
-#include "MIUtilString.h"
-
-//++
-//============================================================================
-// Details: MI string test data resource definitions. These IDs match up with
-// actual string data in a map internal to CMICmnResources.
-// *** Be sure to update ms_pResourceId2TextData[] array ****
-enum {
- IDS_PROJNAME = 1,
- IDS_MI_VERSION_DESCRIPTION_DEBUG,
- IDS_MI_VERSION_DESCRIPTION,
- IDS_MI_APPNAME_SHORT,
- IDS_MI_APPNAME_LONG,
- IDS_MI_APP_FILEPATHNAME,
- IDS_MI_APP_ARGS,
- IDE_MI_VERSION_GDB,
-
- IDS_UTIL_FILE_ERR_INVALID_PATHNAME,
- IDS_UTIL_FILE_ERR_OPENING_FILE,
- IDS_UTIL_FILE_ERR_OPENING_FILE_UNKNOWN,
- IDE_UTIL_FILE_ERR_WRITING_FILE,
- IDE_UTIL_FILE_ERR_WRITING_NOTOPEN,
-
- IDS_RESOURCES_ERR_STRING_NOT_FOUND,
- IDS_RESOURCES_ERR_STRING_TABLE_INVALID,
-
- IDS_MI_CLIENT_MSG,
-
- IDS_LOG_MSG_CREATION_DATE,
- IDS_LOG_MSG_FILE_LOGGER_PATH,
- IDS_LOG_MSG_VERSION,
- IDS_LOG_ERR_FILE_LOGGER_DISABLED,
- IDS_LOG_MEDIUM_ERR_INIT,
- IDS_LOG_MEDIUM_ERR_WRITE_ANY,
- IDS_LOG_MEDIUM_ERR_WRITE_MEDIUMFAIL,
-
- IDS_MEDIUMFILE_NAME,
- IDS_MEDIUMFILE_ERR_INVALID_PATH,
- IDS_MEDIUMFILE_ERR_FILE_HEADER,
- IDS_MEDIUMFILE_NAME_LOG,
-
- IDE_OS_ERR_UNKNOWN,
- IDE_OS_ERR_RETRIEVING,
-
- IDS_DRIVERMGR_DRIVER_ERR_INIT,
-
- IDE_MEDIUMSTDERR_NAME,
- IDE_MEDIUMSTDOUT_NAME,
-
- IDE_MI_APP_DESCRIPTION,
- IDE_MI_APP_INFORMATION,
- IDE_MI_APP_ARG_USAGE,
- IDE_MI_APP_ARG_HELP,
- IDE_MI_APP_ARG_VERSION,
- IDE_MI_APP_ARG_VERSION_LONG,
- IDE_MI_APP_ARG_INTERPRETER,
- IDE_MI_APP_ARG_EXECUTEABLE,
- IDE_MI_APP_ARG_SOURCE,
- IDE_MI_APP_ARG_APP_LOG,
- IDE_MI_APP_ARG_APP_LOG_DIR,
- IDE_MI_APP_ARG_EXAMPLE,
- IDE_MI_APP_ARG_EXECUTABLE,
- IDE_MI_APP_ARG_SYNCHRONOUS,
-
- IDS_STDIN_ERR_INVALID_PROMPT,
- IDS_STDIN_ERR_THREAD_CREATION_FAILED,
- IDS_STDIN_ERR_THREAD_DELETE,
- IDS_STDIN_ERR_CHKING_BYTE_AVAILABLE,
- IDS_STDIN_INPUT_CTRL_CHARS,
-
- IDS_CMD_QUIT_HELP,
-
- IDS_THREADMGR_ERR_THREAD_ID_INVALID,
- IDS_THREADMGR_ERR_THREAD_FAIL_CREATE,
- IDS_THREADMGR_ERR_THREAD_ID_NOT_FOUND,
- IDS_THREADMGR_ERR_THREAD_STILL_ALIVE,
-
- IDS_FALLTHRU_DRIVER_CMD_RECEIVED,
-
- IDS_CMDFACTORY_ERR_INVALID_CMD_NAME,
- IDS_CMDFACTORY_ERR_INVALID_CMD_CR8FN,
- IDS_CMDFACTORY_ERR_CMD_NOT_REGISTERED,
- IDS_CMDFACTORY_ERR_CMD_ALREADY_REGED,
-
- IDS_CMDMGR_ERR_CMD_FAILED_CREATE,
- IDS_CMDMGR_ERR_CMD_INVOKER,
-
- IDS_MI_INIT_ERR_LOG,
- IDS_MI_INIT_ERR_RESOURCES,
- IDS_MI_INIT_ERR_INIT,
- IDS_MI_INIT_ERR_STREAMSTDIN,
- IDS_MI_INIT_ERR_STREAMSTDIN_OSHANDLER,
- IDS_MI_INIT_ERR_OS_STDIN_HANDLER,
- IDS_MI_INIT_ERR_STREAMSTDOUT,
- IDS_MI_INIT_ERR_STREAMSTDERR,
- IDS_MI_INIT_ERR_FALLTHRUDRIVER,
- IDS_MI_INIT_ERR_THREADMGR,
- IDS_MI_INIT_ERR_CMDINTERPRETER,
- IDS_MI_INIT_ERR_CMDMGR,
- IDS_MI_INIT_ERR_CMDFACTORY,
- IDS_MI_INIT_ERR_CMDINVOKER,
- IDS_MI_INIT_ERR_CMDMONITOR,
- IDS_MI_INIT_ERR_LLDBDEBUGGER,
- IDS_MI_INIT_ERR_DRIVERMGR,
- IDS_MI_INIT_ERR_DRIVER,
- IDS_MI_INIT_ERR_OUTOFBANDHANDLER,
- IDS_MI_INIT_ERR_DEBUGSESSIONINFO,
- IDS_MI_INIT_ERR_THREADMANAGER,
- IDS_MI_INIT_ERR_CLIENT_USING_DRIVER,
- IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION,
-
- IDS_CODE_ERR_INVALID_PARAMETER_VALUE,
- IDS_CODE_ERR_INVALID_PARAM_NULL_POINTER,
- IDS_CODE_ERR_INVALID_ENUMERATION_VALUE,
-
- IDS_LLDBDEBUGGER_ERR_INVALIDLISTENER,
- IDS_LLDBDEBUGGER_ERR_INVALIDDEBUGGER,
- IDS_LLDBDEBUGGER_ERR_CLIENTDRIVER,
- IDS_LLDBDEBUGGER_ERR_STARTLISTENER,
- IDS_LLDBDEBUGGER_ERR_THREADCREATIONFAIL,
- IDS_LLDBDEBUGGER_ERR_THREAD_DELETE,
- IDS_LLDBDEBUGGER_ERR_INVALIDBROADCASTER,
- IDS_LLDBDEBUGGER_ERR_INVALIDCLIENTNAME,
- IDS_LLDBDEBUGGER_ERR_CLIENTNOTREGISTERED,
- IDS_LLDBDEBUGGER_ERR_STOPLISTENER,
- IDS_LLDBDEBUGGER_ERR_BROADCASTER_NAME,
- IDS_LLDBDEBUGGER_WRN_UNKNOWN_EVENT,
-
- IDS_LLDBOUTOFBAND_ERR_UNKNOWN_EVENT,
- IDS_LLDBOUTOFBAND_ERR_PROCESS_INVALID,
- IDS_LLDBOUTOFBAND_ERR_BRKPT_NOTFOUND,
- IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_GET,
- IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_SET,
- IDS_LLDBOUTOFBAND_ERR_FORM_MI_RESPONSE,
- IDS_LLDBOUTOFBAND_ERR_FRAME_INFO_GET,
- IDS_LLDBOUTOFBAND_ERR_SETNEWDRIVERSTATE,
- IDS_LLDBOUTOFBAND_ERR_BRKPT_CNT_EXCEEDED,
-
- IDS_DBGSESSION_ERR_SHARED_DATA_ADD,
-
- IDS_MI_SHTDWN_ERR_LOG,
- IDS_MI_SHUTDOWN_ERR,
- IDE_MI_SHTDWN_ERR_RESOURCES,
- IDE_MI_SHTDWN_ERR_STREAMSTDIN,
- IDS_MI_SHTDWN_ERR_OS_STDIN_HANDLER,
- IDS_MI_SHTDWN_ERR_STREAMSTDOUT,
- IDS_MI_SHTDWN_ERR_STREAMSTDERR,
- IDS_MI_SHTDWN_ERR_THREADMGR,
- IDS_MI_SHTDWN_ERR_CMDINTERPRETER,
- IDS_MI_SHTDWN_ERR_CMDMGR,
- IDS_MI_SHTDWN_ERR_CMDFACTORY,
- IDS_MI_SHTDWN_ERR_CMDINVOKER,
- IDS_MI_SHTDWN_ERR_CMDMONITOR,
- IDS_MI_SHTDWN_ERR_LLDBDEBUGGER,
- IDS_MI_SHTDWN_ERR_DRIVERMGR,
- IDS_MI_SHTDWN_ERR_DRIVER,
- IDS_MI_SHTDWN_ERR_OUTOFBANDHANDLER,
- IDS_MI_SHTDWN_ERR_DEBUGSESSIONINFO,
- IDE_MI_SHTDWN_ERR_THREADMANAGER,
-
- IDS_DRIVER_ERR_PARSE_ARGS,
- IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN,
- IDS_DRIVER_ERR_CURRENT_NOT_SET,
- IDS_DRIVER_ERR_NON_REGISTERED,
- IDS_DRIVER_SAY_DRIVER_USING,
- IDS_DRIVER_ERR_ID_INVALID,
- IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR,
- IDS_DRIVER_CMD_RECEIVED,
- IDS_DRIVER_CMD_NOT_IN_FACTORY,
- IDS_DRIVER_ERR_DRIVER_STATE_ERROR,
- IDS_DRIVER_ERR_MAINLOOP,
- IDS_DRIVER_ERR_LOCAL_DEBUG_NOT_IMPL,
- IDS_DRIVER_ERR_LOCAL_DEBUG_INIT,
-
- IDS_DRIVER_WAITING_STDIN_DATA,
-
- IDS_STDERR_ERR_NOT_ALL_DATA_WRITTEN,
-
- IDS_CMD_ARGS_ERR_OPTION_NOT_FOUND,
- IDS_CMD_ARGS_ERR_VALIDATION_MANDATORY,
- IDS_CMD_ARGS_ERR_VALIDATION_INVALID,
- IDS_CMD_ARGS_ERR_VALIDATION_MAN_INVALID,
- IDS_CMD_ARGS_ERR_VALIDATION_MISSING_INF,
- IDS_CMD_ARGS_ERR_CONTEXT_NOT_ALL_EATTEN,
- IDS_CMD_ARGS_ERR_PREFIX_MSG,
-
- IDS_VARIANT_ERR_USED_BASECLASS,
- IDS_VARIANT_ERR_MAP_KEY_INVALID,
-
- IDS_WORD_INVALIDBRKTS,
- IDS_WORD_NONE,
- IDS_WORD_NOT,
- IDS_WORD_INVALIDEMPTY,
- IDS_WORD_INVALIDNULLPTR,
- IDS_WORD_UNKNOWNBRKTS,
- IDS_WORD_NOT_IMPLEMENTED,
- IDS_WORD_NOT_IMPLEMENTED_BRKTS,
- IDS_WORD_UNKNOWNTYPE_BRKTS,
- IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS,
-
- IDS_CMD_ERR_N_OPTIONS_REQUIRED,
- IDS_CMD_ERR_OPTION_NOT_FOUND,
- IDS_CMD_ERR_ARGS,
- IDS_CMD_WRN_ARGS_NOT_HANDLED,
- IDS_CMD_ERR_FNFAILED,
- IDS_CMD_ERR_SHARED_DATA_NOT_FOUND,
- IDS_CMD_ERR_LLDBPROCESS_DETACH,
- IDS_CMD_ERR_LLDBPROCESS_DESTROY,
- IDS_CMD_ERR_SETWKDIR,
- IDS_CMD_ERR_INVALID_TARGET,
- IDS_CMD_ERR_INVALID_TARGET_CURRENT,
- IDS_CMD_ERR_INVALID_TARGET_TYPE,
- IDS_CMD_ERR_INVALID_TARGET_PLUGIN,
- IDS_CMD_ERR_CONNECT_TO_TARGET,
- IDS_CMD_ERR_INVALID_TARGETPLUGINCURRENT,
- IDS_CMD_ERR_NOT_IMPLEMENTED,
- IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED,
- IDS_CMD_ERR_CREATE_TARGET,
- IDS_CMD_ERR_BRKPT_LOCATION_FORMAT,
- IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND,
- IDS_CMD_ERR_BRKPT_INVALID,
- IDS_CMD_ERR_BRKPT_CNT_EXCEEDED,
- IDS_CMD_ERR_SOME_ERROR,
- IDS_CMD_ERR_THREAD_INVALID,
- IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID,
- IDS_CMD_ERR_FRAME_INVALID,
- IDS_CMD_ERR_VARIABLE_DOESNOTEXIST,
- IDS_CMD_ERR_VARIABLE_ENUM_INVALID,
- IDS_CMD_ERR_VARIABLE_EXPRESSIONPATH,
- IDS_CMD_ERR_VARIABLE_CREATION_FAILED,
- IDS_CMD_ERR_VARIABLE_CHILD_RANGE_INVALID,
- IDS_CMD_ERR_CMD_RUN_BUT_NO_ACTION,
- IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION,
- IDS_CMD_ERR_DISASM_ADDR_START_INVALID,
- IDS_CMD_ERR_DISASM_ADDR_END_INVALID,
- IDS_CMD_ERR_MEMORY_ALLOC_FAILURE,
- IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK,
- IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES,
- IDS_CMD_ERR_INVALID_PROCESS,
- IDS_CMD_ERR_INVALID_PRINT_VALUES,
- IDS_CMD_ERR_INVALID_LOCATION_FORMAT,
- IDS_CMD_ERR_INVALID_FORMAT_TYPE,
- IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND,
- IDS_CMD_ERR_LLDB_ERR_WRITE_MEM_BYTES,
- IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK,
- IDS_CMD_ERR_SET_NEW_DRIVER_STATE,
- IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND,
- IDS_CMD_ERR_INFO_PRINTFN_FAILED,
- IDS_CMD_ERR_GDBSET_OPT_TARGETASYNC,
- IDS_CMD_ERR_GDBSET_OPT_BREAKPOINT,
- IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH,
- IDS_CMD_ERR_GDBSET_OPT_PRINT_BAD_ARGS,
- IDS_CMD_ERR_GDBSET_OPT_PRINT_UNKNOWN_OPTION,
- IDS_CMD_ERR_GDBSHOW_OPT_PRINT_BAD_ARGS,
- IDS_CMD_ERR_GDBSHOW_OPT_PRINT_UNKNOWN_OPTION,
- IDS_CMD_ERR_GDBSHOW_OPT_BREAKPOINT_BAD_ARGS,
- IDS_CMD_ERR_GDBSHOW_OPT_BREAKPOINT_UNKNOWN_OPTION,
- IDS_CMD_ERR_EXPR_INVALID,
- IDS_CMD_ERR_ATTACH_FAILED,
- IDS_CMD_ERR_ATTACH_BAD_ARGS
-};
-
-//++
-//============================================================================
-// Details: MI common code implementation class. Handle application resources
-// and locality.
-// Singleton class.
-//--
-class CMICmnResources : public CMICmnBase,
- public MI::ISingleton<CMICmnResources> {
- friend class MI::ISingleton<CMICmnResources>;
-
- // Methods:
-public:
- bool Initialize() override;
- bool Shutdown() override;
-
- CMIUtilString GetString(const MIuint vResourceId) const;
- bool HasString(const MIuint vResourceId) const;
-
- // Typedef:
-private:
- typedef std::map<MIuint, const char *> MapRscrIdToTextData_t;
- typedef std::pair<MIuint, const char *> MapPairRscrIdToTextData_t;
-
- // Enumerations:
-private:
- enum Buffer_e { eBufferSize = 2048 };
-
- // Structs:
-private:
- struct SRsrcTextData {
- MIuint id;
- const char *pTextData;
- };
-
- // Methods:
-private:
- /* ctor */ CMICmnResources();
- /* ctor */ CMICmnResources(const CMICmnResources &);
- void operator=(const CMICmnResources &);
-
- bool GetStringFromResource(const MIuint vResourceId,
- CMIUtilString &vrwResourceString) const;
- bool ReadResourceStringData();
-
- // Overridden:
-private:
- // From CMICmnBase
- /* dtor */ ~CMICmnResources() override;
-
- // Attributes:
-private:
- static const SRsrcTextData ms_pResourceId2TextData[];
- //
- MIuint m_nResourceId2TextDataSize;
- MapRscrIdToTextData_t m_mapRscrIdToTextData;
-};
-
-//++ =========================================================================
-// Details: Macro short cut for retrieving a text data resource
-//--
-#define MIRSRC(x) CMICmnResources::Instance().GetString(x).c_str()
Removed: lldb/trunk/tools/lldb-mi/MICmnStreamStderr.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStderr.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStderr.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStderr.cpp (removed)
@@ -1,249 +0,0 @@
-//===-- MICmnStreamStderr.cpp ------------------------------------*- C++
-//-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmnStreamStderr.h"
-#include "MICmnLog.h"
-#include "MICmnResources.h"
-#include "MIDriver.h"
-
-//++
-// Details: CMICmnStreamStderr constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmnStreamStderr::CMICmnStreamStderr() {}
-
-//++
-// Details: CMICmnStreamStderr destructor.
-// Type: Overridable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmnStreamStderr::~CMICmnStreamStderr() { Shutdown(); }
-
-//++
-// Details: Initialize resources for *this stderr stream.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::Initialize() {
- m_clientUsageRefCnt++;
-
- if (m_bInitialized)
- return MIstatus::success;
-
- bool bOk = MIstatus::success;
-
-#ifdef _MSC_VER
-// Debugging / I/O issues with client.
-// This is only required on Windows if you do not use ::flush(stderr). MI uses
-// ::flush(stderr)
-// It trys to ensure the process attached to the stderr steam gets ALL the data.
-//::setbuf( stderr, NULL );
-#endif // _MSC_VER
-
- m_bInitialized = bOk;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Release resources for *this stderr stream.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::Shutdown() {
- if (--m_clientUsageRefCnt > 0)
- return MIstatus::success;
-
- if (!m_bInitialized)
- return MIstatus::success;
-
- ClrErrorDescription();
-
- m_bInitialized = false;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Write text data to stderr. Prefix the message with "MI:". The text
-// data does
-// not need to include a carriage line return as this is added to the
-// text. The
-// function also then passes the text data into the CMICmnLog logger.
-// Type: Method.
-// Args: vText - (R) Text data.
-// vbSendToLog - (R) True = Yes send to the Log file too, false = do
-// not. (Dflt = true)
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::Write(const CMIUtilString &vText,
- const bool vbSendToLog /* = true */) {
- if (vText.length() == 0)
- return MIstatus::failure;
-
- const CMIUtilString strPrefixed(CMIUtilString::Format(
- "%s: %s", CMIDriver::Instance().GetAppNameShort().c_str(),
- vText.c_str()));
-
- return WritePriv(strPrefixed, vText, vbSendToLog);
-}
-
-//++
-// Details: Write an LLDB text message to stderr.
-// The text data does not need to include a carriage line return as
-// this is added
-// to the text. The function also then passes the text data into the
-// CMICmnLog
-// logger.
-// Type: Method.
-// Args: vText - (R) Text data.
-// vbSendToLog - (R) True = Yes send to the Log file too, false = do
-// not. (Dflt = true)
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::WriteLLDBMsg(const CMIUtilString &vText,
- const bool vbSendToLog /* = true */) {
- if (vText.length() == 0)
- return MIstatus::failure;
-
- const CMIUtilString strPrefixed(
- CMIUtilString::Format("LLDB: %s", vText.c_str()));
-
- return WritePriv(vText, strPrefixed, vbSendToLog);
-}
-
-//++
-// Details: Write text data to stderr. The text data does not need to
-// include a carriage line return as this is added to the text. The
-// function also
-// then passes the text data into the CMICmnLog logger.
-// Type: Method.
-// Args: vText - (R) Text data. May be prefixed with MI app's short
-// name.
-// vTxtForLogFile - (R) Text data.
-// vbSendToLog - (R) True = Yes send to the Log file too, false =
-// do not. (Dflt = true)
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::WritePriv(const CMIUtilString &vText,
- const CMIUtilString &vTxtForLogFile,
- const bool vbSendToLog /* = true */) {
- if (vText.length() == 0)
- return MIstatus::failure;
-
- bool bOk = MIstatus::success;
- {
- // Grab the stderr thread lock while we print
- CMIUtilThreadLock _lock(m_mutex);
-
- // Send this text to stderr
- const MIint status = ::fputs(vText.c_str(), stderr);
- if (status == EOF) {
- const CMIUtilString errMsg(CMIUtilString::Format(
- MIRSRC(IDS_STDERR_ERR_NOT_ALL_DATA_WRITTEN), vText.c_str()));
- SetErrorDescription(errMsg);
- bOk = MIstatus::failure;
- } else {
- ::fprintf(stderr, "\n");
- ::fflush(stderr);
- }
-
- // Send this text to the log
- if (bOk && vbSendToLog)
- bOk &= m_pLog->WriteLog(vTxtForLogFile);
- }
-
- return bOk;
-}
-
-//++
-// Details: Lock the availability of the stream stderr. Other users of *this
-// stream will
-// be stalled until it is available (Unlock()).
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::Lock() {
- m_mutex.Lock();
- return MIstatus::success;
-}
-
-//++
-// Details: Release a previously locked stderr.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::Unlock() {
- m_mutex.Unlock();
- return MIstatus::success;
-}
-
-//++
-// Details: Take MI Driver text message and send to the stderr stream. Also
-// output to the
-// MI Log file.
-// Type: Static method.
-// Args: vrTxt - (R) Text.
-// Return: MIstatus::success - Functionality succeeded.
-// MIstatus::failure - Functionality failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::TextToStderr(const CMIUtilString &vrTxt) {
- const bool bLock = CMICmnStreamStderr::Instance().Lock();
- const bool bOk = bLock && CMICmnStreamStderr::Instance().Write(vrTxt);
- bLock &&CMICmnStreamStderr::Instance().Unlock();
-
- return bOk;
-}
-
-//++
-// Details: Take an LLDB message and send to the stderr stream. The message is
-// not always
-// an error message. The user has typed a command in to the Eclipse
-// console (by-
-// passing Eclipse) and this is the result message from LLDB back to
-// the user.
-// Also output to the MI Log file.
-// Type: Static method.
-// Args: vrTxt - (R) Text.
-// Return: MIstatus::success - Functionality succeeded.
-// MIstatus::failure - Functionality failed.
-// Throws: None.
-//--
-bool CMICmnStreamStderr::LLDBMsgToConsole(const CMIUtilString &vrTxt) {
- const bool bLock = CMICmnStreamStderr::Instance().Lock();
- const bool bOk = bLock && CMICmnStreamStderr::Instance().WriteLLDBMsg(vrTxt);
- bLock &&CMICmnStreamStderr::Instance().Unlock();
-
- return bOk;
-}
Removed: lldb/trunk/tools/lldb-mi/MICmnStreamStderr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStderr.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStderr.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStderr.h (removed)
@@ -1,61 +0,0 @@
-//===-- MICmnStreamStderr.h -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmnBase.h"
-#include "MIUtilSingletonBase.h"
-#include "MIUtilString.h"
-#include "MIUtilThreadBaseStd.h"
-
-//++
-//============================================================================
-// Details: MI common code class. The MI driver requires this object.
-// CMICmnStreamStderr sets up and tears downs stderr for the driver.
-//
-// Singleton class.
-//--
-class CMICmnStreamStderr : public CMICmnBase,
- public MI::ISingleton<CMICmnStreamStderr> {
- friend class MI::ISingleton<CMICmnStreamStderr>;
-
- // Statics:
-public:
- static bool TextToStderr(const CMIUtilString &vrTxt);
- static bool LLDBMsgToConsole(const CMIUtilString &vrTxt);
-
- // Methods:
-public:
- bool Initialize() override;
- bool Shutdown() override;
- //
- bool Lock();
- bool Unlock();
- bool Write(const CMIUtilString &vText, const bool vbSendToLog = true);
- bool WriteLLDBMsg(const CMIUtilString &vText, const bool vbSendToLog = true);
-
- // Methods:
-private:
- /* ctor */ CMICmnStreamStderr();
- /* ctor */ CMICmnStreamStderr(const CMICmnStreamStderr &);
- void operator=(const CMICmnStreamStderr &);
- //
- bool WritePriv(const CMIUtilString &vText,
- const CMIUtilString &vTxtForLogFile,
- const bool vbSendToLog = true);
-
- // Overridden:
-private:
- // From CMICmnBase
- /* dtor */ ~CMICmnStreamStderr() override;
-
- // Attributes:
-private:
- CMIUtilThreadMutex m_mutex; // Mutex object for sync during Write()
-};
Removed: lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp (removed)
@@ -1,218 +0,0 @@
-//===-- MICmnStreamStdin.cpp ------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third Party Headers
-#ifdef _MSC_VER
-#include <windows.h>
-#endif
-#include <string.h>
-
-// In-house headers:
-#include "MICmnLog.h"
-#include "MICmnResources.h"
-#include "MICmnStreamStdin.h"
-#include "MICmnStreamStdout.h"
-#include "MIDriver.h"
-#include "MIUtilSingletonHelper.h"
-
-//++
-// Details: CMICmnStreamStdin constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmnStreamStdin::CMICmnStreamStdin()
- : m_strPromptCurrent("(gdb)"), m_bShowPrompt(true), m_pCmdBuffer(nullptr) {}
-
-//++
-// Details: CMICmnStreamStdin destructor.
-// Type: Overridable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmnStreamStdin::~CMICmnStreamStdin() { Shutdown(); }
-
-//++
-// Details: Initialize resources for *this Stdin stream.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdin::Initialize() {
- m_clientUsageRefCnt++;
-
- if (m_bInitialized)
- return MIstatus::success;
-
- bool bOk = MIstatus::success;
- CMIUtilString errMsg;
-
- // Note initialisation order is important here as some resources depend on
- // previous
- MI::ModuleInit<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
- MI::ModuleInit<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
-
- if (bOk) {
- m_pCmdBuffer = new char[m_constBufferSize];
- } else {
- CMIUtilString strInitError(CMIUtilString::Format(
- MIRSRC(IDS_MI_INIT_ERR_STREAMSTDIN), errMsg.c_str()));
- SetErrorDescription(strInitError);
-
- return MIstatus::failure;
- }
- m_bInitialized = bOk;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Release resources for *this Stdin stream.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdin::Shutdown() {
- if (--m_clientUsageRefCnt > 0)
- return MIstatus::success;
-
- if (!m_bInitialized)
- return MIstatus::success;
-
- m_bInitialized = false;
-
- ClrErrorDescription();
-
- if (m_pCmdBuffer != nullptr) {
- delete[] m_pCmdBuffer;
- m_pCmdBuffer = nullptr;
- }
-
- bool bOk = MIstatus::success;
- CMIUtilString errMsg;
-
- MI::ModuleShutdown<CMICmnResources>(IDE_MI_SHTDWN_ERR_RESOURCES, bOk, errMsg);
- MI::ModuleShutdown<CMICmnLog>(IDS_MI_SHTDWN_ERR_LOG, bOk, errMsg);
-
- if (!bOk) {
- SetErrorDescriptionn(MIRSRC(IDE_MI_SHTDWN_ERR_STREAMSTDIN), errMsg.c_str());
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Validate and set the text that forms the prompt on the command line.
-// Type: Method.
-// Args: vNewPrompt - (R) Text description.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdin::SetPrompt(const CMIUtilString &vNewPrompt) {
- if (vNewPrompt.empty()) {
- const CMIUtilString msg(CMIUtilString::Format(
- MIRSRC(IDS_STDIN_ERR_INVALID_PROMPT), vNewPrompt.c_str()));
- CMICmnStreamStdout::Instance().Write(msg);
- return MIstatus::failure;
- }
-
- m_strPromptCurrent = vNewPrompt;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Retrieve the command line prompt text currently being used.
-// Type: Method.
-// Args: None.
-// Return: const CMIUtilString & - Functional failed.
-// Throws: None.
-//--
-const CMIUtilString &CMICmnStreamStdin::GetPrompt() const {
- return m_strPromptCurrent;
-}
-
-//++
-// Details: Set whether to display optional command line prompt. The prompt is
-// output to
-// stdout. Disable it when this may interfere with the client reading
-// stdout as
-// input and it tries to interpret the prompt text to.
-// Type: Method.
-// Args: vbYes - (R) True = Yes prompt is shown/output to the user
-// (stdout), false = no prompt.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-void CMICmnStreamStdin::SetEnablePrompt(const bool vbYes) {
- m_bShowPrompt = vbYes;
-}
-
-//++
-// Details: Get whether to display optional command line prompt. The prompt is
-// output to
-// stdout. Disable it when this may interfere with the client reading
-// stdout as
-// input and it tries to interpret the prompt text to.
-// Type: Method.
-// Args: None.
-// Return: bool - True = Yes prompt is shown/output to the user (stdout), false
-// = no prompt.
-// Throws: None.
-//--
-bool CMICmnStreamStdin::GetEnablePrompt() const { return m_bShowPrompt; }
-
-//++
-// Details: Wait on new line of data from stdin stream (completed by '\n' or
-// '\r').
-// Type: Method.
-// Args: vwErrMsg - (W) Empty string ok or error description.
-// Return: char * - text buffer pointer or NULL on failure.
-// Throws: None.
-//--
-const char *CMICmnStreamStdin::ReadLine(CMIUtilString &vwErrMsg) {
- vwErrMsg.clear();
-
- // Read user input
- const char *pText = ::fgets(&m_pCmdBuffer[0], m_constBufferSize, stdin);
- if (pText == nullptr) {
-#ifdef _MSC_VER
- // Was Ctrl-C hit?
- // On Windows, Ctrl-C gives an ERROR_OPERATION_ABORTED as error on the
- // command-line.
- // The end-of-file indicator is also set, so without this check we will exit
- // next if statement.
- if (::GetLastError() == ERROR_OPERATION_ABORTED)
- return nullptr;
-#endif
- if (::feof(stdin)) {
- const bool bForceExit = true;
- CMIDriver::Instance().SetExitApplicationFlag(bForceExit);
- } else if (::ferror(stdin) != 0)
- vwErrMsg = ::strerror(errno);
- return nullptr;
- }
-
- // Strip off new line characters
- for (char *pI = m_pCmdBuffer; *pI != '\0'; pI++) {
- if ((*pI == '\n') || (*pI == '\r')) {
- *pI = '\0';
- break;
- }
- }
-
- return pText;
-}
Removed: lldb/trunk/tools/lldb-mi/MICmnStreamStdin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdin.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdin.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdin.h (removed)
@@ -1,60 +0,0 @@
-//===-- MICmnStreamStdin.h --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmnBase.h"
-#include "MIUtilSingletonBase.h"
-#include "MIUtilString.h"
-#include "MIUtilThreadBaseStd.h"
-
-//++
-//============================================================================
-// Details: MI common code class. Used to handle stream data from Stdin.
-// Singleton class using the Visitor pattern. A driver using the
-// interface
-// provide can receive callbacks when a new line of data is received.
-// Each line is determined by a carriage return.
-// A singleton class.
-//--
-class CMICmnStreamStdin : public CMICmnBase,
- public MI::ISingleton<CMICmnStreamStdin> {
- // Give singleton access to private constructors
- friend MI::ISingleton<CMICmnStreamStdin>;
-
- // Methods:
-public:
- bool Initialize() override;
- bool Shutdown() override;
- //
- const CMIUtilString &GetPrompt() const;
- bool SetPrompt(const CMIUtilString &vNewPrompt);
- void SetEnablePrompt(const bool vbYes);
- bool GetEnablePrompt() const;
- const char *ReadLine(CMIUtilString &vwErrMsg);
-
- // Methods:
-private:
- /* ctor */ CMICmnStreamStdin();
- /* ctor */ CMICmnStreamStdin(const CMICmnStreamStdin &);
- void operator=(const CMICmnStreamStdin &);
-
- // Overridden:
-private:
- // From CMICmnBase
- /* dtor */ ~CMICmnStreamStdin() override;
-
- // Attributes:
-private:
- CMIUtilString m_strPromptCurrent; // Command line prompt as shown to the user
- bool m_bShowPrompt; // True = Yes prompt is shown/output to the user (stdout),
- // false = no prompt
- static const int m_constBufferSize = 2048;
- char *m_pCmdBuffer;
-};
Removed: lldb/trunk/tools/lldb-mi/MICmnStreamStdout.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdout.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdout.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdout.cpp (removed)
@@ -1,230 +0,0 @@
-//===-- MICmnStreamStdout.cpp -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmnStreamStdout.h"
-#include "MICmnLog.h"
-#include "MICmnResources.h"
-#include "MIDriver.h"
-
-//++
-// Details: CMICmnStreamStdout constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmnStreamStdout::CMICmnStreamStdout() {}
-
-//++
-// Details: CMICmnStreamStdout destructor.
-// Type: Overridable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmnStreamStdout::~CMICmnStreamStdout() { Shutdown(); }
-
-//++
-// Details: Initialize resources for *this Stdout stream.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::Initialize() {
- m_clientUsageRefCnt++;
-
- if (m_bInitialized)
- return MIstatus::success;
-
- bool bOk = MIstatus::success;
-
-#ifdef _MSC_VER
-// Debugging / I/O issues with client.
-// This is only required on Windows if you do not use ::flush(stdout). MI uses
-// ::flush(stdout)
-// It trys to ensure the process attached to the stdout steam gets ALL the data.
-//::setbuf( stdout, NULL );
-#endif // _MSC_VER
-
- m_bInitialized = bOk;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Release resources for *this Stdout stream.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::Shutdown() {
- if (--m_clientUsageRefCnt > 0)
- return MIstatus::success;
-
- if (!m_bInitialized)
- return MIstatus::success;
-
- ClrErrorDescription();
-
- m_bInitialized = false;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Write an MI format type response to stdout. The text data does not
-// need to
-// include a carriage line return as this is added to the text. The
-// function also
-// then passes the text data into the CMICmnLog logger.
-// Type: Method.
-// Args: vText - (R) MI formatted text.
-// vbSendToLog - (R) True = Yes send to the Log file too, false = do
-// not. (Dflt = true)
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::WriteMIResponse(const CMIUtilString &vText,
- const bool vbSendToLog /* = true */) {
- return WritePriv(vText, vText, vbSendToLog);
-}
-
-//++
-// Details: Write text data to stdout. The text data does not need to
-// include a carriage line return as this is added to the text. The
-// function also
-// then passes the text data into the CMICmnLog logger.
-// Type: Method.
-// Args: vText - (R) Text data.
-// vbSendToLog - (R) True = Yes send to the Log file too, false = do
-// not. (Dflt = true)
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::Write(const CMIUtilString &vText,
- const bool vbSendToLog /* = true */) {
- if (vText.length() == 0)
- return MIstatus::failure;
-
- const CMIUtilString strPrefixed(CMIUtilString::Format(
- "%s: %s", CMIDriver::Instance().GetAppNameShort().c_str(),
- vText.c_str()));
-
- return WritePriv(strPrefixed, vText, vbSendToLog);
-}
-
-//++
-// Details: Write text data to stdout. The text data does not need to
-// include a carriage line return as this is added to the text. The
-// function also
-// then passes the text data into the CMICmnLog logger.
-// Type: Method.
-// Args: vText - (R) Text data prefixed with MI app's short name.
-// vTxtForLogFile - (R) Text data.
-// vbSendToLog - (R) True = Yes send to the Log file too, false =
-// do not. (Dflt = true)
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::WritePriv(const CMIUtilString &vText,
- const CMIUtilString &vTxtForLogFile,
- const bool vbSendToLog /* = true */) {
- if (vText.length() == 0)
- return MIstatus::failure;
-
- bool bOk = MIstatus::success;
- {
- // Grab the stdout thread lock while we print
- CMIUtilThreadLock _lock(m_mutex);
-
- // Send this text to stdout
- const MIint status = ::fputs(vText.c_str(), stdout);
- if (status == EOF)
- // Don't call the CMICmnBase::SetErrorDescription() because it will cause
- // a stack overflow:
- // CMICmnBase::SetErrorDescription -> CMICmnStreamStdout::Write ->
- // CMICmnStreamStdout::WritePriv -> CMICmnBase::SetErrorDescription
- bOk = MIstatus::failure;
- else {
- ::fprintf(stdout, "\n");
- ::fflush(stdout);
- }
-
- // Send this text to the log
- if (bOk && vbSendToLog)
- bOk &= m_pLog->WriteLog(vTxtForLogFile);
- }
-
- return bOk;
-}
-
-//++
-// Details: Lock the availability of the stream stdout. Other users of *this
-// stream will
-// be stalled until it is available (Unlock()).
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::Lock() {
- m_mutex.Lock();
- return MIstatus::success;
-}
-
-//++
-// Details: Release a previously locked stdout.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::Unlock() {
- m_mutex.Unlock();
- return MIstatus::success;
-}
-
-//++
-// Details: Take a text data and send to the stdout stream. Also output to the
-// MI Log
-// file.
-// Type: Static method.
-// Args: vrTxt - (R) Text.
-// Return: MIstatus::success - Functionality succeeded.
-// MIstatus::failure - Functionality failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::TextToStdout(const CMIUtilString &vrTxt) {
- const bool bSendToLog = true;
- return CMICmnStreamStdout::Instance().WriteMIResponse(vrTxt, bSendToLog);
-}
-
-//++
-// Details: Write prompt to stdout if it's enabled.
-// Type: Static method.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmnStreamStdout::WritePrompt() {
- const CMICmnStreamStdin &rStdinMan = CMICmnStreamStdin::Instance();
- if (rStdinMan.GetEnablePrompt())
- return TextToStdout(rStdinMan.GetPrompt());
- return MIstatus::success;
-}
Removed: lldb/trunk/tools/lldb-mi/MICmnStreamStdout.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdout.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdout.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdout.h (removed)
@@ -1,62 +0,0 @@
-//===-- MICmnStreamStdout.h -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmnBase.h"
-#include "MIUtilSingletonBase.h"
-#include "MIUtilString.h"
-#include "MIUtilThreadBaseStd.h"
-
-//++
-//============================================================================
-// Details: MI common code class. The MI driver requires this object.
-// CMICmnStreamStdout sets up and tears downs stdout for the driver.
-//
-// Singleton class.
-//--
-class CMICmnStreamStdout : public CMICmnBase,
- public MI::ISingleton<CMICmnStreamStdout> {
- friend class MI::ISingleton<CMICmnStreamStdout>;
-
- // Statics:
-public:
- static bool TextToStdout(const CMIUtilString &vrTxt);
- static bool WritePrompt();
-
- // Methods:
-public:
- bool Initialize() override;
- bool Shutdown() override;
- //
- bool Lock();
- bool Unlock();
- bool Write(const CMIUtilString &vText, const bool vbSendToLog = true);
- bool WriteMIResponse(const CMIUtilString &vText,
- const bool vbSendToLog = true);
-
- // Methods:
-private:
- /* ctor */ CMICmnStreamStdout();
- /* ctor */ CMICmnStreamStdout(const CMICmnStreamStdout &);
- void operator=(const CMICmnStreamStdout &);
- //
- bool WritePriv(const CMIUtilString &vText,
- const CMIUtilString &vTxtForLogFile,
- const bool vbSendToLog = true);
-
- // Overridden:
-private:
- // From CMICmnBase
- /* dtor */ ~CMICmnStreamStdout() override;
-
- // Attributes:
-private:
- CMIUtilThreadMutex m_mutex; // Mutex object for sync during writing to stream
-};
Removed: lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.cpp (removed)
@@ -1,145 +0,0 @@
-//===-- MICmnThreadMgrStd.cpp -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmnThreadMgrStd.h"
-#include "MICmnLog.h"
-#include "MICmnResources.h"
-#include "MIUtilSingletonHelper.h"
-
-//++
-// Details: CMICmnThreadMgr constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmnThreadMgrStd::CMICmnThreadMgrStd() {}
-
-//++
-// Details: CMICmnThreadMgr destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmnThreadMgrStd::~CMICmnThreadMgrStd() { Shutdown(); }
-
-//++
-// Details: Initialise resources for *this thread manager.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnThreadMgrStd::Initialize() {
- m_clientUsageRefCnt++;
-
- if (m_bInitialized)
- return MIstatus::success;
-
- bool bOk = MIstatus::success;
-
- ClrErrorDescription();
- CMIUtilString errMsg;
-
- // Note initialisation order is important here as some resources depend on
- // previous
- MI::ModuleInit<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
- MI::ModuleInit<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
-
- m_bInitialized = bOk;
-
- if (!bOk) {
- CMIUtilString strInitError(CMIUtilString::Format(
- MIRSRC(IDS_MI_INIT_ERR_THREADMGR), errMsg.c_str()));
- SetErrorDescription(strInitError);
- return MIstatus::failure;
- }
-
- return bOk;
-}
-
-//++
-// Details: Release resources for *this thread manager.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnThreadMgrStd::Shutdown() {
- if (--m_clientUsageRefCnt > 0)
- return MIstatus::success;
-
- if (!m_bInitialized)
- return MIstatus::success;
-
- m_bInitialized = false;
-
- ClrErrorDescription();
-
- bool bOk = MIstatus::success;
- CMIUtilString errMsg;
-
- // Tidy up
- ThreadAllTerminate();
-
- // Note shutdown order is important here
- MI::ModuleShutdown<CMICmnResources>(IDE_MI_SHTDWN_ERR_RESOURCES, bOk, errMsg);
- MI::ModuleShutdown<CMICmnLog>(IDS_MI_SHTDWN_ERR_LOG, bOk, errMsg);
-
- if (!bOk) {
- SetErrorDescriptionn(MIRSRC(IDS_MI_SHUTDOWN_ERR), errMsg.c_str());
- }
-
- return bOk;
-}
-
-//++
-// Details: Ask the thread manager to kill all threads and wait until they have
-// died
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnThreadMgrStd::ThreadAllTerminate() {
- ThreadList_t::const_iterator it = m_threadList.begin();
- for (; it != m_threadList.end(); ++it) {
- // If the thread is still running
- CMIUtilThreadActiveObjBase *pThread = *it;
- if (pThread->ThreadIsActive()) {
- // Ask this thread to kill itself
- pThread->ThreadKill();
-
- // Wait for this thread to die
- pThread->ThreadJoin();
- }
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Add a thread object to *this manager's list of thread objects. The
-// list to
-// used to manage thread objects centrally.
-// Type: Method.
-// Args: vrObj - (R) A thread object.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmnThreadMgrStd::AddThread(const CMIUtilThreadActiveObjBase &vrObj) {
- m_threadList.push_back(const_cast<CMIUtilThreadActiveObjBase *>(&vrObj));
-
- return MIstatus::success;
-}
Removed: lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.h (removed)
@@ -1,123 +0,0 @@
-//===-- MICmnThreadMgrStd.h -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers:
-#include <vector>
-
-// In-house headers:
-#include "MICmnBase.h"
-#include "MICmnResources.h"
-#include "MIUtilSingletonBase.h"
-#include "MIUtilThreadBaseStd.h"
-
-//++
-//============================================================================
-// Details: MI's worker thread (active thread) manager.
-// The manager creates threads and behalf of clients. Client are
-// responsible for their threads and can delete them when necessary.
-// This manager will stop and delete all threads on *this manager's
-// shutdown.
-// Singleton class.
-//--
-class CMICmnThreadMgrStd : public CMICmnBase,
- public MI::ISingleton<CMICmnThreadMgrStd> {
- friend MI::ISingleton<CMICmnThreadMgrStd>;
-
- // Methods:
-public:
- bool Initialize() override;
- bool Shutdown() override;
- bool ThreadAllTerminate(); // Ask all threads to stop (caution)
- template <typename T> // Ask the thread manager to start and stop threads on
- // our behalf
- bool ThreadStart(T &vrwObject);
-
- // Typedef:
-private:
- typedef std::vector<CMIUtilThreadActiveObjBase *> ThreadList_t;
-
- // Methods:
-private:
- /* ctor */ CMICmnThreadMgrStd();
- /* ctor */ CMICmnThreadMgrStd(const CMICmnThreadMgrStd &);
- void operator=(const CMICmnThreadMgrStd &);
- //
- bool AddThread(const CMIUtilThreadActiveObjBase &
- vrObj); // Add a thread for monitoring by the threadmanager
-
- // Overridden:
-private:
- // From CMICmnBase
- /* dtor */ ~CMICmnThreadMgrStd() override;
-
- // Attributes:
-private:
- CMIUtilThreadMutex m_mutex;
- ThreadList_t m_threadList;
-};
-
-//++
-// Details: Given a thread object start its (worker) thread to do work. The
-// object is
-// added to the *this manager for housekeeping and deletion of all
-// thread objects.
-// Type: Template method.
-// Args: vrwThreadObj - (RW) A CMIUtilThreadActiveObjBase derived
-// object.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-template <typename T> bool CMICmnThreadMgrStd::ThreadStart(T &vrwThreadObj) {
- bool bOk = MIstatus::success;
-
- // Grab a reference to the base object type
- CMIUtilThreadActiveObjBase &rObj =
- static_cast<CMIUtilThreadActiveObjBase &>(vrwThreadObj);
-
- // Add to the thread managers internal database
- bOk &= AddThread(rObj);
- if (!bOk) {
- const CMIUtilString errMsg(
- CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
- vrwThreadObj.ThreadGetName().c_str()));
- SetErrorDescription(errMsg);
- return MIstatus::failure;
- }
-
- // Grab a reference on behalf of the caller
- bOk &= vrwThreadObj.Acquire();
- if (!bOk) {
- const CMIUtilString errMsg(
- CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
- vrwThreadObj.ThreadGetName().c_str()));
- SetErrorDescription(errMsg);
- return MIstatus::failure;
- }
-
- // Thread is already started
- // This call must come after the reference count increment
- if (vrwThreadObj.ThreadIsActive()) {
- // Early exit on thread already running condition
- return MIstatus::success;
- }
-
- // Start the thread running
- bOk &= vrwThreadObj.ThreadExecute();
- if (!bOk) {
- const CMIUtilString errMsg(
- CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
- vrwThreadObj.ThreadGetName().c_str()));
- SetErrorDescription(errMsg);
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
Removed: lldb/trunk/tools/lldb-mi/MIDataTypes.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDataTypes.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDataTypes.h (original)
+++ lldb/trunk/tools/lldb-mi/MIDataTypes.h (removed)
@@ -1,60 +0,0 @@
-//===-- MIDataTypes.h -------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: Common global switches, macros, etc.
-//
-// This file contains common data types required by applications
-// generally. If supported by the compiler, this file should be
-// #include'd as part of the project's PCH (precompiled header).
-
-#pragma once
-
-// Windows headers:
-#ifdef _WIN32
-
-// Debugging:
-#ifdef _DEBUG
-#include <crtdbg.h>
-#endif // _DEBUG
-
-#endif // _WIN32
-
-// Common definitions:
-
-// Function return status
-namespace MIstatus {
-const bool success = true;
-const bool failure = false;
-}
-
-// Use to avoid "unused parameter" compiler warnings:
-#define MIunused(x) (void)x;
-
-// Portability issues
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-typedef __int64 MIint;
-typedef unsigned __int64 MIuint;
-#else
-#ifdef _WIN32
-typedef unsigned int size_t;
-typedef int MIint;
-typedef unsigned int MIuint;
-#else
-typedef int MIint;
-typedef unsigned int MIuint;
-
-#define MAX_PATH 4096
-#endif // _WIN32
-#endif // _WIN64
-
-// Common types:
-
-// Fundamentals:
-typedef long long MIint64; // 64bit signed integer.
-typedef unsigned long long MIuint64; // 64bit unsigned integer.
Removed: lldb/trunk/tools/lldb-mi/MIDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriver.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriver.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriver.cpp (removed)
@@ -1,1318 +0,0 @@
-//===-- MIDriver.cpp --------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third party headers:
-#include "lldb/API/SBError.h"
-#include <cassert>
-#include <csignal>
-#include <fstream>
-
-// In-house headers:
-#include "MICmdArgValFile.h"
-#include "MICmdArgValString.h"
-#include "MICmdMgr.h"
-#include "MICmnConfig.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnLog.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-#include "MICmnResources.h"
-#include "MICmnStreamStderr.h"
-#include "MICmnStreamStdout.h"
-#include "MICmnThreadMgrStd.h"
-#include "MIDriver.h"
-#include "MIUtilDebug.h"
-#include "MIUtilSingletonHelper.h"
-
-// Instantiations:
-#if _DEBUG
-const CMIUtilString CMIDriver::ms_constMIVersion =
- MIRSRC(IDS_MI_VERSION_DESCRIPTION_DEBUG);
-#else
-const CMIUtilString CMIDriver::ms_constMIVersion =
- MIRSRC(IDS_MI_VERSION_DESCRIPTION); // Matches version in resources file
-#endif // _DEBUG
-const CMIUtilString
- CMIDriver::ms_constAppNameShort(MIRSRC(IDS_MI_APPNAME_SHORT));
-const CMIUtilString CMIDriver::ms_constAppNameLong(MIRSRC(IDS_MI_APPNAME_LONG));
-
-//++
-// Details: CMIDriver constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIDriver::CMIDriver()
- : m_bFallThruToOtherDriverEnabled(false), m_bDriverIsExiting(false),
- m_handleMainThread(nullptr), m_rStdin(CMICmnStreamStdin::Instance()),
- m_rLldbDebugger(CMICmnLLDBDebugger::Instance()),
- m_rStdOut(CMICmnStreamStdout::Instance()),
- m_eCurrentDriverState(eDriverState_NotRunning),
- m_bHaveExecutableFileNamePathOnCmdLine(false),
- m_bDriverDebuggingArgExecutable(false),
- m_bHaveCommandFileNamePathOnCmdLine(false) {}
-
-//++
-// Details: CMIDriver destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIDriver::~CMIDriver() {}
-
-//++
-// Details: Set whether *this driver (the parent) is enabled to pass a command
-// to its
-// fall through (child) driver to interpret the command and do work
-// instead
-// (if *this driver decides it can't handle the command).
-// Type: Method.
-// Args: vbYes - (R) True = yes fall through, false = do not pass on
-// command.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::SetEnableFallThru(const bool vbYes) {
- m_bFallThruToOtherDriverEnabled = vbYes;
- return MIstatus::success;
-}
-
-//++
-// Details: Get whether *this driver (the parent) is enabled to pass a command
-// to its
-// fall through (child) driver to interpret the command and do work
-// instead
-// (if *this driver decides it can't handle the command).
-// Type: Method.
-// Args: None.
-// Return: bool - True = yes fall through, false = do not pass on command.
-// Throws: None.
-//--
-bool CMIDriver::GetEnableFallThru() const {
- return m_bFallThruToOtherDriverEnabled;
-}
-
-//++
-// Details: Retrieve MI's application name of itself.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString & - Text description.
-// Throws: None.
-//--
-const CMIUtilString &CMIDriver::GetAppNameShort() const {
- return ms_constAppNameShort;
-}
-
-//++
-// Details: Retrieve MI's application name of itself.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString & - Text description.
-// Throws: None.
-//--
-const CMIUtilString &CMIDriver::GetAppNameLong() const {
- return ms_constAppNameLong;
-}
-
-//++
-// Details: Retrieve MI's version description of itself.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString & - Text description.
-// Throws: None.
-//--
-const CMIUtilString &CMIDriver::GetVersionDescription() const {
- return ms_constMIVersion;
-}
-
-//++
-// Details: Initialize setup *this driver ready for use.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::Initialize() {
- m_eCurrentDriverState = eDriverState_Initialising;
- m_clientUsageRefCnt++;
-
- ClrErrorDescription();
-
- if (m_bInitialized)
- return MIstatus::success;
-
- bool bOk = MIstatus::success;
- CMIUtilString errMsg;
-
- // Initialize all of the modules we depend on
- MI::ModuleInit<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
- MI::ModuleInit<CMICmnStreamStdout>(IDS_MI_INIT_ERR_STREAMSTDOUT, bOk, errMsg);
- MI::ModuleInit<CMICmnStreamStderr>(IDS_MI_INIT_ERR_STREAMSTDERR, bOk, errMsg);
- MI::ModuleInit<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
- MI::ModuleInit<CMICmnThreadMgrStd>(IDS_MI_INIT_ERR_THREADMANAGER, bOk,
- errMsg);
- MI::ModuleInit<CMICmnStreamStdin>(IDS_MI_INIT_ERR_STREAMSTDIN, bOk, errMsg);
- MI::ModuleInit<CMICmdMgr>(IDS_MI_INIT_ERR_CMDMGR, bOk, errMsg);
- bOk &= m_rLldbDebugger.SetDriver(*this);
- MI::ModuleInit<CMICmnLLDBDebugger>(IDS_MI_INIT_ERR_LLDBDEBUGGER, bOk, errMsg);
-
- m_bExitApp = false;
-
- m_bInitialized = bOk;
-
- if (!bOk) {
- const CMIUtilString msg =
- CMIUtilString::Format(MIRSRC(IDS_MI_INIT_ERR_DRIVER), errMsg.c_str());
- SetErrorDescription(msg);
- return MIstatus::failure;
- }
-
- m_eCurrentDriverState = eDriverState_RunningNotDebugging;
-
- return bOk;
-}
-
-//++
-// Details: Unbind detach or release resources used by *this driver.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::Shutdown() {
- if (--m_clientUsageRefCnt > 0)
- return MIstatus::success;
-
- if (!m_bInitialized)
- return MIstatus::success;
-
- m_eCurrentDriverState = eDriverState_ShuttingDown;
-
- ClrErrorDescription();
-
- bool bOk = MIstatus::success;
- CMIUtilString errMsg;
-
- // Shutdown all of the modules we depend on
- MI::ModuleShutdown<CMICmnLLDBDebugger>(IDS_MI_INIT_ERR_LLDBDEBUGGER, bOk,
- errMsg);
- MI::ModuleShutdown<CMICmdMgr>(IDS_MI_INIT_ERR_CMDMGR, bOk, errMsg);
- MI::ModuleShutdown<CMICmnStreamStdin>(IDS_MI_INIT_ERR_STREAMSTDIN, bOk,
- errMsg);
- MI::ModuleShutdown<CMICmnThreadMgrStd>(IDS_MI_INIT_ERR_THREADMANAGER, bOk,
- errMsg);
- MI::ModuleShutdown<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
- MI::ModuleShutdown<CMICmnStreamStderr>(IDS_MI_INIT_ERR_STREAMSTDERR, bOk,
- errMsg);
- MI::ModuleShutdown<CMICmnStreamStdout>(IDS_MI_INIT_ERR_STREAMSTDOUT, bOk,
- errMsg);
- MI::ModuleShutdown<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
-
- if (!bOk) {
- SetErrorDescriptionn(MIRSRC(IDS_MI_SHUTDOWN_ERR), errMsg.c_str());
- }
-
- m_eCurrentDriverState = eDriverState_NotRunning;
-
- return bOk;
-}
-
-//++
-// Details: Work function. Client (the driver's user) is able to append their
-// own message
-// in to the MI's Log trace file.
-// Type: Method.
-// Args: vMessage - (R) Client's text message.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::WriteMessageToLog(const CMIUtilString &vMessage) {
- CMIUtilString msg;
- msg = CMIUtilString::Format(MIRSRC(IDS_MI_CLIENT_MSG), vMessage.c_str());
- return m_pLog->Write(msg, CMICmnLog::eLogVerbosity_ClientMsg);
-}
-
-//++
-// Details: CDriverMgr calls *this driver initialize setup ready for use.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::DoInitialize() { return CMIDriver::Instance().Initialize(); }
-
-//++
-// Details: CDriverMgr calls *this driver to unbind detach or release resources
-// used by
-// *this driver.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::DoShutdown() { return CMIDriver::Instance().Shutdown(); }
-
-//++
-// Details: Retrieve the name for *this driver.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString & - Driver name.
-// Throws: None.
-//--
-const CMIUtilString &CMIDriver::GetName() const {
- const CMIUtilString &rName = GetAppNameLong();
- const CMIUtilString &rVsn = GetVersionDescription();
- static CMIUtilString strName =
- CMIUtilString::Format("%s %s", rName.c_str(), rVsn.c_str());
-
- return strName;
-}
-
-//++
-// Details: Retrieve *this driver's last error condition.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString - Text description.
-// Throws: None.
-//--
-CMIUtilString CMIDriver::GetError() const { return GetErrorDescription(); }
-
-//++
-// Details: Call *this driver to return it's debugger.
-// Type: Overridden.
-// Args: None.
-// Return: lldb::SBDebugger & - LLDB debugger object reference.
-// Throws: None.
-//--
-lldb::SBDebugger &CMIDriver::GetTheDebugger() {
- return m_rLldbDebugger.GetTheDebugger();
-}
-
-//++
-// Details: Specify another driver *this driver can call should this driver not
-// be able
-// to handle the client data input. DoFallThruToAnotherDriver() makes
-// the call.
-// Type: Overridden.
-// Args: vrOtherDriver - (R) Reference to another driver object.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver) {
- m_pDriverFallThru = const_cast<CMIDriverBase *>(&vrOtherDriver);
-
- return m_pDriverFallThru->SetDriverParent(*this);
-}
-
-//++
-// Details: Proxy function CMIDriverMgr IDriver interface implementation. *this
-// driver's
-// implementation called from here to match the existing function name
-// of the
-// original LLDB driver class (the extra indirection is not necessarily
-// required).
-// Check the arguments that were passed to this program to make sure
-// they are
-// valid and to get their argument values (if any).
-// Type: Overridden.
-// Args: argc - (R) An integer that contains the count of arguments
-// that follow in
-// argv. The argc parameter is always greater than
-// or equal to 1.
-// argv - (R) An array of null-terminated strings representing
-// command-line
-// arguments entered by the user of the program. By
-// convention,
-// argv[0] is the command with which the program is
-// invoked.
-// vpStdOut - (R) Pointer to a standard output stream.
-// vwbExiting - (W) True = *this want to exit, Reasons: help,
-// invalid arg(s),
-// version information only.
-// False = Continue to work, start debugger i.e.
-// Command
-// interpreter.
-// Return: lldb::SBError - LLDB current error status.
-// Throws: None.
-//--
-lldb::SBError CMIDriver::DoParseArgs(const int argc, const char *argv[],
- FILE *vpStdOut, bool &vwbExiting) {
- return ParseArgs(argc, argv, vpStdOut, vwbExiting);
-}
-
-//++
-// Details: Check the arguments that were passed to this program to make sure
-// they are
-// valid and to get their argument values (if any). The following are
-// options
-// that are only handled by *this driver:
-// --executable <file>
-// --source <file> or -s <file>
-// --synchronous
-// The application's options --interpreter and --executable in code act
-// very similar.
-// The --executable is necessary to differentiate whether the MI Driver
-// is being
-// used by a client (e.g. Eclipse) or from the command line. Eclipse
-// issues the option
-// --interpreter and also passes additional arguments which can be
-// interpreted as an
-// executable if called from the command line. Using --executable tells
-// the MI Driver
-// it is being called from the command line and to prepare to launch
-// the executable
-// argument for a debug session. Using --interpreter on the command
-// line does not
-// issue additional commands to initialise a debug session.
-// Option --synchronous disables an asynchronous mode in the lldb-mi driver.
-// Type: Overridden.
-// Args: argc - (R) An integer that contains the count of arguments
-// that follow in
-// argv. The argc parameter is always greater than
-// or equal to 1.
-// argv - (R) An array of null-terminated strings representing
-// command-line
-// arguments entered by the user of the program. By
-// convention,
-// argv[0] is the command with which the program is
-// invoked.
-// vpStdOut - (R) Pointer to a standard output stream.
-// vwbExiting - (W) True = *this want to exit, Reasons: help,
-// invalid arg(s),
-// version information only.
-// False = Continue to work, start debugger i.e.
-// Command
-// interpreter.
-// Return: lldb::SBError - LLDB current error status.
-// Throws: None.
-//--
-lldb::SBError CMIDriver::ParseArgs(const int argc, const char *argv[],
- FILE *vpStdOut, bool &vwbExiting) {
- lldb::SBError errStatus;
- const bool bHaveArgs(argc >= 2);
-
- // *** Add any args handled here to GetHelpOnCmdLineArgOptions() ***
-
- // CODETAG_MIDRIVE_CMD_LINE_ARG_HANDLING
- // Look for the command line options
- bool bHaveExecutableFileNamePath = false;
- bool bHaveExecutableLongOption = false;
-
- if (bHaveArgs) {
- // Search right to left to look for filenames
- for (MIint i = argc - 1; i > 0; i--) {
- const CMIUtilString strArg(argv[i]);
- const CMICmdArgValFile argFile;
-
- // Check for a filename
- if (argFile.IsFilePath(strArg) ||
- CMICmdArgValString(true, false, true).IsStringArg(strArg)) {
- // Is this the command file for the '-s' or '--source' options?
- const CMIUtilString strPrevArg(argv[i - 1]);
- if (strPrevArg == "-s" || strPrevArg == "--source") {
- m_strCmdLineArgCommandFileNamePath = strArg;
- m_bHaveCommandFileNamePathOnCmdLine = true;
- i--; // skip '-s' on the next loop
- continue;
- }
- // Else, must be the executable
- bHaveExecutableFileNamePath = true;
- m_strCmdLineArgExecuteableFileNamePath = strArg;
- m_bHaveExecutableFileNamePathOnCmdLine = true;
- }
- // Report error if no command file was specified for the '-s' or
- // '--source' options
- else if (strArg == "-s" || strArg == "--source") {
- vwbExiting = true;
- const CMIUtilString errMsg = CMIUtilString::Format(
- MIRSRC(IDS_CMD_ARGS_ERR_VALIDATION_MISSING_INF), strArg.c_str());
- errStatus.SetErrorString(errMsg.c_str());
- break;
- }
- // This argument is also checked for in CMIDriverMgr::ParseArgs()
- else if (strArg == "--executable") // Used to specify that
- // there is executable
- // argument also on the
- // command line
- { // See fn description.
- bHaveExecutableLongOption = true;
- } else if (strArg == "--synchronous") {
- CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().SetAsync(false);
- }
- }
- }
-
- if (bHaveExecutableFileNamePath && bHaveExecutableLongOption) {
- SetDriverDebuggingArgExecutable();
- }
-
- return errStatus;
-}
-
-//++
-// Details: A client can ask if *this driver is GDB/MI compatible.
-// Type: Overridden.
-// Args: None.
-// Return: True - GBD/MI compatible LLDB front end.
-// False - Not GBD/MI compatible LLDB front end.
-// Throws: None.
-//--
-bool CMIDriver::GetDriverIsGDBMICompatibleDriver() const { return true; }
-
-//++
-// Details: Start worker threads for the driver.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::StartWorkerThreads() {
- bool bOk = MIstatus::success;
-
- // Grab the thread manager
- CMICmnThreadMgrStd &rThreadMgr = CMICmnThreadMgrStd::Instance();
-
- // Start the event polling thread
- if (bOk && !rThreadMgr.ThreadStart<CMICmnLLDBDebugger>(m_rLldbDebugger)) {
- const CMIUtilString errMsg = CMIUtilString::Format(
- MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
- CMICmnThreadMgrStd::Instance().GetErrorDescription().c_str());
- SetErrorDescription(errMsg);
- return MIstatus::failure;
- }
-
- return bOk;
-}
-
-//++
-// Details: Stop worker threads for the driver.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::StopWorkerThreads() {
- CMICmnThreadMgrStd &rThreadMgr = CMICmnThreadMgrStd::Instance();
- return rThreadMgr.ThreadAllTerminate();
-}
-
-//++
-// Details: Call this function puts *this driver to work.
-// This function is used by the application's main thread.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::DoMainLoop() {
- if (!InitClientIDEToMIDriver()) // Init Eclipse IDE
- {
- SetErrorDescriptionn(MIRSRC(IDS_MI_INIT_ERR_CLIENT_USING_DRIVER));
- return MIstatus::failure;
- }
-
- if (!StartWorkerThreads())
- return MIstatus::failure;
-
- bool bOk = MIstatus::success;
-
- if (HaveExecutableFileNamePathOnCmdLine()) {
- if (!LocalDebugSessionStartupExecuteCommands()) {
- SetErrorDescription(MIRSRC(IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION));
- bOk = MIstatus::failure;
- }
- }
-
- // App is not quitting currently
- m_bExitApp = false;
-
- // Handle source file
- if (m_bHaveCommandFileNamePathOnCmdLine) {
- const bool bAsyncMode = false;
- ExecuteCommandFile(bAsyncMode);
- }
-
- // While the app is active
- while (bOk && !m_bExitApp) {
- CMIUtilString errorText;
- const char *pCmd = m_rStdin.ReadLine(errorText);
- if (pCmd != nullptr) {
- CMIUtilString lineText(pCmd);
- if (!lineText.empty()) {
- // Check that the handler thread is alive (otherwise we stuck here)
- assert(CMICmnLLDBDebugger::Instance().ThreadIsActive());
-
- {
- // Lock Mutex before processing commands so that we don't disturb an
- // event
- // being processed
- CMIUtilThreadLock lock(
- CMICmnLLDBDebugSessionInfo::Instance().GetSessionMutex());
- bOk = InterpretCommand(lineText);
- }
-
- // Draw prompt if desired
- bOk = bOk && CMICmnStreamStdout::WritePrompt();
-
- // Wait while the handler thread handles incoming events
- CMICmnLLDBDebugger::Instance().WaitForHandleEvent();
- }
- }
- }
-
- // Signal that the application is shutting down
- DoAppQuit();
-
- // Close and wait for the workers to stop
- StopWorkerThreads();
-
- return MIstatus::success;
-}
-
-//++
-// Details: Set things in motion, set state etc that brings *this driver (and
-// the
-// application) to a tidy shutdown.
-// This function is used by the application's main thread.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::DoAppQuit() {
- bool bYesQuit = true;
-
- // Shutdown stuff, ready app for exit
- {
- CMIUtilThreadLock lock(m_threadMutex);
- m_bDriverIsExiting = true;
- }
-
- return bYesQuit;
-}
-
-//++
-// Details: *this driver passes text commands to a fall through driver is it
-// does not
-// understand them (the LLDB driver).
-// This function is used by the application's main thread.
-// Type: Method.
-// Args: vTextLine - (R) Text data representing a possible command.
-// vwbCmdYesValid - (W) True = Command valid, false = command not
-// handled.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::InterpretCommandFallThruDriver(const CMIUtilString &vTextLine,
- bool &vwbCmdYesValid) {
- MIunused(vTextLine);
- MIunused(vwbCmdYesValid);
-
- // ToDo: Implement when less urgent work to be done or decide remove as not
- // required
- // bool bOk = MIstatus::success;
- // bool bCmdNotUnderstood = true;
- // if( bCmdNotUnderstood && GetEnableFallThru() )
- //{
- // CMIUtilString errMsg;
- // bOk = DoFallThruToAnotherDriver( vStdInBuffer, errMsg );
- // if( !bOk )
- // {
- // errMsg = errMsg.StripCREndOfLine();
- // errMsg = errMsg.StripCRAll();
- // const CMIDriverBase * pOtherDriver = GetDriverToFallThruTo();
- // const char * pName = pOtherDriver->GetDriverName().c_str();
- // const char * pId = pOtherDriver->GetDriverId().c_str();
- // const CMIUtilString msg( CMIUtilString::Format( MIRSRC(
- // IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR ), pName, pId, errMsg.c_str() )
- //);
- // m_pLog->WriteMsg( msg );
- // }
- //}
- //
- // vwbCmdYesValid = bOk;
- // CMIUtilString strNot;
- // if( vwbCmdYesValid)
- // strNot = CMIUtilString::Format( "%s ", MIRSRC( IDS_WORD_NOT ) );
- // const CMIUtilString msg( CMIUtilString::Format( MIRSRC(
- // IDS_FALLTHRU_DRIVER_CMD_RECEIVED ), vTextLine.c_str(), strNot.c_str() ) );
- // m_pLog->WriteLog( msg );
-
- return MIstatus::success;
-}
-
-//++
-// Details: Retrieve the name for *this driver.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString & - Driver name.
-// Throws: None.
-//--
-const CMIUtilString &CMIDriver::GetDriverName() const { return GetName(); }
-
-//++
-// Details: Get the unique ID for *this driver.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString & - Text description.
-// Throws: None.
-//--
-const CMIUtilString &CMIDriver::GetDriverId() const { return GetId(); }
-
-//++
-// Details: This function allows *this driver to call on another driver to
-// perform work
-// should this driver not be able to handle the client data input.
-// SetDriverToFallThruTo() specifies the fall through to driver.
-// Check the error message if the function returns a failure.
-// Type: Overridden.
-// Args: vCmd - (R) Command instruction to interpret.
-// vwErrMsg - (W) Status description on command failing.
-// Return: MIstatus::success - Command succeeded.
-// MIstatus::failure - Command failed.
-// Throws: None.
-//--
-bool CMIDriver::DoFallThruToAnotherDriver(const CMIUtilString &vCmd,
- CMIUtilString &vwErrMsg) {
- bool bOk = MIstatus::success;
-
- CMIDriverBase *pOtherDriver = GetDriverToFallThruTo();
- if (pOtherDriver == nullptr)
- return bOk;
-
- return pOtherDriver->DoFallThruToAnotherDriver(vCmd, vwErrMsg);
-}
-
-//++
-// Details: *this driver provides a file stream to other drivers on which *this
-// driver
-// write's out to and they read as expected input. *this driver is
-// passing
-// through commands to the (child) pass through assigned driver.
-// Type: Overrdidden.
-// Args: None.
-// Return: FILE * - Pointer to stream.
-// Throws: None.
-//--
-FILE *CMIDriver::GetStdin() const {
- // Note this fn is called on CMIDriverMgr register driver so stream has to be
- // available before *this driver has been initialized! Flaw?
-
- // This very likely to change later to a stream that the pass thru driver
- // will read and we write to give it 'input'
- return stdin;
-}
-
-//++
-// Details: *this driver provides a file stream to other pass through assigned
-// drivers
-// so they know what to write to.
-// Type: Overidden.
-// Args: None.
-// Return: FILE * - Pointer to stream.
-// Throws: None.
-//--
-FILE *CMIDriver::GetStdout() const {
- // Note this fn is called on CMIDriverMgr register driver so stream has to be
- // available before *this driver has been initialized! Flaw?
-
- // Do not want to pass through driver to write to stdout
- return nullptr;
-}
-
-//++
-// Details: *this driver provides a error file stream to other pass through
-// assigned drivers
-// so they know what to write to.
-// Type: Overidden.
-// Args: None.
-// Return: FILE * - Pointer to stream.
-// Throws: None.
-//--
-FILE *CMIDriver::GetStderr() const {
- // Note this fn is called on CMIDriverMgr register driver so stream has to be
- // available before *this driver has been initialized! Flaw?
-
- // This very likely to change later to a stream that the pass thru driver
- // will write to and *this driver reads from to pass on the CMICmnLog object
- return stderr;
-}
-
-//++
-// Details: Set a unique ID for *this driver. It cannot be empty.
-// Type: Overridden.
-// Args: vId - (R) Text description.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::SetId(const CMIUtilString &vId) {
- if (vId.empty()) {
- SetErrorDescriptionn(MIRSRC(IDS_DRIVER_ERR_ID_INVALID), GetName().c_str(),
- vId.c_str());
- return MIstatus::failure;
- }
-
- m_strDriverId = vId;
- return MIstatus::success;
-}
-
-//++
-// Details: Get the unique ID for *this driver.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString & - Text description.
-// Throws: None.
-//--
-const CMIUtilString &CMIDriver::GetId() const { return m_strDriverId; }
-
-//++
-// Details: Interpret the text data and match against current commands to see if
-// there
-// is a match. If a match then the command is issued and actioned on.
-// The
-// text data if not understood by *this driver is past on to the Fall
-// Thru
-// driver.
-// This function is used by the application's main thread.
-// Type: Method.
-// Args: vTextLine - (R) Text data representing a possible command.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::InterpretCommand(const CMIUtilString &vTextLine) {
- const bool bNeedToRebroadcastStopEvent =
- m_rLldbDebugger.CheckIfNeedToRebroadcastStopEvent();
- bool bCmdYesValid = false;
- bool bOk = InterpretCommandThisDriver(vTextLine, bCmdYesValid);
- if (bOk && !bCmdYesValid)
- bOk = InterpretCommandFallThruDriver(vTextLine, bCmdYesValid);
-
- if (bNeedToRebroadcastStopEvent)
- m_rLldbDebugger.RebroadcastStopEvent();
-
- return bOk;
-}
-
-//++
-// Details: Helper function for CMIDriver::InterpretCommandThisDriver.
-// Convert a CLI command to MI command (just wrap any CLI command
-// into "<tokens>-interpreter-exec command \"<CLI command>\"").
-// Type: Method.
-// Args: vTextLine - (R) Text data representing a possible command.
-// Return: CMIUtilString - The original MI command or converted CLI command.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-CMIUtilString
-CMIDriver::WrapCLICommandIntoMICommand(const CMIUtilString &vTextLine) const {
- // Tokens contain following digits
- static const CMIUtilString digits("0123456789");
-
- // Consider an algorithm on the following example:
- // 001-file-exec-and-symbols "/path/to/file"
- //
- // 1. Skip a command token
- // For example:
- // 001-file-exec-and-symbols "/path/to/file"
- // 001target create "/path/to/file"
- // ^ -- command starts here (in both cases)
- // Also possible case when command not found:
- // 001
- // ^ -- i.e. only tokens are present (or empty string at all)
- const size_t nCommandOffset = vTextLine.find_first_not_of(digits);
-
- // 2. Check if command is empty
- // For example:
- // 001-file-exec-and-symbols "/path/to/file"
- // 001target create "/path/to/file"
- // ^ -- command not empty (in both cases)
- // or:
- // 001
- // ^ -- command wasn't found
- const bool bIsEmptyCommand = (nCommandOffset == CMIUtilString::npos);
-
- // 3. Check and exit if it isn't a CLI command
- // For example:
- // 001-file-exec-and-symbols "/path/to/file"
- // 001
- // ^ -- it isn't CLI command (in both cases)
- // or:
- // 001target create "/path/to/file"
- // ^ -- it's CLI command
- const bool bIsCliCommand =
- !bIsEmptyCommand && (vTextLine.at(nCommandOffset) != '-');
- if (!bIsCliCommand)
- return vTextLine;
-
- // 4. Wrap CLI command to make it MI-compatible
- //
- // 001target create "/path/to/file"
- // ^^^ -- token
- const std::string vToken(vTextLine.begin(),
- vTextLine.begin() + nCommandOffset);
- // 001target create "/path/to/file"
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- CLI command
- const CMIUtilString vCliCommand(std::string(vTextLine, nCommandOffset));
-
- // 5. Escape special characters and embed the command in a string
- // Result: it looks like -- target create \"/path/to/file\".
- const std::string vShieldedCliCommand(vCliCommand.AddSlashes());
-
- // 6. Turn the CLI command into an MI command, as in:
- // 001-interpreter-exec command "target create \"/path/to/file\""
- // ^^^ -- token
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ -- wrapper
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- shielded
- // CLI command
- return CMIUtilString::Format("%s-interpreter-exec command \"%s\"",
- vToken.c_str(), vShieldedCliCommand.c_str());
-}
-
-//++
-// Details: Interpret the text data and match against current commands to see if
-// there
-// is a match. If a match then the command is issued and actioned on.
-// If a
-// command cannot be found to match then vwbCmdYesValid is set to false
-// and
-// nothing else is done here.
-// This function is used by the application's main thread.
-// Type: Method.
-// Args: vTextLine - (R) Text data representing a possible command.
-// vwbCmdYesValid - (W) True = Command valid, false = command not
-// handled.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::InterpretCommandThisDriver(const CMIUtilString &vTextLine,
- bool &vwbCmdYesValid) {
- // Convert any CLI commands into MI commands
- const CMIUtilString vMITextLine(WrapCLICommandIntoMICommand(vTextLine));
-
- vwbCmdYesValid = false;
- bool bCmdNotInCmdFactor = false;
- SMICmdData cmdData;
- CMICmdMgr &rCmdMgr = CMICmdMgr::Instance();
- if (!rCmdMgr.CmdInterpret(vMITextLine, vwbCmdYesValid, bCmdNotInCmdFactor,
- cmdData))
- return MIstatus::failure;
-
- if (vwbCmdYesValid) {
- // For debugging only
- // m_pLog->WriteLog( cmdData.strMiCmdAll.c_str() );
-
- return ExecuteCommand(cmdData);
- }
-
- // Check for escape character, may be cursor control characters
- // This code is not necessary for application operation, just want to keep
- // tabs on what
- // has been given to the driver to try and interpret.
- if (vMITextLine.at(0) == 27) {
- CMIUtilString logInput(MIRSRC(IDS_STDIN_INPUT_CTRL_CHARS));
- for (MIuint i = 0; i < vMITextLine.length(); i++) {
- logInput += CMIUtilString::Format("%d ", vMITextLine.at(i));
- }
- m_pLog->WriteLog(logInput);
- return MIstatus::success;
- }
-
- // Write to the Log that a 'command' was not valid.
- // Report back to the MI client via MI result record.
- CMIUtilString strNotInCmdFactory;
- if (bCmdNotInCmdFactor)
- strNotInCmdFactory = CMIUtilString::Format(
- MIRSRC(IDS_DRIVER_CMD_NOT_IN_FACTORY), cmdData.strMiCmd.c_str());
- const CMIUtilString strNot(
- CMIUtilString::Format("%s ", MIRSRC(IDS_WORD_NOT)));
- const CMIUtilString msg(CMIUtilString::Format(
- MIRSRC(IDS_DRIVER_CMD_RECEIVED), vMITextLine.c_str(), strNot.c_str(),
- strNotInCmdFactory.c_str()));
- const CMICmnMIValueConst vconst = CMICmnMIValueConst(msg);
- const CMICmnMIValueResult valueResult("msg", vconst);
- const CMICmnMIResultRecord miResultRecord(
- cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- valueResult);
- const bool bOk = m_rStdOut.WriteMIResponse(miResultRecord.GetString());
-
- // Proceed to wait for or execute next command
- return bOk;
-}
-
-//++
-// Details: Having previously had the potential command validated and found
-// valid now
-// get the command executed.
-// This function is used by the application's main thread.
-// Type: Method.
-// Args: vCmdData - (RW) Command meta data.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriver::ExecuteCommand(const SMICmdData &vCmdData) {
- CMICmdMgr &rCmdMgr = CMICmdMgr::Instance();
- return rCmdMgr.CmdExecute(vCmdData);
-}
-
-//++
-// Details: Set the MI Driver's exit application flag. The application checks
-// this flag
-// after every stdin line is read so the exit may not be instantaneous.
-// If vbForceExit is false the MI Driver queries its state and
-// determines if is
-// should exit or continue operating depending on that running state.
-// This is related to the running state of the MI driver.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIDriver::SetExitApplicationFlag(const bool vbForceExit) {
- if (vbForceExit) {
- CMIUtilThreadLock lock(m_threadMutex);
- m_bExitApp = true;
- return;
- }
-
- // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
- // Did we receive a SIGINT from the client during a running debug program, if
- // so then SIGINT is not to be taken as meaning kill the MI driver application
- // but halt the inferior program being debugged instead
- if (m_eCurrentDriverState == eDriverState_RunningDebugging) {
- InterpretCommand("-exec-interrupt");
- return;
- }
-
- m_bExitApp = true;
-}
-
-//++
-// Details: Get the MI Driver's exit exit application flag.
-// This is related to the running state of the MI driver.
-// Type: Method.
-// Args: None.
-// Return: bool - True = MI Driver is shutting down, false = MI driver is
-// running.
-// Throws: None.
-//--
-bool CMIDriver::GetExitApplicationFlag() const { return m_bExitApp; }
-
-//++
-// Details: Get the current running state of the MI Driver.
-// Type: Method.
-// Args: None.
-// Return: DriverState_e - The current running state of the application.
-// Throws: None.
-//--
-CMIDriver::DriverState_e CMIDriver::GetCurrentDriverState() const {
- return m_eCurrentDriverState;
-}
-
-//++
-// Details: Set the current running state of the MI Driver to running and
-// currently not in
-// a debug session.
-// Type: Method.
-// Return: MIstatus::success - Functionality succeeded.
-// MIstatus::failure - Functionality failed.
-// Return: DriverState_e - The current running state of the application.
-// Throws: None.
-//--
-bool CMIDriver::SetDriverStateRunningNotDebugging() {
- // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
-
- if (m_eCurrentDriverState == eDriverState_RunningNotDebugging)
- return MIstatus::success;
-
- // Driver cannot be in the following states to set
- // eDriverState_RunningNotDebugging
- switch (m_eCurrentDriverState) {
- case eDriverState_NotRunning:
- case eDriverState_Initialising:
- case eDriverState_ShuttingDown: {
- SetErrorDescription(MIRSRC(IDS_DRIVER_ERR_DRIVER_STATE_ERROR));
- return MIstatus::failure;
- }
- case eDriverState_RunningDebugging:
- case eDriverState_RunningNotDebugging:
- break;
- case eDriverState_count:
- SetErrorDescription(
- CMIUtilString::Format(MIRSRC(IDS_CODE_ERR_INVALID_ENUMERATION_VALUE),
- "SetDriverStateRunningNotDebugging()"));
- return MIstatus::failure;
- }
-
- // Driver must be in this state to set eDriverState_RunningNotDebugging
- if (m_eCurrentDriverState != eDriverState_RunningDebugging) {
- SetErrorDescription(MIRSRC(IDS_DRIVER_ERR_DRIVER_STATE_ERROR));
- return MIstatus::failure;
- }
-
- m_eCurrentDriverState = eDriverState_RunningNotDebugging;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Set the current running state of the MI Driver to running and
-// currently not in
-// a debug session. The driver's state must in the state running and in
-// a
-// debug session to set this new state.
-// Type: Method.
-// Return: MIstatus::success - Functionality succeeded.
-// MIstatus::failure - Functionality failed.
-// Return: DriverState_e - The current running state of the application.
-// Throws: None.
-//--
-bool CMIDriver::SetDriverStateRunningDebugging() {
- // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
-
- if (m_eCurrentDriverState == eDriverState_RunningDebugging)
- return MIstatus::success;
-
- // Driver cannot be in the following states to set
- // eDriverState_RunningDebugging
- switch (m_eCurrentDriverState) {
- case eDriverState_NotRunning:
- case eDriverState_Initialising:
- case eDriverState_ShuttingDown: {
- SetErrorDescription(MIRSRC(IDS_DRIVER_ERR_DRIVER_STATE_ERROR));
- return MIstatus::failure;
- }
- case eDriverState_RunningDebugging:
- case eDriverState_RunningNotDebugging:
- break;
- case eDriverState_count:
- SetErrorDescription(
- CMIUtilString::Format(MIRSRC(IDS_CODE_ERR_INVALID_ENUMERATION_VALUE),
- "SetDriverStateRunningDebugging()"));
- return MIstatus::failure;
- }
-
- // Driver must be in this state to set eDriverState_RunningDebugging
- if (m_eCurrentDriverState != eDriverState_RunningNotDebugging) {
- SetErrorDescription(MIRSRC(IDS_DRIVER_ERR_DRIVER_STATE_ERROR));
- return MIstatus::failure;
- }
-
- m_eCurrentDriverState = eDriverState_RunningDebugging;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Prepare the client IDE so it will start working/communicating with
-// *this MI
-// driver.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functionality succeeded.
-// MIstatus::failure - Functionality failed.
-// Throws: None.
-//--
-bool CMIDriver::InitClientIDEToMIDriver() const {
- // Put other IDE init functions here
- return InitClientIDEEclipse();
-}
-
-//++
-// Details: The IDE Eclipse when debugging locally expects "(gdb)\n" character
-// sequence otherwise it refuses to communicate and times out. This
-// should be
-// sent to Eclipse before anything else.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functionality succeeded.
-// MIstatus::failure - Functionality failed.
-// Throws: None.
-//--
-bool CMIDriver::InitClientIDEEclipse() const {
- return CMICmnStreamStdout::WritePrompt();
-}
-
-//++
-// Details: Ask *this driver whether it found an executable in the MI Driver's
-// list of
-// arguments which to open and debug. If so instigate commands to set
-// up a debug
-// session for that executable.
-// Type: Method.
-// Args: None.
-// Return: bool - True = True = Yes executable given as one of the parameters
-// to the MI
-// Driver.
-// False = not found.
-// Throws: None.
-//--
-bool CMIDriver::HaveExecutableFileNamePathOnCmdLine() const {
- return m_bHaveExecutableFileNamePathOnCmdLine;
-}
-
-//++
-// Details: Retrieve from *this driver executable file name path to start a
-// debug session
-// with (if present see HaveExecutableFileNamePathOnCmdLine()).
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString & - Executeable file name path or empty string.
-// Throws: None.
-//--
-const CMIUtilString &CMIDriver::GetExecutableFileNamePathOnCmdLine() const {
- return m_strCmdLineArgExecuteableFileNamePath;
-}
-
-//++
-// Details: Execute commands (by injecting them into the stdin line queue
-// container) and
-// other code to set up the MI Driver such that is can take the
-// executable
-// argument passed on the command and create a debug session for it.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functionality succeeded.
-// MIstatus::failure - Functionality failed.
-// Throws: None.
-//--
-bool CMIDriver::LocalDebugSessionStartupExecuteCommands() {
- const CMIUtilString strCmd(CMIUtilString::Format(
- "-file-exec-and-symbols \"%s\"",
- m_strCmdLineArgExecuteableFileNamePath.AddSlashes().c_str()));
- bool bOk = CMICmnStreamStdout::TextToStdout(strCmd);
- bOk = bOk && InterpretCommand(strCmd);
- bOk = bOk && CMICmnStreamStdout::WritePrompt();
- return bOk;
-}
-
-//++
-// Details: Set the MI Driver into "its debugging an executable passed as an
-// argument"
-// mode as against running via a client like Eclipse.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIDriver::SetDriverDebuggingArgExecutable() {
- m_bDriverDebuggingArgExecutable = true;
-}
-
-//++
-// Details: Retrieve the MI Driver state indicating if it is operating in "its
-// debugging
-// an executable passed as an argument" mode as against running via a
-// client
-// like Eclipse.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-bool CMIDriver::IsDriverDebuggingArgExecutable() const {
- return m_bDriverDebuggingArgExecutable;
-}
-
-//++
-// Details: Execute commands from command source file in specified mode, and
-// set exit-flag if needed.
-// Type: Method.
-// Args: vbAsyncMode - (R) True = execute commands in asynchronous
-// mode, false = otherwise.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMIDriver::ExecuteCommandFile(const bool vbAsyncMode) {
- std::ifstream ifsStartScript(m_strCmdLineArgCommandFileNamePath.c_str());
- if (!ifsStartScript.is_open()) {
- const CMIUtilString errMsg(
- CMIUtilString::Format(MIRSRC(IDS_UTIL_FILE_ERR_OPENING_FILE_UNKNOWN),
- m_strCmdLineArgCommandFileNamePath.c_str()));
- SetErrorDescription(errMsg.c_str());
- const bool bForceExit = true;
- SetExitApplicationFlag(bForceExit);
- return MIstatus::failure;
- }
-
- // Switch lldb to synchronous mode
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- const bool bAsyncSetting = rSessionInfo.GetDebugger().GetAsync();
- rSessionInfo.GetDebugger().SetAsync(vbAsyncMode);
-
- // Execute commands from file
- bool bOk = MIstatus::success;
- CMIUtilString strCommand;
- while (!m_bExitApp && std::getline(ifsStartScript, strCommand)) {
- // Print command
- bOk = CMICmnStreamStdout::TextToStdout(strCommand);
-
- // Skip if it's a comment or empty line
- if (strCommand.empty() || strCommand[0] == '#')
- continue;
-
- // Execute if no error
- if (bOk) {
- CMIUtilThreadLock lock(rSessionInfo.GetSessionMutex());
- bOk = InterpretCommand(strCommand);
- }
-
- // Draw the prompt after command will be executed (if enabled)
- bOk = bOk && CMICmnStreamStdout::WritePrompt();
-
- // Exit if there is an error
- if (!bOk) {
- const bool bForceExit = true;
- SetExitApplicationFlag(bForceExit);
- break;
- }
-
- // Wait while the handler thread handles incoming events
- CMICmnLLDBDebugger::Instance().WaitForHandleEvent();
- }
-
- // Switch lldb back to initial mode
- rSessionInfo.GetDebugger().SetAsync(bAsyncSetting);
-
- return bOk;
-}
-
-//++
-// Details: Gets called when lldb-mi gets a signal. Stops the process if it was
-// SIGINT.
-//
-// Type: Method.
-// Args: signal that was delivered
-// Return: None.
-// Throws: None.
-//--
-void CMIDriver::DeliverSignal(int signal) {
- if (signal == SIGINT &&
- (m_eCurrentDriverState == eDriverState_RunningDebugging))
- InterpretCommand("-exec-interrupt");
-}
Removed: lldb/trunk/tools/lldb-mi/MIDriver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriver.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriver.h (original)
+++ lldb/trunk/tools/lldb-mi/MIDriver.h (removed)
@@ -1,180 +0,0 @@
-//===-- MIDriver.h ----------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers
-#include <queue>
-
-// In-house headers:
-#include "MICmdData.h"
-#include "MICmnBase.h"
-#include "MICmnConfig.h"
-#include "MICmnStreamStdin.h"
-#include "MIDriverBase.h"
-#include "MIDriverMgr.h"
-#include "MIUtilSingletonBase.h"
-
-// Declarations:
-class CMICmnLLDBDebugger;
-class CMICmnStreamStdout;
-
-//++
-//============================================================================
-// Details: MI driver implementation class. A singleton class derived from
-// LLDB SBBroadcaster class. Register the instance of *this class with
-// the CMIDriverMgr. The CMIDriverMgr sets the driver(s) of to start
-// work depending on the one selected to work. A driver can if not able
-// to handle an instruction or 'command' can pass that command onto
-// another driver object registered with the Driver Manager.
-//--
-class CMIDriver : public CMICmnBase,
- public CMIDriverMgr::IDriver,
- public CMIDriverBase,
- public MI::ISingleton<CMIDriver> {
- friend class MI::ISingleton<CMIDriver>;
-
- // Enumerations:
-public:
- //++ ----------------------------------------------------------------------
- // Details: The MI Driver has a running state which is used to help determine
- // which specific action(s) it should take or not allow.
- // The driver when operational and not shutting down alternates
- // between eDriverState_RunningNotDebugging and
- // eDriverState_RunningDebugging. eDriverState_RunningNotDebugging
- // is normally set when a breakpoint is hit or halted.
- // eDriverState_RunningDebugging is normally set when "exec-continue"
- // or "exec-run" is issued.
- //--
- enum DriverState_e {
- eDriverState_NotRunning = 0, // The MI Driver is not operating
- eDriverState_Initialising, // The MI Driver is setting itself up
- eDriverState_RunningNotDebugging, // The MI Driver is operational acting on
- // any MI commands sent to it
- eDriverState_RunningDebugging, // The MI Driver is currently overseeing an
- // inferior program that is running
- eDriverState_ShuttingDown, // The MI Driver is tearing down resources and
- // about exit
- eDriverState_count // Always last
- };
-
- // Methods:
-public:
- // MI system
- bool Initialize() override;
- bool Shutdown() override;
-
- // MI state
- bool GetExitApplicationFlag() const;
- DriverState_e GetCurrentDriverState() const;
- bool SetDriverStateRunningNotDebugging();
- bool SetDriverStateRunningDebugging();
- void SetDriverDebuggingArgExecutable();
- bool IsDriverDebuggingArgExecutable() const;
-
- // MI information about itself
- const CMIUtilString &GetAppNameShort() const;
- const CMIUtilString &GetAppNameLong() const;
- const CMIUtilString &GetVersionDescription() const;
-
- // MI do work
- bool WriteMessageToLog(const CMIUtilString &vMessage);
- bool SetEnableFallThru(const bool vbYes);
- bool GetEnableFallThru() const;
- bool HaveExecutableFileNamePathOnCmdLine() const;
- const CMIUtilString &GetExecutableFileNamePathOnCmdLine() const;
-
- // Overridden:
-public:
- // From CMIDriverMgr::IDriver
- bool DoInitialize() override;
- bool DoShutdown() override;
- bool DoMainLoop() override;
- lldb::SBError DoParseArgs(const int argc, const char *argv[], FILE *vpStdOut,
- bool &vwbExiting) override;
- CMIUtilString GetError() const override;
- const CMIUtilString &GetName() const override;
- lldb::SBDebugger &GetTheDebugger() override;
- bool GetDriverIsGDBMICompatibleDriver() const override;
- bool SetId(const CMIUtilString &vId) override;
- const CMIUtilString &GetId() const override;
- // From CMIDriverBase
- void SetExitApplicationFlag(const bool vbForceExit) override;
- bool DoFallThruToAnotherDriver(const CMIUtilString &vCmd,
- CMIUtilString &vwErrMsg) override;
- bool SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver) override;
- FILE *GetStdin() const override;
- FILE *GetStdout() const override;
- FILE *GetStderr() const override;
- const CMIUtilString &GetDriverName() const override;
- const CMIUtilString &GetDriverId() const override;
- void DeliverSignal(int signal) override;
-
- // Typedefs:
-private:
- typedef std::queue<CMIUtilString> QueueStdinLine_t;
-
- // Methods:
-private:
- /* ctor */ CMIDriver();
- /* ctor */ CMIDriver(const CMIDriver &);
- void operator=(const CMIDriver &);
-
- lldb::SBError ParseArgs(const int argc, const char *argv[], FILE *vpStdOut,
- bool &vwbExiting);
- bool DoAppQuit();
- bool InterpretCommand(const CMIUtilString &vTextLine);
- bool InterpretCommandThisDriver(const CMIUtilString &vTextLine,
- bool &vwbCmdYesValid);
- CMIUtilString
- WrapCLICommandIntoMICommand(const CMIUtilString &vTextLine) const;
- bool InterpretCommandFallThruDriver(const CMIUtilString &vTextLine,
- bool &vwbCmdYesValid);
- bool ExecuteCommand(const SMICmdData &vCmdData);
- bool StartWorkerThreads();
- bool StopWorkerThreads();
- bool InitClientIDEToMIDriver() const;
- bool InitClientIDEEclipse() const;
- bool LocalDebugSessionStartupExecuteCommands();
- bool ExecuteCommandFile(const bool vbAsyncMode);
-
- // Overridden:
-private:
- // From CMICmnBase
- /* dtor */ ~CMIDriver() override;
-
- // Attributes:
-private:
- static const CMIUtilString ms_constAppNameShort;
- static const CMIUtilString ms_constAppNameLong;
- static const CMIUtilString ms_constMIVersion;
- //
- bool m_bFallThruToOtherDriverEnabled; // True = yes fall through, false = do
- // not pass on command
- CMIUtilThreadMutex m_threadMutex;
- bool m_bDriverIsExiting; // True = yes, driver told to quit, false = continue
- // working
- void *m_handleMainThread; // *this driver is run by the main thread
- CMICmnStreamStdin &m_rStdin;
- CMICmnLLDBDebugger &m_rLldbDebugger;
- CMICmnStreamStdout &m_rStdOut;
- DriverState_e m_eCurrentDriverState;
- bool m_bHaveExecutableFileNamePathOnCmdLine; // True = yes, executable given
- // as one of the parameters to
- // the MI Driver, false = not
- // found
- CMIUtilString m_strCmdLineArgExecuteableFileNamePath;
- bool m_bDriverDebuggingArgExecutable; // True = the MI Driver (MI mode) is
- // debugging executable passed as
- // argument,
- // false = running via a client (e.g. Eclipse)
- bool m_bHaveCommandFileNamePathOnCmdLine; // True = file with initial commands
- // given as one of the parameters to
- // the MI Driver, false = not found
- CMIUtilString m_strCmdLineArgCommandFileNamePath;
-};
Removed: lldb/trunk/tools/lldb-mi/MIDriverBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverBase.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverBase.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverBase.cpp (removed)
@@ -1,179 +0,0 @@
-//===-- MIDriverBase.cpp ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third party headers:
-#include "lldb/API/SBBroadcaster.h"
-#include "lldb/API/SBEvent.h"
-
-// In-house headers:
-#include "MIDriverBase.h"
-
-//++
-// Details: CMIDriverBase constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIDriverBase::CMIDriverBase()
- : m_pDriverFallThru(nullptr), m_pDriverParent(nullptr), m_bExitApp(false) {}
-
-//++
-// Details: CMIDriverBase destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIDriverBase::~CMIDriverBase() { m_pDriverFallThru = nullptr; }
-
-//++
-// Details: This function allows *this driver to call on another driver to
-// perform work
-// should this driver not be able to handle the client data input.
-// Type: Overrideable.
-// Check the error message if the function returns a failure.
-// Type: Overridden.
-// Args: vCmd - (R) Command instruction to interpret.
-// vwErrMsg - (W) Status description on command failing.
-// Return: MIstatus::success - Command succeeded.
-// MIstatus::failure - Command failed.
-// Throws: None.
-//--
-bool CMIDriverBase::DoFallThruToAnotherDriver(const CMIUtilString &vCmd,
- CMIUtilString &vwErrMsg) {
- // Do nothing - override and implement. Use m_pDriverFallThru.
- return MIstatus::success;
-}
-
-//++
-// Details: This function allows *this driver to call on another driver to
-// perform work
-// should this driver not be able to handle the client data input.
-// Type: Overrideable.
-// Args: vrOtherDriver - (R) Reference to another driver object.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverBase::SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver) {
- MIunused(vrOtherDriver);
-
- // Do nothing - override and implement. Set m_pDriverFallThru.
-
- return MIstatus::success;
-}
-
-//++
-// Details: This function allows *this driver to call functionality on the
-// parent driver
-// ask for information for example.
-// Type: Overrideable.
-// Args: vrOtherDriver - (R) Reference to another driver object.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverBase::SetDriverParent(const CMIDriverBase &vrOtherDriver) {
- MIunused(vrOtherDriver);
-
- // Do nothing - override and implement. Set m_pDriverParent.
-
- return MIstatus::success;
-}
-
-//++
-// Details: Retrieve the parent driver to *this driver if one assigned. If
-// assigned *this
-// is the pass through driver that the parent driver passes work to.
-// Type: Method.
-// Args: None.
-// Return: CMIDriverBase * - Pointer to a driver object.
-// - NULL = there is not parent to *this driver.
-// Throws: None.
-//--
-CMIDriverBase *CMIDriverBase::GetDriversParent() const {
- return m_pDriverParent;
-}
-
-//++
-// Details: Retrieve the pointer to the other fall through driver *this driver
-// is using
-// (or not using).
-// Type: Method.
-// Args: None.
-// Return: CMIDriverBase * - Pointer to other driver.
-// - NULL if no driver set.
-// Throws: None.
-//--
-CMIDriverBase *CMIDriverBase::GetDriverToFallThruTo() const {
- return m_pDriverFallThru;
-}
-
-//++
-// Details: *this driver provides a file stream to other drivers on which *this
-// driver
-// write's out to and they read as expected input. *this driver is
-// passing
-// through commands to the (child) pass through assigned driver.
-// Type: Overrideable.
-// Args: None.
-// Return: FILE * - Pointer to stream.
-// Throws: None.
-//--
-FILE *CMIDriverBase::GetStdin() const {
- // Do nothing - override and implement
- return nullptr;
-}
-
-//++
-// Details: *this driver provides a file stream to other pass through assigned
-// drivers
-// so they know what to write to.
-// Type: Overrideable.
-// Args: None.
-// Return: FILE * - Pointer to stream.
-// Throws: None.
-//--
-FILE *CMIDriverBase::GetStdout() const {
- // Do nothing - override and implement
- return nullptr;
-}
-
-//++
-// Details: *this driver provides a error file stream to other pass through
-// assigned drivers
-// so they know what to write to.
-// Type: Overrideable.
-// Args: None.
-// Return: FILE * - Pointer to stream.
-// Throws: None.
-//--
-FILE *CMIDriverBase::GetStderr() const {
- // Do nothing - override and implement
- return nullptr;
-}
-
-//++
-// Details: Set the MI Driver's exit application flag. The application checks
-// this flag
-// after every stdin line is read so the exit may not be instantaneous.
-// If vbForceExit is false the MI Driver queries its state and
-// determines if is
-// should exit or continue operating depending on that running state.
-// Type: Overrideable.
-// Args: vbForceExit - (R) True = Do not query, set state to exit, false =
-// query if can/should exit right now.
-// Return: None.
-// Throws: None.
-//--
-void CMIDriverBase::SetExitApplicationFlag(const bool vbForceExit) {
- MIunused(vbForceExit);
-
- // Do nothing - override and implement
-}
Removed: lldb/trunk/tools/lldb-mi/MIDriverBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverBase.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverBase.h (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverBase.h (removed)
@@ -1,67 +0,0 @@
-//===-- MIDriverBase.h ------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers:
-#include "lldb/API/SBBroadcaster.h"
-#include "lldb/API/SBDebugger.h"
-
-// In-house headers:
-#include "MIUtilString.h"
-
-// Declarations:
-namespace lldb {
-class SBBroadcaster;
-}
-
-//++
-//============================================================================
-// Details: MI driver base implementation class. This class has been created so
-// not have to edit the lldb::SBBroadcaster class code. Functionality
-// and attributes need to be common to the LLDB Driver class and the
-// MI Driver class (derived from lldb::SBBroadcaster) so they can call
-// upon each other for functionality fall through and allow the
-// CDriverMgr to manage either (any) driver to be operated on.
-// Each driver instance (the CMIDriver, LLDB::Driver) has its own
-// LLDB::SBDebugger object.
-//--
-class CMIDriverBase {
- // Methods:
-public:
- /* ctor */ CMIDriverBase();
-
- CMIDriverBase *GetDriverToFallThruTo() const;
- CMIDriverBase *GetDriversParent() const;
-
- // Overrideable:
-public:
- /* dtor */ virtual ~CMIDriverBase();
-
- virtual bool DoFallThruToAnotherDriver(const CMIUtilString &vCmd,
- CMIUtilString &vwErrMsg);
- virtual bool SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver);
- virtual bool SetDriverParent(const CMIDriverBase &vrOtherDriver);
- virtual const CMIUtilString &GetDriverName() const = 0;
- virtual const CMIUtilString &GetDriverId() const = 0;
- virtual void SetExitApplicationFlag(const bool vbForceExit);
-
- // MI provide information for the pass through (child) assigned driver
- virtual FILE *GetStdin() const;
- virtual FILE *GetStdout() const;
- virtual FILE *GetStderr() const;
-
- // Attributes:
-protected:
- CMIDriverBase *m_pDriverFallThru; // Child driver to use should *this driver
- // not be able to handle client input
- CMIDriverBase *m_pDriverParent; // The parent driver who passes work to *this
- // driver to do work
- CMIUtilString m_strDriverId;
- bool m_bExitApp; // True = Yes, exit application, false = continue execution
-};
Removed: lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMain.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMain.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMain.cpp (removed)
@@ -1,194 +0,0 @@
-//===-- MIDriverMain.cpp ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: Defines the entry point for the console application.
-// The MI application (project name MI) runs in two modes:
-// An LLDB native driver mode where it acts no different from the
-// LLDB driver.
-// The other mode is the MI when it finds on the command line
-// the --interpreter option. Command line argument --help on its
-// own will give
-// help for the LLDB driver. If entered with --interpreter then MI
-// help will
-// provided.
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-
-// Third party headers:
-#include "lldb/API/SBHostOS.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/Signals.h"
-#include <atomic>
-#include <csignal>
-#include <stdio.h>
-
-// In house headers:
-#include "MICmnConfig.h"
-#include "MICmnResources.h"
-#include "MICmnStreamStdin.h"
-#include "MIDriver.h"
-#include "MIDriverMgr.h"
-#include "MIUtilDebug.h"
-#include "Platform.h"
-
-#if defined(_MSC_VER)
-#pragma warning( \
- once : 4530) // Warning C4530: C++ exception handler used, but unwind
- // semantics are not enabled. Specify /EHsc
-#endif // _MSC_VER
-
-// CODETAG_IOR_SIGNALS
-//++
-// Details: The SIGINT signal is sent to a process by its controlling terminal
-// when a
-// user wishes to interrupt the process. This is typically initiated by
-// pressing
-// Control-C, but on some systems, the "delete" character or "break"
-// key can be
-// used.
-// Be aware this function may be called on another thread besides the
-// main thread.
-// Type: Function.
-// Args: vSigno - (R) Signal number.
-// Return: None.
-// Throws: None.
-//--
-void sigint_handler(int vSigno) {
-#ifdef _WIN32 // Restore handler as it is not persistent on Windows
- signal(SIGINT, sigint_handler);
-#endif
- static std::atomic_flag g_interrupt_sent = ATOMIC_FLAG_INIT;
- CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
- lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
- if (pDebugger != nullptr) {
- if (!g_interrupt_sent.test_and_set()) {
- pDebugger->DispatchInputInterrupt();
- g_interrupt_sent.clear();
- }
- }
-
- // Send signal to driver so that it can take suitable action
- rDriverMgr.DeliverSignal(vSigno);
-}
-
-//++
-// Details: Init the MI driver system. Initialize the whole driver system which
-// includes
-// both the original LLDB driver and the MI driver.
-// Type: Function.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool DriverSystemInit() {
- bool bOk = MIstatus::success;
- CMIDriver &rMIDriver = CMIDriver::Instance();
- CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
- bOk = rDriverMgr.Initialize();
-
- // Register MIDriver first as it needs to initialize and be ready
- // for the Driver to get information from MIDriver when it initializes
- // (LLDB Driver is registered with the Driver Manager in MI's Initialize())
- bOk = bOk &&
- rDriverMgr.RegisterDriver(rMIDriver, "MIDriver"); // Will be main driver
-
- return bOk;
-}
-
-//++
-// Details: Shutdown the debugger system. Release / terminate resources external
-// to
-// specifically the MI driver.
-// Type: Function.
-// Args: vbAppExitOk - (R) True = No problems, false = App exiting with
-// problems (investigate!).
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool DriverSystemShutdown(const bool vbAppExitOk) {
- bool bOk = MIstatus::success;
-
- // *** Order is important here ***
- CMIDriverMgr::Instance().Shutdown();
- return bOk;
-}
-
-//++
-// Details: MI's application start point of execution. The application runs in
-// two modes.
-// An LLDB native driver mode where it acts no different from the LLDB
-// driver.
-// The other mode is the MI when it finds on the command line
-// the --interpreter option. Command line argument --help on its own
-// will give
-// help for the LLDB driver. If entered with --interpreter then
-// application
-// help will provided.
-// Type: Method.
-// Args: argc - (R) An integer that contains the count of arguments that
-// follow in
-// argv. The argc parameter is always greater than or
-// equal to 1.
-// argv - (R) An array of null-terminated strings representing
-// command-line
-// arguments entered by the user of the program. By
-// convention,
-// argv[0] is the command with which the program is
-// invoked.
-// Return: int - 0 = Normal exit, program success.
-// >0 = Program success with status i.e. Control-C signal
-// status
-// <0 = Program failed.
-// -1 = Program failed reason not specified here, see MI log
-// file.
-// -1000 = Program failed did not initialize successfully.
-// Throws: None.
-//--
-int main(int argc, char const *argv[]) {
-#if MICONFIG_DEBUG_SHOW_ATTACH_DBG_DLG
- CMIUtilDebug::WaitForDbgAttachInfinteLoop();
-#endif // MICONFIG_DEBUG_SHOW_ATTACH_DBG_DLG
-
- llvm::StringRef ToolName = argv[0];
- llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
- llvm::PrettyStackTraceProgram X(argc, argv);
-
- // *** Order is important here ***
- bool bOk = DriverSystemInit();
- if (!bOk) {
- DriverSystemShutdown(bOk);
- return -1000;
- }
-
- // CODETAG_IOR_SIGNALS
- signal(SIGINT, sigint_handler);
-
- bool bExiting = false;
- CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
- bOk = bOk && rDriverMgr.ParseArgs(argc, argv, bExiting);
- if (bOk && !bExiting)
- bOk = rDriverMgr.DriverParseArgs(argc, argv, stdout, bExiting);
- if (bOk && !bExiting)
- bOk = rDriverMgr.DriverMainLoop();
-
- // Logger and other resources shutdown now
- DriverSystemShutdown(bOk);
-
- const int appResult = bOk ? 0 : -1;
-
- return appResult;
-}
Removed: lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp (removed)
@@ -1,727 +0,0 @@
-//===-- MIDriverMgr.cpp -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third Party Headers:
-#include "lldb/API/SBError.h"
-
-// In-house headers:
-#include "MICmnLog.h"
-#include "MICmnLogMediumFile.h"
-#include "MICmnResources.h"
-#include "MICmnStreamStdout.h"
-#include "MIDriver.h"
-#include "MIDriverMgr.h"
-#include "MIUtilSingletonHelper.h"
-
-//++
-// Details: CMIDriverMgr constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIDriverMgr::CMIDriverMgr() : m_pDriverCurrent(nullptr), m_bInMi2Mode(false) {}
-
-//++
-// Details: CMIDriverMgr destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIDriverMgr::~CMIDriverMgr() { Shutdown(); }
-
-//++
-// Details: Initialize *this manager.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverMgr::Initialize() {
- m_clientUsageRefCnt++;
-
- ClrErrorDescription();
-
- if (m_bInitialized)
- return MIstatus::success;
-
- bool bOk = MIstatus::success;
- CMIUtilString errMsg;
-
- // Note initialisation order is important here as some resources depend on
- // previous
- MI::ModuleInit<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
- MI::ModuleInit<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
-
- m_bInitialized = bOk;
-
- if (!bOk) {
- CMIUtilString strInitError(CMIUtilString::Format(
- MIRSRC(IDS_MI_INIT_ERR_DRIVERMGR), errMsg.c_str()));
- SetErrorDescription(strInitError);
- return MIstatus::failure;
- }
-
- return bOk;
-}
-
-//++
-// Details: Unbind detach or release resources used by this server in general
-// common
-// functionality shared between versions of any server interfaces
-// implemented.
-// Type: Method.
-// Args: vbAppExitOk - (R) True = No problems, false = App exiting with
-// problems (investigate!).
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverMgr::Shutdown() {
- // Do not want a ref counter because this function needs to be called how ever
- // this
- // application stops running
- // if( --m_clientUsageRefCnt > 0 )
- // return MIstatus::success;
-
- ClrErrorDescription();
-
- if (!m_bInitialized)
- return MIstatus::success;
-
- m_bInitialized = false;
-
- bool bOk = MIstatus::success;
- CMIUtilString errMsg;
-
- // Tidy up
- UnregisterDriverAll();
-
- // Note shutdown order is important here
- MI::ModuleShutdown<CMICmnResources>(IDE_MI_SHTDWN_ERR_RESOURCES, bOk, errMsg);
- MI::ModuleShutdown<CMICmnLog>(IDS_MI_SHTDWN_ERR_LOG, bOk, errMsg);
-
- if (!bOk) {
- SetErrorDescriptionn(MIRSRC(IDS_MI_SHTDWN_ERR_DRIVERMGR), errMsg.c_str());
- }
-
- return bOk;
-}
-//++
-// Details: Unregister all the Driver registered with *this manager. The manager
-// also
-// deletes
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverMgr::UnregisterDriverAll() {
- MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
- while (it != m_mapDriverIdToDriver.end()) {
- IDriver *pDriver = (*it).second;
- pDriver->DoShutdown();
-
- // Next
- ++it;
- }
-
- m_mapDriverIdToDriver.clear();
- m_pDriverCurrent = nullptr;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Register a driver with *this Driver Manager. Call
-// SetUseThisDriverToDoWork()
-// inform the manager which driver is the one to the work. The manager
-// calls
-// the driver's init function which must be successful in order to
-// complete the
-// registration.
-// Type: Method.
-// Args: vrDriver - (R) The driver to register.
-// vrDriverID - (R) The driver's ID to lookup by.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverMgr::RegisterDriver(const IDriver &vrDriver,
- const CMIUtilString &vrDriverID) {
- if (HaveDriverAlready(vrDriver))
- return MIstatus::success;
-
- IDriver *pDriver = const_cast<IDriver *>(&vrDriver);
- if (!pDriver->SetId(vrDriverID))
- return MIstatus::failure;
- if (!pDriver->DoInitialize()) {
- SetErrorDescriptionn(MIRSRC(IDS_DRIVERMGR_DRIVER_ERR_INIT),
- pDriver->GetName().c_str(), vrDriverID.c_str(),
- pDriver->GetError().c_str());
- return MIstatus::failure;
- }
-
- MapPairDriverIdToDriver_t pr(vrDriverID, pDriver);
- m_mapDriverIdToDriver.insert(pr);
-
- return MIstatus::success;
-}
-
-//++
-// Details: Query the Driver Manager to see if *this manager has the driver
-// already
-// registered.
-// Type: Method.
-// Args: vrDriver - (R) The driver to query.
-// Return: True - registered.
-// False - not registered.
-// Throws: None.
-//--
-bool CMIDriverMgr::HaveDriverAlready(const IDriver &vrDriver) const {
- MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
- while (it != m_mapDriverIdToDriver.end()) {
- const IDriver *pDrvr = (*it).second;
- if (pDrvr == &vrDriver)
- return true;
-
- // Next
- ++it;
- }
-
- return false;
-}
-
-//++
-// Details: Unregister a driver from the Driver Manager. Call the
-// SetUseThisDriverToDoWork()
-// function to define another driver to do work if the one being
-// unregistered did
-// the work previously.
-// Type: Method.
-// Args: vrDriver - (R) The driver to unregister.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverMgr::UnregisterDriver(const IDriver &vrDriver) {
- const IDriver *pDrvr = nullptr;
- MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
- while (it != m_mapDriverIdToDriver.end()) {
- pDrvr = (*it).second;
- if (pDrvr == &vrDriver)
- break;
-
- // Next
- ++it;
- }
- m_mapDriverIdToDriver.erase(it);
-
- if (m_pDriverCurrent == pDrvr)
- m_pDriverCurrent = nullptr;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Specify the driver to do work. The Driver Manager drives this
-// driver. Any
-// previous driver doing work is not called anymore (so be sure the
-// previous
-// driver is in a tidy state before stopping it working).
-// Type: Method.
-// Args: vrADriver - (R) A lldb::SBBroadcaster/IDriver derived object.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverMgr::SetUseThisDriverToDoWork(const IDriver &vrADriver) {
- m_pDriverCurrent = const_cast<IDriver *>(&vrADriver);
-
- const CMIUtilString msg(
- CMIUtilString::Format(MIRSRC(IDS_DRIVER_SAY_DRIVER_USING),
- m_pDriverCurrent->GetName().c_str()));
- m_pLog->Write(msg, CMICmnLog::eLogVerbosity_Log);
-
- m_bInMi2Mode = m_pDriverCurrent->GetDriverIsGDBMICompatibleDriver();
-
- return MIstatus::success;
-}
-
-//++
-// Details: Ask *this manager which driver is currently doing the work.
-// Type: Method.
-// Args: None.
-// Return: IDriver * - Pointer to a driver, NULL if there is no current working
-// driver.
-// Throws: None.
-//--
-CMIDriverMgr::IDriver *CMIDriverMgr::GetUseThisDriverToDoWork() const {
- return m_pDriverCurrent;
-}
-
-//++
-// Details: Call this function puts *this driver to work.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverMgr::DriverMainLoop() {
- if (m_pDriverCurrent != nullptr) {
- if (!m_pDriverCurrent->DoMainLoop()) {
- const CMIUtilString errMsg(
- CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_MAINLOOP),
- m_pDriverCurrent->GetError().c_str()));
- CMICmnStreamStdout::Instance().Write(errMsg, true);
- return MIstatus::failure;
- }
- } else {
- const CMIUtilString errMsg(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET));
- CMICmnStreamStdout::Instance().Write(errMsg, true);
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Get the current driver to validate executable command line
-// arguments.
-// Type: Method.
-// Args: argc - (R) An integer that contains the count of arguments
-// that follow in
-// argv. The argc parameter is always greater than
-// or equal to 1.
-// argv - (R) An array of null-terminated strings representing
-// command-line
-// arguments entered by the user of the program. By
-// convention,
-// argv[0] is the command with which the program is
-// invoked.
-// vpStdOut - (R) Point to a standard output stream.
-// vwbExiting - (W) True = *this want to exit, false = continue to
-// work.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIDriverMgr::DriverParseArgs(const int argc, const char *argv[],
- FILE *vpStdOut, bool &vwbExiting) {
- if (m_pDriverCurrent == nullptr) {
- const CMIUtilString errMsg(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET));
- CMICmnStreamStdout::Instance().Write(errMsg, true);
- return MIstatus::failure;
- }
-
- const lldb::SBError error(
- m_pDriverCurrent->DoParseArgs(argc, argv, vpStdOut, vwbExiting));
- bool bOk = !error.Fail();
- if (!bOk) {
- CMIUtilString errMsg;
- const char *pErrorCstr = error.GetCString();
- if (pErrorCstr != nullptr)
- errMsg = CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_PARSE_ARGS),
- m_pDriverCurrent->GetName().c_str(),
- pErrorCstr);
- else
- errMsg = CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN),
- m_pDriverCurrent->GetName().c_str());
-
- bOk = CMICmnStreamStdout::Instance().Write(errMsg, true);
- }
-
- return bOk;
-}
-
-//++
-// Details: Retrieve the current driver's last error condition.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Text description.
-// Throws: None.
-//--
-CMIUtilString CMIDriverMgr::DriverGetError() const {
- if (m_pDriverCurrent != nullptr)
- return m_pDriverCurrent->GetError();
- else {
- const CMIUtilString errMsg(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET));
- CMICmnStreamStdout::Instance().Write(errMsg, true);
- }
-
- return CMIUtilString();
-}
-
-//++
-// Details: Retrieve the current driver's name.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Driver name.
-// Empty string = no current working driver specified.
-// Throws: None.
-//--
-CMIUtilString CMIDriverMgr::DriverGetName() const {
- if (m_pDriverCurrent != nullptr)
- return m_pDriverCurrent->GetName();
- else {
- const CMIUtilString errMsg(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET));
- CMICmnStreamStdout::Instance().Write(errMsg, true);
- }
-
- return CMIUtilString();
-}
-
-//++
-// Details: Retrieve the current driver's debugger object.
-// Type: Method.
-// Args: None.
-// Return: lldb::SBDebugger * - Ptr to driver's debugger object.
-// - NULL = no current working driver specified.
-// Throws: None.
-//--
-lldb::SBDebugger *CMIDriverMgr::DriverGetTheDebugger() {
- lldb::SBDebugger *pDebugger = nullptr;
- if (m_pDriverCurrent != nullptr)
- pDebugger = &m_pDriverCurrent->GetTheDebugger();
- else {
- const CMIUtilString errMsg(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET));
- CMICmnStreamStdout::Instance().Write(errMsg, true);
- }
-
- return pDebugger;
-}
-
-//++
-// Details: Check the arguments given on the command line. The main purpose of
-// this
-// function is to check for the presence of the --interpreter option.
-// Having
-// this option present tells *this manager to set the CMIDriver to do
-// work. If
-// not use the LLDB driver. The following are options that are only
-// handled by
-// the CMIDriverMgr are:
-// --help or -h
-// --interpreter
-// --version
-// --versionLong
-// --log
-// --executable
-// --log-dir
-// The above arguments are not handled by any driver object except for
-// --executable.
-// The options --interpreter and --executable in code act very similar.
-// The
-// --executable is necessary to differentiate whither the MI Driver is
-// being using
-// by a client i.e. Eclipse or from the command line. Eclipse issues
-// the option
-// --interpreter and also passes additional arguments which can be
-// interpreted as an
-// executable if called from the command line. Using --executable tells
-// the MI
-// Driver is being called the command line and that the executable
-// argument is indeed
-// a specified executable an so actions commands to set up the
-// executable for a
-// debug session. Using --interpreter on the command line does not
-// action additional
-// commands to initialise a debug session and so be able to launch the
-// process. The directory
-// where the log file is created is specified using --log-dir.
-// Type: Method.
-// Args: argc - (R) An integer that contains the count of arguments
-// that follow in
-// argv. The argc parameter is always greater than
-// or equal to 1.
-// argv - (R) An array of null-terminated strings representing
-// command-line
-// arguments entered by the user of the program. By
-// convention,
-// argv[0] is the command with which the program is
-// invoked.
-// vwbExiting - (W) True = *this want to exit, Reasons: help,
-// invalid arg(s),
-// version information only.
-// False = Continue to work, start debugger i.e.
-// Command
-// interpreter.
-// Return: lldb::SBError - LLDB current error status.
-// Throws: None.
-//--
-bool CMIDriverMgr::ParseArgs(const int argc, const char *argv[],
- bool &vwbExiting) {
- bool bOk = MIstatus::success;
-
- vwbExiting = false;
-
- // Print MI application path to the Log file
- const CMIUtilString appPath(
- CMIUtilString::Format(MIRSRC(IDS_MI_APP_FILEPATHNAME), argv[0]));
- bOk = m_pLog->Write(appPath, CMICmnLog::eLogVerbosity_Log);
-
- // Print application arguments to the Log file
- const bool bHaveArgs(argc >= 2);
- CMIUtilString strArgs(MIRSRC(IDS_MI_APP_ARGS));
- if (!bHaveArgs) {
- strArgs += MIRSRC(IDS_WORD_NONE);
- bOk = bOk && m_pLog->Write(strArgs, CMICmnLog::eLogVerbosity_Log);
- } else {
- for (MIint i = 1; i < argc; i++) {
- strArgs += CMIUtilString::Format("%d:'%s' ", i,
- CMIUtilString::WithNullAsEmpty(argv[i]));
- }
- bOk = bOk && m_pLog->Write(strArgs, CMICmnLog::eLogVerbosity_Log);
- }
-
- // Look for the command line options
- bool bHaveArgInterpret = false;
- bool bHaveArgVersion = false;
- bool bHaveArgVersionLong = false;
- bool bHaveArgLog = false;
- bool bHaveArgLogDir = false;
- bool bHaveArgHelp = false;
- CMIUtilString strLogDir;
-
- bHaveArgInterpret = true;
- if (bHaveArgs) {
- // CODETAG_MIDRIVE_CMD_LINE_ARG_HANDLING
- for (MIint i = 1; i < argc; i++) {
- // *** Add args to help in GetHelpOnCmdLineArgOptions() ***
- const CMIUtilString strArg(argv[i]);
-
- // Argument "--executable" is also check for in CMIDriver::ParseArgs()
- if (("--interpreter" == strArg) || // Given by the client such as Eclipse
- ("--executable" == strArg)) // Used to specify that there
- // is executable argument also
- // on the command line
- { // See fn description.
- bHaveArgInterpret = true;
- }
- if ("--version" == strArg) {
- bHaveArgVersion = true;
- }
- if ("--versionLong" == strArg) {
- bHaveArgVersionLong = true;
- }
- if ("--log" == strArg) {
- bHaveArgLog = true;
- }
- if (0 == strArg.compare(0, 10, "--log-dir=")) {
- strLogDir = strArg.substr(10, CMIUtilString::npos);
- bHaveArgLogDir = true;
- }
- if (("--help" == strArg) || ("-h" == strArg)) {
- bHaveArgHelp = true;
- }
- }
- }
-
- if (bHaveArgLog) {
- CMICmnLog::Instance().SetEnabled(true);
- }
-
- if (bHaveArgLogDir) {
- bOk = bOk && CMICmnLogMediumFile::Instance().SetDirectory(strLogDir);
- }
-
- // Todo: Remove this output when MI is finished. It is temporary to persuade
- // Eclipse plugin to work.
- // Eclipse reads this literally and will not work unless it gets this
- // exact version text.
- // Handle --version option (ignore the --interpreter option if present)
- if (bHaveArgVersion) {
- vwbExiting = true;
- bOk = bOk &&
- CMICmnStreamStdout::Instance().WriteMIResponse(
- MIRSRC(IDE_MI_VERSION_GDB));
- return bOk;
- }
-
- // Todo: Make this the --version when the above --version version is removed
- // Handle --versionlong option (ignore the --interpreter option if present)
- if (bHaveArgVersionLong) {
- vwbExiting = true;
- bOk =
- bOk && CMICmnStreamStdout::Instance().WriteMIResponse(GetAppVersion());
- return bOk;
- }
-
- // Both '--help' and '--interpreter' means give help for MI only. Without
- // '--interpreter' help the LLDB driver is working and so help is for that.
- if (bHaveArgHelp && bHaveArgInterpret) {
- vwbExiting = true;
- bOk = bOk &&
- CMICmnStreamStdout::Instance().WriteMIResponse(
- GetHelpOnCmdLineArgOptions());
- return bOk;
- }
-
- // This makes the assumption that there is at least one MI compatible
- // driver registered and one LLDB driver registered and the CMIDriver
- // is the first one found.
- // ToDo: Implement a better solution that handle any order, any number
- // of drivers. Or this 'feature' may be removed if deemed not required.
- IDriver *pLldbDriver = GetFirstNonMIDriver();
- IDriver *pMi2Driver = GetFirstMIDriver();
- if (bHaveArgInterpret && (pMi2Driver != nullptr))
- bOk = bOk && SetUseThisDriverToDoWork(*pMi2Driver);
- else if (pLldbDriver != nullptr)
- bOk = bOk && SetUseThisDriverToDoWork(*pLldbDriver);
- else {
- if (bOk) {
- vwbExiting = true;
- const CMIUtilString msg(MIRSRC(IDS_DRIVER_ERR_NON_REGISTERED));
- bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse(msg);
- }
- }
-
- return bOk;
-}
-
-//++
-// Details: Return formatted application version and name information.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Text data.
-// Throws: None.
-//--
-CMIUtilString CMIDriverMgr::GetAppVersion() const {
- const CMIUtilString strProj(MIRSRC(IDS_PROJNAME));
- const CMIUtilString strVsn(CMIDriver::Instance().GetVersionDescription());
- const CMIUtilString strGdb(MIRSRC(IDE_MI_VERSION_GDB));
- const CMIUtilString strVrsnInfo(CMIUtilString::Format(
- "%s\n%s\n%s", strProj.c_str(), strVsn.c_str(), strGdb.c_str()));
-
- return strVrsnInfo;
-}
-
-//++
-// Details: Return formatted help information on all the MI command line
-// options.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Text data.
-// Throws: None.
-//--
-CMIUtilString CMIDriverMgr::GetHelpOnCmdLineArgOptions() const {
- const CMIUtilString pHelp[] = {
- MIRSRC(IDE_MI_APP_DESCRIPTION), MIRSRC(IDE_MI_APP_INFORMATION),
- MIRSRC(IDE_MI_APP_ARG_USAGE), MIRSRC(IDE_MI_APP_ARG_HELP),
- MIRSRC(IDE_MI_APP_ARG_VERSION), MIRSRC(IDE_MI_APP_ARG_VERSION_LONG),
- MIRSRC(IDE_MI_APP_ARG_INTERPRETER), MIRSRC(IDE_MI_APP_ARG_SOURCE),
- MIRSRC(IDE_MI_APP_ARG_EXECUTEABLE),
- MIRSRC(IDE_MI_APP_ARG_SYNCHRONOUS),
- CMIUtilString::Format(
- MIRSRC(IDE_MI_APP_ARG_APP_LOG),
- CMICmnLogMediumFile::Instance().GetFileName().c_str()),
- MIRSRC(IDE_MI_APP_ARG_APP_LOG_DIR), MIRSRC(IDE_MI_APP_ARG_EXECUTABLE),
- MIRSRC(IDS_CMD_QUIT_HELP), MIRSRC(IDE_MI_APP_ARG_EXAMPLE)};
- const MIuint nHelpItems = sizeof pHelp / sizeof pHelp[0];
- CMIUtilString strHelp;
- for (MIuint i = 0; i < nHelpItems; i++) {
- strHelp += pHelp[i];
- strHelp += "\n\n";
- }
-
- return strHelp;
-}
-
-//++
-// Details: Search the registered drivers and return the first driver which says
-// it is
-// GDB/MI compatible i.e. the CMIDriver class.
-// Type: Method.
-// Args: None.
-// Return: IDriver * - Ptr to driver, NULL = no driver found.
-// Throws: None.
-//--
-CMIDriverMgr::IDriver *CMIDriverMgr::GetFirstMIDriver() const {
- IDriver *pDriver = nullptr;
- MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
- while (it != m_mapDriverIdToDriver.end()) {
- const CMIUtilString &rDrvId = (*it).first;
- MIunused(rDrvId);
- IDriver *pDvr = (*it).second;
- if (pDvr->GetDriverIsGDBMICompatibleDriver()) {
- pDriver = pDvr;
- break;
- }
-
- // Next
- ++it;
- }
-
- return pDriver;
-}
-
-//++
-// Details: Search the registered drivers and return the first driver which says
-// it is
-// not GDB/MI compatible i.e. the LLDB Driver class.
-// Type: Method.
-// Args: None.
-// Return: IDriver * - Ptr to driver, NULL = no driver found.
-// Throws: None.
-//--
-CMIDriverMgr::IDriver *CMIDriverMgr::GetFirstNonMIDriver() const {
- IDriver *pDriver = nullptr;
- MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
- while (it != m_mapDriverIdToDriver.end()) {
- const CMIUtilString &rDrvId = (*it).first;
- MIunused(rDrvId);
- IDriver *pDvr = (*it).second;
- if (!pDvr->GetDriverIsGDBMICompatibleDriver()) {
- pDriver = pDvr;
- break;
- }
-
- // Next
- ++it;
- }
-
- return pDriver;
-}
-
-//++
-// Details: Search the registered drivers and return driver with the specified
-// ID.
-// Type: Method.
-// Args: vrDriverId - (R) ID of a driver.
-// Return: IDriver * - Ptr to driver, NULL = no driver found.
-// Throws: None.
-//--
-CMIDriverMgr::IDriver *
-CMIDriverMgr::GetDriver(const CMIUtilString &vrDriverId) const {
- MapDriverIdToDriver_t::const_iterator it =
- m_mapDriverIdToDriver.find(vrDriverId);
- if (it == m_mapDriverIdToDriver.end())
- return nullptr;
-
- IDriver *pDriver = (*it).second;
-
- return pDriver;
-}
-
-//++
-// Details: Gets called when lldb-mi gets a signal. Passed signal to current
-// driver.
-//
-// Type: Method.
-// Args: signal that was delivered
-// Return: None.
-// Throws: None.
-//--
-void CMIDriverMgr::DeliverSignal(int signal) {
- if (m_pDriverCurrent != nullptr)
- m_pDriverCurrent->DeliverSignal(signal);
-}
Removed: lldb/trunk/tools/lldb-mi/MIDriverMgr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMgr.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMgr.h (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMgr.h (removed)
@@ -1,128 +0,0 @@
-//===-- MIDriverMgr.h -------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers:
-#include "lldb/API/SBDebugger.h"
-#include <map>
-
-// In-house headers:
-#include "MICmnBase.h"
-#include "MICmnLog.h"
-#include "MIUtilSingletonBase.h"
-#include "MIUtilString.h"
-
-//++
-//============================================================================
-// Details: MI Driver Manager. Register lldb::SBBroadcaster derived Driver type
-// objects with *this manager. The manager does not own driver objects
-// registered with it and so will not delete when this manager is
-// shutdown. The Driver flagged as "use this one" will be set as
-// current
-// driver and will be the one that is used. Other drivers are not
-// operated. A Driver can call another Driver should it not handle a
-// command.
-// It also initializes other resources as part it's setup such as the
-// Logger and Resources objects (explicit indicate *this object
-// requires
-// those objects (modules/components) to support it's own
-// functionality).
-// The Driver manager is the first object instantiated as part of the
-// MI code base. It is also the first thing to interpret the command
-// line arguments passed to the executable. Bases on options it
-// understands the manage will set up the appropriate driver or give
-// help information. Other options are passed on to the driver chosen
-// to do work.
-// Each driver instance (the CMIDriver, LLDB::Driver) has its own
-// LLDB::SBDebugger.
-// Singleton class.
-//--
-class CMIDriverMgr : public CMICmnBase, public MI::ISingleton<CMIDriverMgr> {
- friend MI::ISingleton<CMIDriverMgr>;
-
- // Class:
-public:
- //++
- // Description: Driver deriver objects need this interface to work with
- // *this manager.
- //--
- class IDriver {
- public:
- virtual bool DoInitialize() = 0;
- virtual bool DoShutdown() = 0;
- virtual bool DoMainLoop() = 0;
- virtual lldb::SBError DoParseArgs(const int argc, const char *argv[],
- FILE *vpStdOut, bool &vwbExiting) = 0;
- virtual CMIUtilString GetError() const = 0;
- virtual const CMIUtilString &GetName() const = 0;
- virtual lldb::SBDebugger &GetTheDebugger() = 0;
- virtual bool GetDriverIsGDBMICompatibleDriver() const = 0;
- virtual bool SetId(const CMIUtilString &vId) = 0;
- virtual const CMIUtilString &GetId() const = 0;
- virtual void DeliverSignal(int signal) = 0;
-
- // Not part of the interface, ignore
- /* dtor */ virtual ~IDriver() {}
- };
-
- // Methods:
-public:
- // MI system
- bool Initialize() override;
- bool Shutdown() override;
- //
- CMIUtilString GetAppVersion() const;
- bool RegisterDriver(const IDriver &vrADriver,
- const CMIUtilString &vrDriverID);
- bool UnregisterDriver(const IDriver &vrADriver);
- bool SetUseThisDriverToDoWork(
- const IDriver &vrADriver); // Specify working main driver
- IDriver *GetUseThisDriverToDoWork() const;
- bool ParseArgs(const int argc, const char *argv[], bool &vwbExiting);
- IDriver *GetDriver(const CMIUtilString &vrDriverId) const;
- //
- // MI Proxy fn to current specified working driver
- bool DriverMainLoop();
- bool DriverParseArgs(const int argc, const char *argv[], FILE *vpStdOut,
- bool &vwbExiting);
- CMIUtilString DriverGetError() const;
- CMIUtilString DriverGetName() const;
- lldb::SBDebugger *DriverGetTheDebugger();
- void DeliverSignal(int signal);
-
- // Typedef:
-private:
- typedef std::map<CMIUtilString, IDriver *> MapDriverIdToDriver_t;
- typedef std::pair<CMIUtilString, IDriver *> MapPairDriverIdToDriver_t;
-
- // Methods:
-private:
- /* ctor */ CMIDriverMgr();
- /* ctor */ CMIDriverMgr(const CMIDriverMgr &);
- void operator=(const CMIDriverMgr &);
- //
- bool HaveDriverAlready(const IDriver &vrMedium) const;
- bool UnregisterDriverAll();
- IDriver *GetFirstMIDriver() const;
- IDriver *GetFirstNonMIDriver() const;
- CMIUtilString GetHelpOnCmdLineArgOptions() const;
-
- // Overridden:
-private:
- // From CMICmnBase
- /* dtor */ ~CMIDriverMgr() override;
-
- // Attributes:
-private:
- MapDriverIdToDriver_t m_mapDriverIdToDriver;
- IDriver *m_pDriverCurrent; // This driver is used by this manager to do work.
- // It is the main driver.
- bool m_bInMi2Mode; // True = --interpreter entered on the cmd line, false =
- // operate LLDB driver (non GDB)
-};
Removed: lldb/trunk/tools/lldb-mi/MIExtensions.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIExtensions.txt?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIExtensions.txt (original)
+++ lldb/trunk/tools/lldb-mi/MIExtensions.txt (removed)
@@ -1,104 +0,0 @@
-# -file-exec-and-symbols now takes two new (optional) options:
-
-Synopsis
-
- -file-exec-and-symbols <file> [-p <platform>] [-r <remote-file>]
-
-Specify the executable file to be debugged. This file is the one from which the symbol table is also read.
-When debugging remote targets specify a remote-file for execution and a file from which symbols are read.
-The optional platform is the name of the platform, e.g., "remote-ios" or "ios-simulator". The remote-file
-is the on-device path to the exe.
-
-# -data-info-line
-
-Synopsis
-
- -data-info-line *<address>
- -data-info-line <file>:<line>
-
-Provides information about a source line. The input can be <address> like 0x12345678 or <file>:<line>
-where file is a name of source file and line is the line number. As a result the command returns the following
-fields:
- start - address of the first instruction which refers to that source line
- end - address of the last instruction which refers to that source line
- file - the file name
- line - the line number
-The last two fields are useful in case you have specified a source line using its address.
-
-Example:
- -data-info-line *0x100000f80
- ^done,start="0x0000000100000f80",end="0x0000000100000f94",file="/Users/IliaK/p/hello.cpp",line="15"
-
- -data-info-line hello.cpp:15
- ^done,start="0x0000000100000f80",end="0x0000000100000f94",file="/Users/IliaK/p/hello.cpp",line="15"
-
-# -data-read-memory-bytes
-
-Synopsis
-
- -data-read-memory-bytes [--thread <thread-id>] [--frame <frame-index>] [-o <byte-offset>] <address> <count>
-
-Where:
-
- `address`
- An expression specifying the start of the memory range to read.
- `count`
- Number of bytes to read.
- `byte-offset`
- Relative offset in bytes from `address` where reading should start.
- `thread-id`
- Integer identifier of the thread within which the expression should be evaluated,
- if this option is omitted the currently selected thread will be used.
- This option is not in the MI specification but is implemented by GDB.
- `frame-index`
- Index of the frame within which the expression should be evaluated,
- if this option is omitted the currently selected frame will be used.
- This option is not in the MI specification but is implemented by GDB.
-
-Reads a block of memory from the specified range.
-
-Note that currently this command works in an all-or-nothing fashion where it either reads the entire
-block of memory successfully and returns it as a single block, or it returns an error. This doesn't
-quite match up with the MI specification that says that subsets of the specified range may be
-returned as individual blocks if only some of the memory within the specified range is accessible.
-
-The result record for this command may contain one or more tuples representing the blocks of memory
-that were read, where each tuple has the following fields:
-
- `begin`
- The start of the address range for this block (in hex notation).
- `end`
- The end of the address range for this block (in hex notation).
- `offset`
- Offset of this block from `address` (that was passed in as an argument).
- `contents`
- The actual data in this block (in hex notation).
-
-Example:
-
- (gdb)
- -data-read-memory-bytes &array 4
- ^done,memory=[{begin="0x00007fffffffeccc",offset="0x0000000000000000",end="0x00007fffffffecd0",contents="01020304"}]
- (gdb)
-
-# =library-loaded notification
-
-The =library-loaded notification has 4 extra fields:
- symbols-loaded - indicates that there are symbols for the loaded library
- symbols-path - if symbols are exist then it contains a path for symbols of the loaded library
- loaded_addr - contains an address of the loaded library or "-" if address isn't resolved yet
- size - contains the size in bytes of the section loaded at 'loaded_addr'
-
-For example:
- =library-loaded,id="/Users/IliaK/p/hello",target-name="/Users/IliaK/p/hello",host-name="/Users/IliaK/p/hello",symbols-loaded="1",symbols-path="/Users/IliaK/p/hello.dSYM/Contents/Resources/DWARF/hello",loaded_addr="-",size="4096"
- =library-loaded,id="/usr/lib/dyld",target-name="/usr/lib/dyld",host-name="/usr/lib/dyld",symbols-loaded="0",loaded_addr="0x00007fff5fc00000",size="4096"
-
-# -target-attach
-
-Synopsis
-
-Additional syntax provided by lldb-mi:
- -target-attach -n <executable-name> [--waitfor]
-
-Attach to an executable. Using -n allows specifying an executable name to attach to.
-Using this with --watifor can do a deffered attach. The flags -n and --waitfor match the syntax of lldb proper's 'process attach' command.
Removed: lldb/trunk/tools/lldb-mi/MIReadMe.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIReadMe.txt?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIReadMe.txt (original)
+++ lldb/trunk/tools/lldb-mi/MIReadMe.txt (removed)
@@ -1,37 +0,0 @@
-========================================================================
- The MI Driver - LLDB Machine Interface V2 (MI) Project Overview
-========================================================================
-
-The MI Driver is a stand alone executable that either be used via a
-client i.e. Eclipse or directly from the command line.
-
-For help information on using the MI driver type at the command line:
-
- lldb-mi --interpreter --help
-
-A blog about the MI Driver is available on CodePlay's website. Although it may not be
-completely accurate after the recent changes in lldb-mi.
-http://www.codeplay.com/portal/lldb-mi-driver---part-1-introduction
-
-In MI mode and invoked with --log option, lldb-mi generates lldb-mi-log.txt
-This file keeps a history of the MI Driver's activity for one session. It is
-used to aid the debugging of the MI Driver. It also gives warnings about
-command's which do not support certain argument or options.
-
-Note any command or text sent to the MI Driver in MI mode that is not a command
-registered in the MI Driver's Command Factory will be rejected and an error message
-will be generated.
-
-All the files prefix with MI are specifically for the MI driver code only.
-File MIDriverMain.cpp contains the executables main() function.
-
-=========================================================================
-Current limitations:
-1. Not all commands and their options have been implemented. Please see
-the source code for details.
-2. LLDB-MI may have additional arguments not used in GDB MI. Please see
-MIExtensions.txt
-
-=========================================================================
-The MI Driver build configuration:
-MICmnConfig.h defines various preprocessor build options.
Removed: lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.cpp (removed)
@@ -1,84 +0,0 @@
-//===-- MIUtilDateTimeStd.cpp -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MIUtilDateTimeStd.h"
-#include "MICmnResources.h"
-
-//++
-// Details: CMIUtilDateTimeStd constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilDateTimeStd::CMIUtilDateTimeStd() {}
-
-//++
-// Details: CMIUtilDateTimeStd destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilDateTimeStd::~CMIUtilDateTimeStd() {}
-
-//++
-// Details: Retrieve system local current date. Format is MM/DD/YYYY.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Text description.
-// Throws: None.
-//--
-CMIUtilString CMIUtilDateTimeStd::GetDate() {
- CMIUtilString strDate(MIRSRC(IDS_WORD_INVALIDBRKTS));
-
- std::time(&m_rawTime);
- const std::tm *pTi = std::localtime(&m_rawTime);
- if (std::strftime(&m_pScratch[0], sizeof(m_pScratch), "%d/%m/%y", pTi) > 0)
- strDate = m_pScratch;
-
- return strDate;
-}
-
-//++
-// Details: Retrieve system local current time. Format is HH:MM:SS 24 hour
-// clock.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Text description.
-// Throws: None.
-//--
-CMIUtilString CMIUtilDateTimeStd::GetTime() {
- std::time(&m_rawTime);
- const std::tm *pTi = std::localtime(&m_rawTime);
- const CMIUtilString seconds(CMIUtilString::Format("%d", pTi->tm_sec));
- const CMIUtilString zero((seconds.length() == 1) ? "0" : "");
- const CMIUtilString strTime(CMIUtilString::Format(
- "%d:%d:%s%s", pTi->tm_hour, pTi->tm_min, zero.c_str(), seconds.c_str()));
-
- return strTime;
-}
-
-//++
-// Details: Retrieve system local current date and time in yyyy-MM-dd--HH-mm-ss
-// format for log file names.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Text description.
-// Throws: None.
-//--
-CMIUtilString CMIUtilDateTimeStd::GetDateTimeLogFilename() {
- std::time(&m_rawTime);
- const std::tm *pTi = std::localtime(&m_rawTime);
- const CMIUtilString strTime(CMIUtilString::Format(
- "%d%02d%02d%02d%02d%02d", pTi->tm_year + 1900, pTi->tm_mon, pTi->tm_mday,
- pTi->tm_hour, pTi->tm_min, pTi->tm_sec));
-
- return strTime;
-}
Removed: lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.h (removed)
@@ -1,40 +0,0 @@
-//===-- MIUtilDateTimeStd.h -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers
-#include <ctime>
-
-// In-house headers:
-#include "MIUtilString.h"
-
-//++
-//============================================================================
-// Details: MI common code utility class. Used to retrieve system local date
-// time.
-//--
-class CMIUtilDateTimeStd {
- // Methods:
-public:
- /* ctor */ CMIUtilDateTimeStd();
-
- CMIUtilString GetDate();
- CMIUtilString GetTime();
- CMIUtilString GetDateTimeLogFilename();
-
- // Overrideable:
-public:
- // From CMICmnBase
- /* dtor */ virtual ~CMIUtilDateTimeStd();
-
- // Attributes:
-private:
- std::time_t m_rawTime;
- char m_pScratch[16];
-};
Removed: lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp (removed)
@@ -1,91 +0,0 @@
-//===-- MIUtilDebug.cpp -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third party headers:
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-// In-house headers:
-#include "MICmnLog.h"
-#include "MIDriver.h"
-#include "MIUtilDebug.h"
-
-//++
-// Details: CMIUtilDebug constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilDebug::CMIUtilDebug() {}
-
-//++
-// Details: CMIUtilDebug destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilDebug::~CMIUtilDebug() {}
-
-//++
-// Details: Temporarily stall the process/application to give the programmer the
-// opportunity to attach a debugger. How to use: Put a break in the
-// programmer
-// where you want to visit, run the application then attach your
-// debugger to the
-// application. Hit the debugger's pause button and the debugger should
-// should
-// show this loop. Change the i variable value to break out of the loop
-// and
-// visit your break point.
-// Type: Static method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilDebug::WaitForDbgAttachInfinteLoop() {
- MIuint i = 0;
- while (i == 0) {
- const std::chrono::milliseconds time(100);
- std::this_thread::sleep_for(time);
- }
-}
-
-
-// Instantiations:
-CMICmnLog &CMIUtilDebugFnTrace::ms_rLog = CMICmnLog::Instance();
-MIuint CMIUtilDebugFnTrace::ms_fnDepthCnt = 0;
-
-//++
-// Details: CMIUtilDebugFnTrace constructor.
-// Type: Method.
-// Args: vFnName - (R) The text to insert into the log.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilDebugFnTrace::CMIUtilDebugFnTrace(const CMIUtilString &vFnName)
- : m_strFnName(vFnName) {
- const CMIUtilString txt(
- CMIUtilString::Format("%d>%s", ++ms_fnDepthCnt, m_strFnName.c_str()));
- ms_rLog.Write(txt, CMICmnLog::eLogVerbosity_FnTrace);
-}
-
-//++
-// Details: CMIUtilDebugFnTrace destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilDebugFnTrace::~CMIUtilDebugFnTrace() {
- const CMIUtilString txt(
- CMIUtilString::Format("%d<%s", ms_fnDepthCnt--, m_strFnName.c_str()));
- ms_rLog.Write(txt, CMICmnLog::eLogVerbosity_FnTrace);
-}
Removed: lldb/trunk/tools/lldb-mi/MIUtilDebug.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilDebug.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilDebug.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilDebug.h (removed)
@@ -1,79 +0,0 @@
-//===-- MIUtilDebug.h -------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-#define MI_USE_DEBUG_TRACE_FN // Undefine to compile out fn trace code
-
-// In-house headers:
-#include "MIUtilString.h"
-
-// Declarations:
-class CMICmnLog;
-
-//++
-//============================================================================
-// Details: MI debugging aid utility class.
-//--
-class CMIUtilDebug {
- // Statics:
-public:
- static void WaitForDbgAttachInfinteLoop();
-
- // Methods:
-public:
- /* ctor */ CMIUtilDebug();
-
- // Overrideable:
-public:
- // From CMICmnBase
- /* dtor */ virtual ~CMIUtilDebug();
-};
-
-//++
-//============================================================================
-// Details: MI debug utility class. Used to indicate the current function
-// depth in the call stack. It uses the CMIlCmnLog logger to output
-// the current fn trace information.
-// Use macro MI_TRACEFN( "Some fn name" ) and implement the scope of
-// the functions you wish to build up a trace off.
-// Use preprocessor definition MI_USE_DEBUG_TRACE_FN to turn off or on
-// tracing code.
-//--
-class CMIUtilDebugFnTrace {
- // Methods:
-public:
- /* ctor */ CMIUtilDebugFnTrace(const CMIUtilString &vFnName);
-
- // Overrideable:
-public:
- // From CMICmnBase
- /* dtor */ virtual ~CMIUtilDebugFnTrace();
-
- // Attributes:
-private:
- const CMIUtilString m_strFnName;
-
- static CMICmnLog &ms_rLog;
- static MIuint ms_fnDepthCnt; // Increment count as fn depth increases,
- // decrement count as fn stack pops off
-};
-
-//++
-//============================================================================
-// Details: Take the given text and send it to the server's Logger to output to
-// the
-// trace file.
-// Type: Compile preprocess.
-// Args: x - (R) Message (may be seen by user).
-//--
-#ifdef MI_USE_DEBUG_TRACE_FN
-#define MI_TRACEFN(x) CMIUtilDebugFnTrace __MITrace(x)
-#else
-#define MI_TRACEFN(x)
-#endif // MI_USE_DEBUG_TRACE_FN
Removed: lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp (removed)
@@ -1,282 +0,0 @@
-//===-- MIUtilFileStd.cpp ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third party headers
-#include <assert.h>
-#include <cerrno>
-#include <stdio.h>
-#include <string.h>
-
-// In-house headers:
-#include "MICmnResources.h"
-#include "MIUtilFileStd.h"
-#include "lldb/Host/FileSystem.h"
-
-#include "llvm/Support/ConvertUTF.h"
-#include "llvm/Support/Errno.h"
-
-//++
-// Details: CMIUtilFileStd constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilFileStd::CMIUtilFileStd()
- : m_fileNamePath(CMIUtilString()), m_pFileHandle(nullptr)
-#if defined(_MSC_VER)
- ,
- m_constCharNewLine("\r\n")
-#else
- ,
- m_constCharNewLine("\n")
-#endif // #if defined( _MSC_VER )
- ,
- m_bFileError(false) {
-}
-
-//++
-// Details: CMIUtilFileStd destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilFileStd::~CMIUtilFileStd() { Close(); }
-
-//++
-// Details: Open file for writing. On the first call to this function after
-// *this object
-// is created the file is either created or replace, from then on open
-// only opens
-// an existing file.
-// Type: Method.
-// Args: vFileNamePath - (R) File name path.
-// vwrbNewCreated - (W) True - file recreated, false - file appended
-// too.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilFileStd::CreateWrite(const CMIUtilString &vFileNamePath,
- bool &vwrbNewCreated) {
- // Reset
- m_bFileError = false;
- vwrbNewCreated = false;
-
- if (vFileNamePath.empty()) {
- m_bFileError = true;
- SetErrorDescription(MIRSRC(IDS_UTIL_FILE_ERR_INVALID_PATHNAME));
- return MIstatus::failure;
- }
-
- // File is already open so exit
- if (m_pFileHandle != nullptr)
- return MIstatus::success;
-
-#if !defined(_MSC_VER)
- // Open with 'write' and 'binary' mode
- m_pFileHandle = llvm::sys::RetryAfterSignal(nullptr, ::fopen,
- vFileNamePath.c_str(), "wb");
-#else
- // Open a file with exclusive write and shared read permissions
- std::wstring path;
- if (llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path))
- m_pFileHandle = ::_wfsopen(path.c_str(), L"wb", _SH_DENYWR);
- else {
- errno = EINVAL;
- m_pFileHandle = nullptr;
- }
-#endif // !defined( _MSC_VER )
-
- if (m_pFileHandle == nullptr) {
- m_bFileError = true;
- SetErrorDescriptionn(MIRSRC(IDS_UTIL_FILE_ERR_OPENING_FILE),
- strerror(errno), vFileNamePath.c_str());
- return MIstatus::failure;
- }
-
- vwrbNewCreated = true;
- m_fileNamePath = vFileNamePath;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Write data to existing opened file.
-// Type: Method.
-// Args: vData - (R) Text data.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilFileStd::Write(const CMIUtilString &vData) {
- if (vData.size() == 0)
- return MIstatus::success;
-
- if (m_bFileError)
- return MIstatus::failure;
-
- if (m_pFileHandle == nullptr) {
- m_bFileError = true;
- SetErrorDescriptionn(MIRSRC(IDE_UTIL_FILE_ERR_WRITING_NOTOPEN),
- m_fileNamePath.c_str());
- return MIstatus::failure;
- }
-
- // Get the string size
- MIuint size = vData.size();
- if (::fwrite(vData.c_str(), 1, size, m_pFileHandle) == size) {
- // Flush the data to the file
- ::fflush(m_pFileHandle);
- return MIstatus::success;
- }
-
- // Not all of the data has been transferred
- m_bFileError = true;
- SetErrorDescriptionn(MIRSRC(IDE_UTIL_FILE_ERR_WRITING_FILE),
- m_fileNamePath.c_str());
- return MIstatus::failure;
-}
-
-//++
-// Details: Write data to existing opened file.
-// Type: Method.
-// Args: vData - (R) Text data.
-// vCharCnt - (R) Text data length.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilFileStd::Write(const char *vpData, const MIuint vCharCnt) {
- if (vCharCnt == 0)
- return MIstatus::success;
-
- if (m_bFileError)
- return MIstatus::failure;
-
- if (m_pFileHandle == nullptr) {
- m_bFileError = true;
- SetErrorDescriptionn(MIRSRC(IDE_UTIL_FILE_ERR_WRITING_NOTOPEN),
- m_fileNamePath.c_str());
- return MIstatus::failure;
- }
-
- if (::fwrite(vpData, 1, vCharCnt, m_pFileHandle) == vCharCnt) {
- // Flush the data to the file
- ::fflush(m_pFileHandle);
- return MIstatus::success;
- }
-
- // Not all of the data has been transferred
- m_bFileError = true;
- SetErrorDescriptionn(MIRSRC(IDE_UTIL_FILE_ERR_WRITING_FILE),
- m_fileNamePath.c_str());
- return MIstatus::failure;
-}
-
-//++
-// Details: Close existing opened file. Note Close() must must an open!
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilFileStd::Close() {
- if (m_pFileHandle == nullptr)
- return;
-
- ::fclose(m_pFileHandle);
- m_pFileHandle = nullptr;
- // m_bFileError = false; Do not reset as want to remain until next attempt at
- // open or create
-}
-
-//++
-// Details: Retrieve state of whether the file is ok.
-// Type: Method.
-// Args: None.
-// Return: True - file ok.
-// False - file has a problem.
-// Throws: None.
-//--
-bool CMIUtilFileStd::IsOk() const { return !m_bFileError; }
-
-//++
-// Details: Status on a file existing already.
-// Type: Method.
-// Args: vFileNamePath.
-// Return: True - Exists.
-// False - Not found.
-// Throws: None.
-//--
-bool CMIUtilFileStd::IsFileExist(const CMIUtilString &vFileNamePath) const {
- if (vFileNamePath.empty())
- return false;
-
- FILE *pTmp = nullptr;
- pTmp = llvm::sys::RetryAfterSignal(nullptr, ::fopen,
- vFileNamePath.c_str(), "wb");
- if (pTmp != nullptr) {
- ::fclose(pTmp);
- return true;
- }
-
- return false;
-}
-
-//++
-// Details: Retrieve the file current carriage line return characters used.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString & - Text.
-// Throws: None.
-//--
-const CMIUtilString &CMIUtilFileStd::GetLineReturn() const {
- return m_constCharNewLine;
-}
-
-//++
-// Details: Given a file name directory path, strip off the filename and return
-// the path.
-// It look for either backslash or forward slash.
-// Type: Method.
-// Args: vDirectoryPath - (R) Text directory path.
-// Return: CMIUtilString - Directory path.
-// Throws: None.
-//--
-CMIUtilString
-CMIUtilFileStd::StripOffFileName(const CMIUtilString &vDirectoryPath) {
- const size_t nPos = vDirectoryPath.rfind('\\');
- size_t nPos2 = vDirectoryPath.rfind('/');
- if ((nPos == std::string::npos) && (nPos2 == std::string::npos))
- return vDirectoryPath;
-
- if (nPos > nPos2)
- nPos2 = nPos;
-
- const CMIUtilString strPath(vDirectoryPath.substr(0, nPos2).c_str());
- return strPath;
-}
-
-//++
-// Details: Return either backslash or forward slash appropriate to the OS this
-// application
-// is running on.
-// Type: Static method.
-// Args: None.
-// Return: char - '/' or '\' character.
-// Throws: None.
-//--
-char CMIUtilFileStd::GetSlash() {
-#if !defined(_MSC_VER)
- return '/';
-#else
- return '\\';
-#endif // !defined( _MSC_VER )
-}
Removed: lldb/trunk/tools/lldb-mi/MIUtilFileStd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilFileStd.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilFileStd.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilFileStd.h (removed)
@@ -1,48 +0,0 @@
-//===-- MIUtilFileStd.h -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmnBase.h"
-#include "MIUtilString.h"
-
-//++
-//============================================================================
-// Details: MI common code utility class. File handling.
-//--
-class CMIUtilFileStd : public CMICmnBase {
- // Static:
-public:
- static char GetSlash();
-
- // Methods:
-public:
- /* ctor */ CMIUtilFileStd();
- //
- bool CreateWrite(const CMIUtilString &vFileNamePath, bool &vwrbNewCreated);
- bool Write(const CMIUtilString &vData);
- bool Write(const char *vpData, const MIuint vCharCnt);
- void Close();
- bool IsOk() const;
- bool IsFileExist(const CMIUtilString &vFileNamePath) const;
- const CMIUtilString &GetLineReturn() const;
- static CMIUtilString StripOffFileName(const CMIUtilString &vDirectoryPath);
-
- // Overridden:
-public:
- // From CMICmnBase
- /* dtor */ ~CMIUtilFileStd() override;
-
- // Attributes:
-private:
- CMIUtilString m_fileNamePath;
- FILE *m_pFileHandle;
- CMIUtilString m_constCharNewLine;
- bool m_bFileError; // True = have a file error ATM, false = all ok
-};
Removed: lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.cpp (removed)
@@ -1,99 +0,0 @@
-//===-- MIUtilMapIdToVariant.cpp --------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MIUtilMapIdToVariant.h"
-
-//++
-// Details: CMIUtilMapIdToVariant constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilMapIdToVariant::CMIUtilMapIdToVariant() {}
-
-//++
-// Details: CMIUtilMapIdToVariant destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilMapIdToVariant::~CMIUtilMapIdToVariant() {}
-
-//++
-// Details: Remove at the data from *this container.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilMapIdToVariant::Clear() { m_mapKeyToVariantValue.clear(); }
-
-//++
-// Details: Check an ID is present already in *this container.
-// Type: Method.
-// Args: vId - (R) Unique ID i.e. GUID.
-// Return: True - registered.
-// False - not found.
-// Throws: None.
-//--
-bool CMIUtilMapIdToVariant::HaveAlready(const CMIUtilString &vId) const {
- const MapKeyToVariantValue_t::const_iterator it =
- m_mapKeyToVariantValue.find(vId);
- return it != m_mapKeyToVariantValue.end();
-}
-
-//++
-// Details: Determine if *this container is currently holding any data.
-// Type: Method.
-// Args: None.
-// Return: bool - True - Yes empty, false - one or more data object present.
-// Throws: None.
-//--
-bool CMIUtilMapIdToVariant::IsEmpty() const {
- return m_mapKeyToVariantValue.empty();
-}
-
-//++
-// Details: Check the ID is valid to be registered.
-// Type: Method.
-// Args: vId - (R) Unique ID i.e. GUID.
-// Return: True - valid.
-// False - not valid.
-// Throws: None.
-//--
-bool CMIUtilMapIdToVariant::IsValid(const CMIUtilString &vId) const {
- bool bValid = true;
-
- if (vId.empty())
- bValid = false;
-
- return bValid;
-}
-
-//++
-// Details: Remove from *this contain a data object specified by ID. The data
-// object
-// when removed also calls its destructor should it have one.
-// Type: Method.
-// Args: vId - (R) Unique ID i.e. GUID.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilMapIdToVariant::Remove(const CMIUtilString &vId) {
- const MapKeyToVariantValue_t::const_iterator it =
- m_mapKeyToVariantValue.find(vId);
- if (it != m_mapKeyToVariantValue.end()) {
- m_mapKeyToVariantValue.erase(it);
- }
-
- return MIstatus::success;
-}
Removed: lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.h (removed)
@@ -1,129 +0,0 @@
-//===-- MIUtilMapIdToVariant.h ----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers:
-#include <map>
-
-// In-house headers:
-#include "MICmnBase.h"
-#include "MICmnResources.h"
-#include "MIUtilString.h"
-#include "MIUtilVariant.h"
-
-//++
-//============================================================================
-// Details: MI common code utility class. Map type container that hold general
-// object types (by being a variant wrapper)
-// objects by ID.
-//--
-class CMIUtilMapIdToVariant : public CMICmnBase {
- // Methods:
-public:
- /* ctor */ CMIUtilMapIdToVariant();
-
- template <typename T> bool Add(const CMIUtilString &vId, const T &vData);
- void Clear();
- template <typename T>
- bool Get(const CMIUtilString &vId, T &vrwData, bool &vrwbFound) const;
- bool HaveAlready(const CMIUtilString &vId) const;
- bool IsEmpty() const;
- bool Remove(const CMIUtilString &vId);
-
- // Overridden:
-public:
- // From CMICmnBase
- /* dtor */ ~CMIUtilMapIdToVariant() override;
-
- // Typedefs:
-private:
- typedef std::map<CMIUtilString, CMIUtilVariant> MapKeyToVariantValue_t;
- typedef std::pair<CMIUtilString, CMIUtilVariant> MapPairKeyToVariantValue_t;
-
- // Methods:
-private:
- bool IsValid(const CMIUtilString &vId) const;
-
- // Attributes:
- MapKeyToVariantValue_t m_mapKeyToVariantValue;
-};
-
-//++
-// Details: Add to *this container a data object of general type identified by
-// an ID.
-// If the data with that ID already exists in the container it is
-// replace with
-// the new data specified.
-// Type: Method.
-// Args: T - The data object's variable type.
-// vId - (R) Unique ID i.e. GUID.
-// vData - (R) The general data object to be stored of some type.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-template <typename T>
-bool CMIUtilMapIdToVariant::Add(const CMIUtilString &vId, const T &vData) {
- if (!IsValid(vId)) {
- SetErrorDescription(CMIUtilString::Format(
- MIRSRC(IDS_VARIANT_ERR_MAP_KEY_INVALID), vId.c_str()));
- return MIstatus::failure;
- }
-
- const bool bOk = HaveAlready(vId) ? Remove(vId) : MIstatus::success;
- if (bOk) {
- CMIUtilVariant data;
- data.Set<T>(vData);
- MapPairKeyToVariantValue_t pr(vId, data);
- m_mapKeyToVariantValue.insert(pr);
- }
-
- return bOk;
-}
-
-//++
-// Details: Retrieve a data object from *this container identified by the
-// specified ID.
-// Type: Method.
-// Args: T - The data object's variable type.
-// vId - (R) Unique ID i.e. GUID.
-// vrwData - (W) Copy of the data object held.
-// vrwbFound - (W) True = data found, false = data not found.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-template <typename T>
-bool CMIUtilMapIdToVariant::Get(const CMIUtilString &vId, T &vrwData,
- bool &vrwbFound) const {
- vrwbFound = false;
-
- if (!IsValid(vId)) {
- SetErrorDescription(CMIUtilString::Format(
- MIRSRC(IDS_VARIANT_ERR_MAP_KEY_INVALID), vId.c_str()));
- return MIstatus::failure;
- }
-
- const MapKeyToVariantValue_t::const_iterator it =
- m_mapKeyToVariantValue.find(vId);
- if (it != m_mapKeyToVariantValue.end()) {
- const CMIUtilVariant &rData = (*it).second;
- const T *pDataObj = rData.Get<T>();
- if (pDataObj != nullptr) {
- vrwbFound = true;
- vrwData = *pDataObj;
- return MIstatus::success;
- } else {
- SetErrorDescription(MIRSRC(IDS_VARIANT_ERR_USED_BASECLASS));
- return MIstatus::failure;
- }
- }
-
- return MIstatus::success;
-}
Removed: lldb/trunk/tools/lldb-mi/MIUtilSingletonBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSingletonBase.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSingletonBase.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSingletonBase.h (removed)
@@ -1,52 +0,0 @@
-//===-- MIUtilSingletonBase.h -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-namespace MI {
-
-// MI::ISingleton base class usage:
-//
-// class CMIDerivedClass
-// : public MI::ISingleton< CMIDerivedClass >
-// {
-// friend MI::ISingleton< CMIDerivedClass >;
-//
-// // Overridden:
-// public:
-// // From MI::ISingleton
-// bool Initialize() override;
-// bool Shutdown() override;
-// };
-
-//++
-//============================================================================
-// Details: Base class for the singleton pattern.
-// Gotchas: Derived class must specify MI::ISingleton<> as a friend class.
-//--
-template <typename T> class ISingleton {
- // Statics:
-public:
- // Return an instance of the derived class
- static T &Instance() {
- // This will fail if the derived class has not
- // declared itself to be a friend of MI::ISingleton
- static T instance;
-
- return instance;
- }
-
- // Overrideable:
-public:
- virtual bool Initialize() = 0;
- virtual bool Shutdown() = 0;
- //
- /* dtor */ virtual ~ISingleton() {}
-};
-
-} // namespace MI
Removed: lldb/trunk/tools/lldb-mi/MIUtilSingletonHelper.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSingletonHelper.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSingletonHelper.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSingletonHelper.h (removed)
@@ -1,81 +0,0 @@
-//===-- MIUtilSingletonHelper.h ---------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In house headers:
-#include "MICmnResources.h"
-#include "MIUtilString.h"
-
-namespace MI {
-
-//++
-//============================================================================
-// Details: Short cut helper function to simplify repeated initialisation of
-// MI components (singletons) required by a client module.
-// Type: Template method.
-// Args: vErrorResrcId - (R) The string resource ID error message
-// identifier to place in errMsg.
-// vwrbOk - (RW) On input True = Try to initialize MI driver
-// module.
-// On output True = MI driver module initialise
-// successfully.
-// vwrErrMsg - (W) MI driver module initialise error description
-// on failure.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-//--
-template <typename T>
-bool ModuleInit(const MIint vErrorResrcId, bool &vwrbOk,
- CMIUtilString &vwrErrMsg) {
- if (vwrbOk && !T::Instance().Initialize()) {
- vwrbOk = MIstatus::failure;
- vwrErrMsg = CMIUtilString::Format(
- MIRSRC(vErrorResrcId), T::Instance().GetErrorDescription().c_str());
- }
-
- return vwrbOk;
-}
-
-//++
-//============================================================================
-// Details: Short cut helper function to simplify repeated shutdown of
-// MI components (singletons) required by a client module.
-// Type: Template method.
-// Args: vErrorResrcId - (R) The string resource ID error message
-// identifier
-// to place in errMsg.
-// vwrbOk - (W) If not already false make false on module
-// shutdown failure.
-// vwrErrMsg - (RW) Append to existing error description string
-// MI
-// driver module initialise error description on
-// failure.
-// Return: True - Module shutdown succeeded.
-// False - Module shutdown failed.
-//--
-template <typename T>
-bool ModuleShutdown(const MIint vErrorResrcId, bool &vwrbOk,
- CMIUtilString &vwrErrMsg) {
- bool bOk = MIstatus::success;
-
- if (!T::Instance().Shutdown()) {
- const bool bMoreThanOneError(!vwrErrMsg.empty());
- bOk = MIstatus::failure;
- if (bMoreThanOneError)
- vwrErrMsg += ", ";
- vwrErrMsg += CMIUtilString::Format(
- MIRSRC(vErrorResrcId), T::Instance().GetErrorDescription().c_str());
- }
-
- vwrbOk = bOk ? vwrbOk : MIstatus::failure;
-
- return bOk;
-}
-
-} // namespace MI
Removed: lldb/trunk/tools/lldb-mi/MIUtilString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilString.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilString.cpp (removed)
@@ -1,915 +0,0 @@
-//===-- MIUtilString.cpp ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third party headers
-#include "llvm/Support/Compiler.h"
-#include <cstdlib>
-#include <inttypes.h>
-#include <limits.h>
-#include <memory>
-#include <sstream>
-#include <stdarg.h>
-#include <string.h>
-
-// In-house headers:
-#include "MIUtilString.h"
-
-//++
-// Details: CMIUtilString constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilString::CMIUtilString() : std::string() {}
-
-//++
-// Details: CMIUtilString constructor.
-// Type: Method.
-// Args: vpData - Pointer to UTF8 text data.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilString::CMIUtilString(const char *vpData)
- : std::string(WithNullAsEmpty(vpData)) {}
-
-//++
-// Details: CMIUtilString constructor.
-// Type: Method.
-// Args: vpStr - Text data.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilString::CMIUtilString(const std::string &vrStr) : std::string(vrStr) {}
-
-//++
-// Details: CMIUtilString assignment operator.
-// Type: Method.
-// Args: vpRhs - Pointer to UTF8 text data.
-// Return: CMIUtilString & - *this string.
-// Throws: None.
-//--
-CMIUtilString &CMIUtilString::operator=(const char *vpRhs) {
- assign(WithNullAsEmpty(vpRhs));
- return *this;
-}
-
-//++
-// Details: CMIUtilString assignment operator.
-// Type: Method.
-// Args: vrRhs - The other string to copy from.
-// Return: CMIUtilString & - *this string.
-// Throws: None.
-//--
-CMIUtilString &CMIUtilString::operator=(const std::string &vrRhs) {
- assign(vrRhs);
- return *this;
-}
-
-//++
-// Details: CMIUtilString destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilString::~CMIUtilString() {}
-
-//++
-// Details: Perform a snprintf format style on a string data. A new string
-// object is
-// created and returned.
-// Type: Static method.
-// Args: vrFormat - (R) Format string data instruction.
-// vArgs - (R) Var list args of any type.
-// Return: CMIUtilString - Number of splits found in the string data.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::FormatPriv(const CMIUtilString &vrFormat,
- va_list vArgs) {
- CMIUtilString strResult;
- MIint nFinal = 0;
- MIint n = vrFormat.size();
-
- // IOR: mysterious crash in this function on some windows builds not able to
- // duplicate but found article which may be related. Crash occurs in
- // vsnprintf() or va_copy().
- // Duplicate vArgs va_list argument pointer to ensure that it can be safely
- // used in a new frame.
- // http://julipedia.meroh.net/2011/09/using-vacopy-to-safely-pass-ap.html
- va_list argsDup;
- va_copy(argsDup, vArgs);
-
- // Create a copy va_list to reset when we spin
- va_list argsCpy;
- va_copy(argsCpy, argsDup);
-
- if (n == 0)
- return strResult;
-
- n = n << 4; // Reserve 16 times as much the length of the vrFormat
-
- std::unique_ptr<char[]> pFormatted;
- while (1) {
- pFormatted.reset(new char[n + 1]); // +1 for safety margin
- ::strncpy(&pFormatted[0], vrFormat.c_str(), n);
-
- // We need to restore the variable argument list pointer to the start again
- // before running vsnprintf() more then once
- va_copy(argsDup, argsCpy);
-
- nFinal = ::vsnprintf(&pFormatted[0], n, vrFormat.c_str(), argsDup);
- if ((nFinal < 0) || (nFinal >= n))
- n += abs(nFinal - n + 1);
- else
- break;
- }
-
- va_end(argsCpy);
- va_end(argsDup);
-
- strResult = pFormatted.get();
-
- return strResult;
-}
-
-//++
-// Details: Perform a snprintf format style on a string data. A new string
-// object is
-// created and returned.
-// Type: Static method.
-// Args: vFormat - (R) Format string data instruction.
-// ... - (R) Var list args of any type.
-// Return: CMIUtilString - Number of splits found in the string data.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::Format(const char *vFormating, ...) {
- va_list args;
- va_start(args, vFormating);
- CMIUtilString strResult =
- CMIUtilString::FormatPriv(WithNullAsEmpty(vFormating), args);
- va_end(args);
-
- return strResult;
-}
-
-//++
-// Details: Perform a snprintf format style on a string data. A new string
-// object is
-// created and returned.
-// Type: Static method.
-// Args: vrFormat - (R) Format string data instruction.
-// vArgs - (R) Var list args of any type.
-// Return: CMIUtilString - Number of splits found in the string data.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::FormatValist(const CMIUtilString &vrFormating,
- va_list vArgs) {
- return CMIUtilString::FormatPriv(vrFormating, vArgs);
-}
-
-//++
-// Details: Splits string into array of strings using delimiter. If multiple
-// delimiter
-// are found in sequence then they are not added to the list of splits.
-// Type: Method.
-// Args: vData - (R) String data to be split up.
-// vDelimiter - (R) Delimiter char or text.
-// vwVecSplits - (W) Container of splits found in string data.
-// Return: size_t - Number of splits found in the string data.
-// Throws: None.
-//--
-size_t CMIUtilString::Split(const CMIUtilString &vDelimiter,
- VecString_t &vwVecSplits) const {
- vwVecSplits.clear();
-
- if (this->empty() || vDelimiter.empty())
- return 0;
-
- const size_t nLen(length());
- size_t nOffset(0);
- do {
- // Find first occurrence which doesn't match to the delimiter
- const size_t nSectionPos(FindFirstNot(vDelimiter, nOffset));
- if (nSectionPos == std::string::npos)
- break;
-
- // Find next occurrence of the delimiter after section
- size_t nNextDelimiterPos(FindFirst(vDelimiter, nSectionPos));
- if (nNextDelimiterPos == std::string::npos)
- nNextDelimiterPos = nLen;
-
- // Extract string between delimiters
- const size_t nSectionLen(nNextDelimiterPos - nSectionPos);
- const std::string strSection(substr(nSectionPos, nSectionLen));
- vwVecSplits.push_back(strSection);
-
- // Next
- nOffset = nNextDelimiterPos + 1;
- } while (nOffset < nLen);
-
- return vwVecSplits.size();
-}
-
-//++
-// Details: Splits string into array of strings using delimiter. However the
-// string is
-// also considered for text surrounded by quotes. Text with quotes
-// including the
-// delimiter is treated as a whole. If multiple delimiter are found in
-// sequence
-// then they are not added to the list of splits. Quotes that are
-// embedded in
-// the string as string formatted quotes are ignored (proceeded by a
-// '\\') i.e.
-// "\"MI GDB local C++.cpp\":88".
-// Type: Method.
-// Args: vData - (R) String data to be split up.
-// vDelimiter - (R) Delimiter char or text.
-// vwVecSplits - (W) Container of splits found in string data.
-// Return: size_t - Number of splits found in the string data.
-// Throws: None.
-//--
-size_t CMIUtilString::SplitConsiderQuotes(const CMIUtilString &vDelimiter,
- VecString_t &vwVecSplits) const {
- vwVecSplits.clear();
-
- if (this->empty() || vDelimiter.empty())
- return 0;
-
- const size_t nLen(length());
- size_t nOffset(0);
- do {
- // Find first occurrence which doesn't match to the delimiter
- const size_t nSectionPos(FindFirstNot(vDelimiter, nOffset));
- if (nSectionPos == std::string::npos)
- break;
-
- // Find next occurrence of the delimiter after (quoted) section
- const bool bSkipQuotedText(true);
- bool bUnmatchedQuote(false);
- size_t nNextDelimiterPos(
- FindFirst(vDelimiter, bSkipQuotedText, bUnmatchedQuote, nSectionPos));
- if (bUnmatchedQuote) {
- vwVecSplits.clear();
- return 0;
- }
- if (nNextDelimiterPos == std::string::npos)
- nNextDelimiterPos = nLen;
-
- // Extract string between delimiters
- const size_t nSectionLen(nNextDelimiterPos - nSectionPos);
- const std::string strSection(substr(nSectionPos, nSectionLen));
- vwVecSplits.push_back(strSection);
-
- // Next
- nOffset = nNextDelimiterPos + 1;
- } while (nOffset < nLen);
-
- return vwVecSplits.size();
-}
-
-//++
-// Details: Split string into lines using \n and return an array of strings.
-// Type: Method.
-// Args: vwVecSplits - (W) Container of splits found in string data.
-// Return: size_t - Number of splits found in the string data.
-// Throws: None.
-//--
-size_t CMIUtilString::SplitLines(VecString_t &vwVecSplits) const {
- return Split("\n", vwVecSplits);
-}
-
-//++
-// Details: Remove '\n' from the end of string if found. It does not alter
-// *this string.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - New version of the string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::StripCREndOfLine() const {
- const size_t nPos = rfind('\n');
- if (nPos == std::string::npos)
- return *this;
-
- const CMIUtilString strNew(substr(0, nPos));
-
- return strNew;
-}
-
-//++
-// Details: Remove all '\n' from the string and replace with a space. It does
-// not alter
-// *this string.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - New version of the string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::StripCRAll() const {
- return FindAndReplace("\n", " ");
-}
-
-//++
-// Details: Find and replace all matches of a sub string with another string. It
-// does not
-// alter *this string.
-// Type: Method.
-// Args: vFind - (R) The string to look for.
-// vReplaceWith - (R) The string to replace the vFind match.
-// Return: CMIUtilString - New version of the string.
-// Throws: None.
-//--
-CMIUtilString
-CMIUtilString::FindAndReplace(const CMIUtilString &vFind,
- const CMIUtilString &vReplaceWith) const {
- if (vFind.empty() || this->empty())
- return *this;
-
- size_t nPos = find(vFind);
- if (nPos == std::string::npos)
- return *this;
-
- CMIUtilString strNew(*this);
- while (nPos != std::string::npos) {
- strNew.replace(nPos, vFind.length(), vReplaceWith);
- nPos += vReplaceWith.length();
- nPos = strNew.find(vFind, nPos);
- }
-
- return strNew;
-}
-
-//++
-// Details: Check if *this string is a decimal number.
-// Type: Method.
-// Args: None.
-// Return: bool - True = yes number, false not a number.
-// Throws: None.
-//--
-bool CMIUtilString::IsNumber() const {
- if (empty())
- return false;
-
- if ((at(0) == '-') && (length() == 1))
- return false;
-
- const size_t nPos = find_first_not_of("-.0123456789");
- return nPos == std::string::npos;
-}
-
-//++
-// Details: Check if *this string is a hexadecimal number.
-// Type: Method.
-// Args: None.
-// Return: bool - True = yes number, false not a number.
-// Throws: None.
-//--
-bool CMIUtilString::IsHexadecimalNumber() const {
- // Compare '0x..' prefix
- if ((strncmp(c_str(), "0x", 2) != 0) && (strncmp(c_str(), "0X", 2) != 0))
- return false;
-
- // Skip '0x..' prefix
- const size_t nPos = find_first_not_of("01234567890ABCDEFabcedf", 2);
- return nPos == std::string::npos;
-}
-
-//++
-// Details: Extract the number from the string. The number can be either a
-// hexadecimal or
-// natural number. It cannot contain other non-numeric characters.
-// Type: Method.
-// Args: vwrNumber - (W) Number extracted from the string.
-// Return: bool - True = yes number, false not a number.
-// Throws: None.
-//--
-bool CMIUtilString::ExtractNumber(MIint64 &vwrNumber) const {
- vwrNumber = 0;
-
- if (!IsNumber()) {
- return ExtractNumberFromHexadecimal(vwrNumber);
- }
-
- std::stringstream ss(const_cast<CMIUtilString &>(*this));
- ss >> vwrNumber;
-
- return true;
-}
-
-//++
-// Details: Extract the number from the hexadecimal string..
-// Type: Method.
-// Args: vwrNumber - (W) Number extracted from the string.
-// Return: bool - True = yes number, false not a number.
-// Throws: None.
-//--
-bool CMIUtilString::ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const {
- vwrNumber = 0;
-
- const size_t nPos = find_first_not_of("xX01234567890ABCDEFabcedf");
- if (nPos != std::string::npos)
- return false;
-
- errno = 0;
- const MIuint64 nNum = ::strtoull(this->c_str(), nullptr, 16);
- if (errno == ERANGE)
- return false;
-
- vwrNumber = static_cast<MIint64>(nNum);
-
- return true;
-}
-
-//++
-// Details: Determine if the text is all valid alpha numeric characters. Letters
-// can be
-// either upper or lower case.
-// Type: Static method.
-// Args: vpText - (R) The text data to examine.
-// Return: bool - True = yes all alpha, false = one or more chars is non alpha.
-// Throws: None.
-//--
-bool CMIUtilString::IsAllValidAlphaAndNumeric(const char *vpText) {
- const size_t len = ::strlen(WithNullAsEmpty(vpText));
- if (len == 0)
- return false;
-
- for (size_t i = 0; i < len; i++, vpText++) {
- const char c = *vpText;
- if (::isalnum((int)c) == 0)
- return false;
- }
-
- return true;
-}
-
-//++
-// Details: Check if two strings share equal contents.
-// Type: Method.
-// Args: vrLhs - (R) String A.
-// vrRhs - (R) String B.
-// Return: bool - True = yes equal, false - different.
-// Throws: None.
-//--
-bool CMIUtilString::Compare(const CMIUtilString &vrLhs,
- const CMIUtilString &vrRhs) {
- // Check the sizes match
- if (vrLhs.size() != vrRhs.size())
- return false;
-
- return (::strncmp(vrLhs.c_str(), vrRhs.c_str(), vrLhs.size()) == 0);
-}
-
-//++
-// Details: Remove from either end of *this string the following: " \t\n\v\f\r".
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Trimmed string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::Trim() const {
- CMIUtilString strNew(*this);
- const char *pWhiteSpace = " \t\n\v\f\r";
- const size_t nPos = find_last_not_of(pWhiteSpace);
- if (nPos != std::string::npos) {
- strNew = substr(0, nPos + 1);
- }
- const size_t nPos2 = strNew.find_first_not_of(pWhiteSpace);
- if (nPos2 != std::string::npos) {
- strNew = strNew.substr(nPos2);
- }
-
- return strNew;
-}
-
-//++
-// Details: Remove from either end of *this string the specified character.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Trimmed string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::Trim(const char vChar) const {
- CMIUtilString strNew(*this);
- const size_t nLen = strNew.length();
- if (nLen > 1) {
- if ((strNew[0] == vChar) && (strNew[nLen - 1] == vChar))
- strNew = strNew.substr(1, nLen - 2);
- }
-
- return strNew;
-}
-
-//++
-// Details: Do a printf equivalent for printing a number in binary i.e. "b%llB".
-// Type: Static method.
-// Args: vnDecimal - (R) The number to represent in binary.
-// Return: CMIUtilString - Binary number in text.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::FormatBinary(const MIuint64 vnDecimal) {
- CMIUtilString strBinaryNumber;
-
- const MIuint nConstBits = 64;
- MIuint nRem[nConstBits + 1];
- MIint i = 0;
- MIuint nLen = 0;
- MIuint64 nNum = vnDecimal;
- while ((nNum > 0) && (nLen < nConstBits)) {
- nRem[i++] = nNum % 2;
- nNum = nNum >> 1;
- nLen++;
- }
- char pN[nConstBits + 1];
- MIuint j = 0;
- for (i = nLen; i > 0; --i, j++) {
- pN[j] = '0' + nRem[i - 1];
- }
- pN[j] = 0; // String NUL termination
-
- strBinaryNumber = CMIUtilString::Format("0b%s", &pN[0]);
-
- return strBinaryNumber;
-}
-
-//++
-// Details: Remove from a string doubled up characters so only one set left.
-// Characters
-// are only removed if the previous character is already a same
-// character.
-// Type: Method.
-// Args: vChar - (R) The character to search for and remove adjacent
-// duplicates.
-// Return: CMIUtilString - New version of the string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::RemoveRepeatedCharacters(const char vChar) {
- return RemoveRepeatedCharacters(0, vChar);
-}
-
-//++
-// Details: Recursively remove from a string doubled up characters so only one
-// set left.
-// Characters are only removed if the previous character is already a
-// same
-// character.
-// Type: Method.
-// Args: vChar - (R) The character to search for and remove adjacent
-// duplicates.
-// vnPos - Character position in the string.
-// Return: CMIUtilString - New version of the string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::RemoveRepeatedCharacters(size_t vnPos,
- const char vChar) {
- const char cQuote = '"';
-
- // Look for first quote of two
- const size_t nPos = find(cQuote, vnPos);
- if (nPos == std::string::npos)
- return *this;
-
- const size_t nPosNext = nPos + 1;
- if (nPosNext > length())
- return *this;
-
- if (at(nPosNext) == cQuote) {
- *this = substr(0, nPos) + substr(nPosNext, length());
- RemoveRepeatedCharacters(nPosNext, vChar);
- }
-
- return *this;
-}
-
-//++
-// Details: Is the text in *this string surrounded by quotes.
-// Type: Method.
-// Args: None.
-// Return: bool - True = Yes string is quoted, false = no quoted.
-// Throws: None.
-//--
-bool CMIUtilString::IsQuoted() const {
- const char cQuote = '"';
-
- if (at(0) != cQuote)
- return false;
-
- const size_t nLen = length();
- return !((nLen > 0) && (at(nLen - 1) != cQuote));
-}
-
-//++
-// Details: Find first occurrence in *this string which matches the pattern.
-// Type: Method.
-// Args: vrPattern - (R) The pattern to search for.
-// vnPos - The starting position at which to start searching.
-// (Dflt = 0)
-// Return: size_t - The position of the first substring that match.
-// Throws: None.
-//--
-size_t CMIUtilString::FindFirst(const CMIUtilString &vrPattern,
- size_t vnPos /* = 0 */) const {
- return find(vrPattern, vnPos);
-}
-
-//++
-// Details: Find first occurrence in *this string which matches the pattern and
-// isn't surrounded by quotes.
-// Type: Method.
-// Args: vrPattern - (R) The pattern to search for.
-// vbSkipQuotedText - (R) True = don't look at quoted text,
-// false = otherwise.
-// vrwbNotFoundClosedQuote - (W) True = parsing error: unmatched
-// quote, false = otherwise.
-// vnPos - Position of the first character in the
-// string to be considered in the search. (Dflt = 0)
-// Return: size_t - The position of the first substring that matches and isn't
-// quoted.
-// Throws: None.
-//--
-size_t CMIUtilString::FindFirst(const CMIUtilString &vrPattern,
- const bool vbSkipQuotedText,
- bool &vrwbNotFoundClosedQuote,
- size_t vnPos /* = 0 */) const {
- vrwbNotFoundClosedQuote = false;
-
- if (!vbSkipQuotedText)
- return FindFirst(vrPattern, vnPos);
-
- const size_t nLen(length());
-
- size_t nPos = vnPos;
- do {
- const size_t nQuotePos(FindFirstQuote(nPos));
- const size_t nPatternPos(FindFirst(vrPattern, nPos));
- if (nQuotePos == std::string::npos)
- return nPatternPos;
-
- const size_t nQuoteClosedPos = FindFirstQuote(nQuotePos + 1);
- if (nQuoteClosedPos == std::string::npos) {
- vrwbNotFoundClosedQuote = true;
- return std::string::npos;
- }
-
- if ((nPatternPos == std::string::npos) || (nPatternPos < nQuotePos))
- return nPatternPos;
-
- nPos = nQuoteClosedPos + 1;
- } while (nPos < nLen);
-
- return std::string::npos;
-}
-
-//++
-// Details: Find first occurrence in *this string which doesn't match the
-// pattern.
-// Type: Method.
-// Args: vrPattern - (R) The pattern to search for.
-// vnPos - Position of the first character in the string to be
-// considered in the search. (Dflt = 0)
-// Return: size_t - The position of the first character that doesn't match.
-// Throws: None.
-//--
-size_t CMIUtilString::FindFirstNot(const CMIUtilString &vrPattern,
- size_t vnPos /* = 0 */) const {
- const size_t nLen(length());
- const size_t nPatternLen(vrPattern.length());
-
- size_t nPatternPos(vnPos);
- do {
- const bool bMatchPattern(compare(nPatternPos, nPatternLen, vrPattern) == 0);
- if (!bMatchPattern)
- return nPatternPos;
- nPatternPos += nPatternLen;
- } while (nPatternPos < nLen);
-
- return std::string::npos;
-}
-
-//++
-// Details: Find first occurrence of not escaped quotation mark in *this string.
-// Type: Method.
-// Args: vnPos - Position of the first character in the string to be
-// considered in the search.
-// Return: size_t - The position of the quotation mark.
-// Throws: None.
-//--
-size_t CMIUtilString::FindFirstQuote(size_t vnPos) const {
- const char cBckSlash('\\');
- const char cQuote('"');
- const size_t nLen(length());
-
- size_t nPos = vnPos;
- do {
- const size_t nBckSlashPos(find(cBckSlash, nPos));
- const size_t nQuotePos(find(cQuote, nPos));
- if ((nBckSlashPos == std::string::npos) || (nQuotePos == std::string::npos))
- return nQuotePos;
-
- if (nQuotePos < nBckSlashPos)
- return nQuotePos;
-
- // Skip 2 characters: First is '\', second is that which is escaped by '\'
- nPos = nBckSlashPos + 2;
- } while (nPos < nLen);
-
- return std::string::npos;
-}
-
-//++
-// Details: Get escaped string from *this string.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - The escaped version of the initial string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::Escape(bool vbEscapeQuotes /* = false */) const {
- const size_t nLen(length());
- CMIUtilString strNew;
- strNew.reserve(nLen);
- for (size_t nIndex(0); nIndex < nLen; ++nIndex) {
- const char cUnescapedChar((*this)[nIndex]);
- if (cUnescapedChar == '"' && vbEscapeQuotes)
- strNew.append("\\\"");
- else
- strNew.append(ConvertToPrintableASCII((char)cUnescapedChar));
- }
- return strNew;
-}
-
-//++
-// Details: Get string with backslashes in front of double quote '"' and
-// backslash '\\'
-// characters.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - The wrapped version of the initial string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::AddSlashes() const {
- const char cBckSlash('\\');
- const size_t nLen(length());
- CMIUtilString strNew;
- strNew.reserve(nLen);
-
- size_t nOffset(0);
- while (nOffset < nLen) {
- const size_t nUnescapedCharPos(find_first_of("\"\\", nOffset));
- const bool bUnescapedCharNotFound(nUnescapedCharPos == std::string::npos);
- if (bUnescapedCharNotFound) {
- const size_t nAppendAll(std::string::npos);
- strNew.append(*this, nOffset, nAppendAll);
- break;
- }
- const size_t nAppendLen(nUnescapedCharPos - nOffset);
- strNew.append(*this, nOffset, nAppendLen);
- strNew.push_back(cBckSlash);
- const char cUnescapedChar((*this)[nUnescapedCharPos]);
- strNew.push_back(cUnescapedChar);
- nOffset = nUnescapedCharPos + 1;
- }
-
- return strNew;
-}
-
-//++
-// Details: Remove backslashes added by CMIUtilString::AddSlashes.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - The initial version of wrapped string.
-// Throws: None.
-//--
-CMIUtilString CMIUtilString::StripSlashes() const {
- const char cBckSlash('\\');
- const size_t nLen(length());
- CMIUtilString strNew;
- strNew.reserve(nLen);
-
- size_t nOffset(0);
- while (nOffset < nLen) {
- const size_t nBckSlashPos(find(cBckSlash, nOffset));
- const bool bBckSlashNotFound(nBckSlashPos == std::string::npos);
- if (bBckSlashNotFound) {
- const size_t nAppendAll(std::string::npos);
- strNew.append(*this, nOffset, nAppendAll);
- break;
- }
- const size_t nAppendLen(nBckSlashPos - nOffset);
- strNew.append(*this, nOffset, nAppendLen);
- const bool bBckSlashIsLast(nBckSlashPos == nLen);
- if (bBckSlashIsLast) {
- strNew.push_back(cBckSlash);
- break;
- }
- const char cEscapedChar((*this)[nBckSlashPos + 1]);
- const size_t nEscapedCharPos(std::string("\"\\").find(cEscapedChar));
- const bool bEscapedCharNotFound(nEscapedCharPos == std::string::npos);
- if (bEscapedCharNotFound)
- strNew.push_back(cBckSlash);
- strNew.push_back(cEscapedChar);
- nOffset = nBckSlashPos + 2;
- }
-
- return strNew;
-}
-
-CMIUtilString CMIUtilString::ConvertToPrintableASCII(const char vChar,
- bool bEscapeQuotes) {
- switch (vChar) {
- case '\a':
- return "\\a";
- case '\b':
- return "\\b";
- case '\t':
- return "\\t";
- case '\n':
- return "\\n";
- case '\v':
- return "\\v";
- case '\f':
- return "\\f";
- case '\r':
- return "\\r";
- case '\033':
- return "\\e";
- case '\\':
- return "\\\\";
- case '"':
- if (bEscapeQuotes)
- return "\\\"";
- LLVM_FALLTHROUGH;
- default:
- if (::isprint(vChar))
- return Format("%c", vChar);
- else
- return Format("\\x%02" PRIx8, vChar);
- }
-}
-
-CMIUtilString
-CMIUtilString::ConvertCharValueToPrintableASCII(char vChar,
- bool bEscapeQuotes) {
- switch (vChar) {
- case '\a':
- return "\\a";
- case '\b':
- return "\\b";
- case '\t':
- return "\\t";
- case '\n':
- return "\\n";
- case '\v':
- return "\\v";
- case '\f':
- return "\\f";
- case '\r':
- return "\\r";
- case '\033':
- return "\\e";
- case '\\':
- return "\\\\";
- case '"':
- if (bEscapeQuotes)
- return "\\\"";
- LLVM_FALLTHROUGH;
- default:
- if (::isprint(vChar))
- return Format("%c", vChar);
- else
- return CMIUtilString();
- }
-}
-
-CMIUtilString CMIUtilString::ConvertToPrintableASCII(const char16_t vChar16,
- bool bEscapeQuotes) {
- if (vChar16 == (char16_t)(char)vChar16) {
- // Convert char16_t to char (if possible)
- CMIUtilString str =
- ConvertCharValueToPrintableASCII((char)vChar16, bEscapeQuotes);
- if (str.length() > 0)
- return str;
- }
- return Format("\\u%02" PRIx8 "%02" PRIx8, (vChar16 >> 8) & 0xff,
- vChar16 & 0xff);
-}
-
-CMIUtilString CMIUtilString::ConvertToPrintableASCII(const char32_t vChar32,
- bool bEscapeQuotes) {
- if (vChar32 == (char32_t)(char)vChar32) {
- // Convert char32_t to char (if possible)
- CMIUtilString str =
- ConvertCharValueToPrintableASCII((char)vChar32, bEscapeQuotes);
- if (str.length() > 0)
- return str;
- }
- return Format("\\U%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8,
- (vChar32 >> 24) & 0xff, (vChar32 >> 16) & 0xff,
- (vChar32 >> 8) & 0xff, vChar32 & 0xff);
-}
Removed: lldb/trunk/tools/lldb-mi/MIUtilString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilString.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilString.h (removed)
@@ -1,95 +0,0 @@
-//===-- MIUtilString.h ------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers:
-#include <cinttypes>
-#include <cstdarg>
-#include <string>
-#include <vector>
-
-// In-house headers:
-#include "MIDataTypes.h"
-
-//++
-//============================================================================
-// Details: MI common code utility class. Used to help handle text.
-// Derived from std::string
-//--
-class CMIUtilString : public std::string {
- // Typedefs:
-public:
- typedef std::vector<CMIUtilString> VecString_t;
-
- // Static method:
-public:
- static CMIUtilString Format(const char *vFormating, ...);
- static CMIUtilString FormatBinary(const MIuint64 vnDecimal);
- static CMIUtilString FormatValist(const CMIUtilString &vrFormating,
- va_list vArgs);
- static bool IsAllValidAlphaAndNumeric(const char *vpText);
- static const char *WithNullAsEmpty(const char *vpText) {
- return vpText ? vpText : "";
- }
- static bool Compare(const CMIUtilString &vrLhs, const CMIUtilString &vrRhs);
- static CMIUtilString ConvertToPrintableASCII(const char vChar,
- bool bEscapeQuotes = false);
- static CMIUtilString ConvertToPrintableASCII(const char16_t vChar16,
- bool bEscapeQuotes = false);
- static CMIUtilString ConvertToPrintableASCII(const char32_t vChar32,
- bool bEscapeQuotes = false);
-
- // Methods:
-public:
- /* ctor */ CMIUtilString();
- /* ctor */ CMIUtilString(const char *vpData);
- /* ctor */ CMIUtilString(const std::string &vrStr);
- //
- bool ExtractNumber(MIint64 &vwrNumber) const;
- CMIUtilString FindAndReplace(const CMIUtilString &vFind,
- const CMIUtilString &vReplaceWith) const;
- bool IsNumber() const;
- bool IsHexadecimalNumber() const;
- bool IsQuoted() const;
- CMIUtilString RemoveRepeatedCharacters(const char vChar);
- size_t Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const;
- size_t SplitConsiderQuotes(const CMIUtilString &vDelimiter,
- VecString_t &vwVecSplits) const;
- size_t SplitLines(VecString_t &vwVecSplits) const;
- CMIUtilString StripCREndOfLine() const;
- CMIUtilString StripCRAll() const;
- CMIUtilString Trim() const;
- CMIUtilString Trim(const char vChar) const;
- size_t FindFirst(const CMIUtilString &vrPattern, size_t vnPos = 0) const;
- size_t FindFirst(const CMIUtilString &vrPattern, bool vbSkipQuotedText,
- bool &vrwbNotFoundClosedQuote, size_t vnPos = 0) const;
- size_t FindFirstNot(const CMIUtilString &vrPattern, size_t vnPos = 0) const;
- CMIUtilString Escape(bool vbEscapeQuotes = false) const;
- CMIUtilString AddSlashes() const;
- CMIUtilString StripSlashes() const;
- //
- CMIUtilString &operator=(const char *vpRhs);
- CMIUtilString &operator=(const std::string &vrRhs);
-
- // Overrideable:
-public:
- /* dtor */ virtual ~CMIUtilString();
-
- // Static method:
-private:
- static CMIUtilString FormatPriv(const CMIUtilString &vrFormat, va_list vArgs);
- static CMIUtilString ConvertCharValueToPrintableASCII(char vChar,
- bool bEscapeQuotes);
-
- // Methods:
-private:
- bool ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const;
- CMIUtilString RemoveRepeatedCharacters(size_t vnPos, const char vChar);
- size_t FindFirstQuote(size_t vnPos) const;
-};
Removed: lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.cpp (removed)
@@ -1,302 +0,0 @@
-//===-- MIUtilThreadBaseStd.cpp ---------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Third Party Headers:
-#include <assert.h>
-
-// In-house headers:
-#include "MICmnThreadMgrStd.h"
-#include "MIUtilThreadBaseStd.h"
-
-//++
-// Details: Constructor.
-// Type: None.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilThreadActiveObjBase::CMIUtilThreadActiveObjBase()
- : m_references(0), m_bHasBeenKilled(false) {}
-
-//++
-// Details: Destructor.
-// Type: None.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilThreadActiveObjBase::~CMIUtilThreadActiveObjBase() {
- // Make sure our thread is not alive before we die
- m_thread.Join();
-}
-
-//++
-// Details: Check if an object is already running.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilThreadActiveObjBase::ThreadIsActive() {
- // Create a new thread to occupy this threads Run() function
- return m_thread.IsActive();
-}
-
-//++
-// Details: Set up *this thread.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilThreadActiveObjBase::ThreadExecute() {
- // Create a new thread to occupy this threads Run() function
- return m_thread.Start(ThreadEntry, this);
-}
-
-//++
-// Details: Acquire a reference to CMIUtilThreadActiveObjBase.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilThreadActiveObjBase::Acquire() {
- // Access to this function is serial
- CMIUtilThreadLock serial(m_mutex);
-
- // >0 == *this thread is alive
- m_references++;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Release a reference to CMIUtilThreadActiveObjBase.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilThreadActiveObjBase::Release() {
- // Access to this function is serial
- CMIUtilThreadLock serial(m_mutex);
-
- // 0 == kill off *this thread
- m_references--;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Force this thread to stop, regardless of references
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilThreadActiveObjBase::ThreadKill() {
- // Access to this function is serial
- CMIUtilThreadLock serial(m_mutex);
-
- // Set this thread to killed status
- m_bHasBeenKilled = true;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Proxy to thread join.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilThreadActiveObjBase::ThreadJoin() { return m_thread.Join(); }
-
-//++
-// Details: This function is the entry point of this object thread.
-// It is a trampoline to an instances operation manager.
-// Type: Static method.
-// Args: vpThisClass - (R) From the system (our CMIUtilThreadActiveObjBase
-// from the ctor).
-// Return: MIuint - 0 = success.
-// Throws: None.
-//--
-MIuint CMIUtilThreadActiveObjBase::ThreadEntry(void *vpThisClass) {
- // The argument is a pointer to a CMIUtilThreadActiveObjBase class
- // as passed from the initialize function, so we can safely cast it.
- assert(vpThisClass != nullptr);
- CMIUtilThreadActiveObjBase *pActive =
- reinterpret_cast<CMIUtilThreadActiveObjBase *>(vpThisClass);
-
- // Start the management routine of this object
- pActive->ThreadManage();
-
- // Thread death
- return 0;
-}
-
-//++
-// Details: This function forms a small management routine, to handle the
-// thread's running.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilThreadActiveObjBase::ThreadManage() {
- bool bAlive = true;
-
- // Infinite loop
- while (bAlive) {
- // Scope the lock while we access m_isDying
- {
- // Lock down access to the interface
- CMIUtilThreadLock serial(m_mutex);
-
- // Quit the run loop if we are dying
- if (m_references == 0)
- break;
- }
- // Execute the run routine
- if (!ThreadRun(bAlive))
- // Thread's run function failed (MIstatus::failure)
- break;
-
- // We will die if we have been signaled to die
- bAlive &= !m_bHasBeenKilled;
- }
-
- // Execute the finish routine just before we die
- // to give the object a chance to clean up
- ThreadFinish();
-
- m_thread.Finish();
-}
-
-
-//
-CMIUtilThread::CMIUtilThread() : m_pThread(nullptr), m_bIsActive(false) {}
-
-//++
-// Details: CMIUtilThread destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilThread::~CMIUtilThread() { Join(); }
-
-//++
-// Details: Wait for thread to stop.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilThread::Join() {
- if (m_pThread != nullptr) {
- // Wait for this thread to die
- m_pThread->join();
-
- // Scope the thread lock while we modify the pointer
- {
- CMIUtilThreadLock _lock(m_mutex);
- delete m_pThread;
- m_pThread = nullptr;
- }
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Is the thread doing work.
-// Type: Method.
-// Args: None.
-// Return: bool - True = Yes active, false = not active.
-// Throws: None.
-//--
-bool CMIUtilThread::IsActive() {
- // Lock while we access the thread status
- CMIUtilThreadLock _lock(m_mutex);
- return m_bIsActive;
-}
-
-//++
-// Details: Finish this thread
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilThread::Finish() {
- // Lock while we access the thread status
- CMIUtilThreadLock _lock(m_mutex);
- m_bIsActive = false;
-}
-
-//++
-// Details: Set up *this thread.
-// Type: Method.
-// Args: vpFn (R) - Function pointer to thread's main function.
-// vpArg (R) - Pointer arguments to pass to the thread.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMIUtilThread::Start(FnThreadProc vpFn, void *vpArg) {
- // Lock while we access the thread pointer and status
- CMIUtilThreadLock _lock(m_mutex);
-
- // Create the std thread, which starts immediately and update its status
- m_pThread = new std::thread(vpFn, vpArg);
- m_bIsActive = true;
-
- // We expect to always be able to create one
- assert(m_pThread != nullptr);
-
- return MIstatus::success;
-}
-
-
-//++
-// Details: Take resource.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilThreadMutex::Lock() { m_mutex.lock(); }
-
-//++
-// Details: Release resource.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilThreadMutex::Unlock() { m_mutex.unlock(); }
-
-//++
-// Details: Take resource if available. Immediately return in either case.
-// Type: Method.
-// Args: None.
-// Return: True - mutex has been locked.
-// False - mutex could not be locked.
-// Throws: None.
-//--
-bool CMIUtilThreadMutex::TryLock() { return m_mutex.try_lock(); }
Removed: lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.h (removed)
@@ -1,140 +0,0 @@
-//===-- MIUtilThreadBaseStd.h -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers:
-#include <mutex>
-#include <thread>
-
-// In-house headers:
-#include "MIDataTypes.h"
-#include "MIUtilString.h"
-
-//++
-//============================================================================
-// Details: MI common code utility class. Handle thread mutual exclusion.
-// Embed Mutexes in your Active Object and then use them through Locks.
-//--
-class CMIUtilThreadMutex {
- // Methods:
-public:
- /* ctor */ CMIUtilThreadMutex() {}
- //
- void Lock(); // Wait until mutex can be obtained
- void Unlock(); // Release the mutex
- bool TryLock(); // Gain the lock if available
-
- // Overrideable:
-public:
- // From CMICmnBase
- /* dtor */ virtual ~CMIUtilThreadMutex() {}
-
- // Attributes:
-private:
- std::recursive_mutex m_mutex;
-};
-
-//++
-//============================================================================
-// Details: MI common code utility class. Thread object.
-//--
-class CMIUtilThread {
- // Typedef:
-public:
- typedef MIuint (*FnThreadProc)(void *vpThisClass);
-
- // Methods:
-public:
- /* ctor */ CMIUtilThread();
- //
- bool Start(FnThreadProc vpFn, void *vpArg); // Start execution of this thread
- bool Join(); // Wait for this thread to stop
- bool IsActive(); // Returns true if this thread is running
- void Finish(); // Finish this thread
-
- // Overrideable:
-public:
- /* dtor */ virtual ~CMIUtilThread();
-
- // Methods:
-private:
- CMIUtilThreadMutex m_mutex;
- std::thread *m_pThread;
- bool m_bIsActive;
-};
-
-//++
-//============================================================================
-// Details: MI common code utility class. Base class for a worker thread active
-// object. Runs an 'captive thread'.
-//--
-class CMIUtilThreadActiveObjBase {
- // Methods:
-public:
- /* ctor */ CMIUtilThreadActiveObjBase();
- //
- bool Acquire(); // Obtain a reference to this object
- bool Release(); // Release a reference to this object
- bool ThreadIsActive(); // Return true if this object is running
- bool ThreadJoin(); // Wait for this thread to stop running
- bool ThreadKill(); // Force this thread to stop, regardless of references
- bool ThreadExecute(); // Start this objects execution in another thread
- void ThreadManage();
-
- // Overrideable:
-public:
- /* dtor */ virtual ~CMIUtilThreadActiveObjBase();
- //
- // Each thread object must supple a unique name that can be used to locate it
- virtual const CMIUtilString &ThreadGetName() const = 0;
-
- // Statics:
-protected:
- static MIuint ThreadEntry(void *vpThisClass); // Thread entry point
-
- // Overrideable:
-protected:
- virtual bool ThreadRun(bool &vrIsAlive) = 0; // Call the main worker method
- virtual bool ThreadFinish() = 0; // Finish of what you were doing
-
- // Attributes:
-protected:
- volatile MIuint m_references; // Stores the current lifetime state of this
- // thread, 0 = running, > 0 = shutting down
- volatile bool
- m_bHasBeenKilled; // Set to true when this thread has been killed
- CMIUtilThread m_thread; // The execution thread
- CMIUtilThreadMutex m_mutex; // This mutex allows us to safely communicate with
- // this thread object across the interface from
- // multiple threads
-};
-
-//++
-//============================================================================
-// Details: MI common code utility class. Handle thread resource locking.
-// Put Locks inside all the methods of your Active Object that access
-// data shared with the captive thread.
-//--
-class CMIUtilThreadLock {
- // Methods:
-public:
- /* ctor */
- CMIUtilThreadLock(CMIUtilThreadMutex &vMutex) : m_rMutex(vMutex) {
- m_rMutex.Lock();
- }
-
- // Overrideable:
-public:
- /* dtor */
- virtual ~CMIUtilThreadLock() { m_rMutex.Unlock(); }
-
- // Attributes:
-private:
- CMIUtilThreadMutex &m_rMutex;
-};
Removed: lldb/trunk/tools/lldb-mi/MIUtilVariant.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilVariant.cpp?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilVariant.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilVariant.cpp (removed)
@@ -1,344 +0,0 @@
-//===-- MIUtilVariant.cpp----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MIUtilVariant.h"
-
-//++
-// Details: CDataObjectBase constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CDataObjectBase::CDataObjectBase() {}
-
-//++
-// Details: CDataObjectBase copy constructor.
-// Type: Method.
-// Args: vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CDataObjectBase::CDataObjectBase(
- const CDataObjectBase &vrOther) {
- MIunused(vrOther);
-}
-
-//++
-// Details: CDataObjectBase copy constructor.
-// Type: Method.
-// Args: vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CDataObjectBase::CDataObjectBase(CDataObjectBase &vrOther) {
- MIunused(vrOther);
-}
-
-//++
-// Details: CDataObjectBase move constructor.
-// Type: Method.
-// Args: vrwOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CDataObjectBase::CDataObjectBase(CDataObjectBase &&vrwOther) {
- MIunused(vrwOther);
-}
-
-//++
-// Details: CDataObjectBase destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CDataObjectBase::~CDataObjectBase() { Destroy(); }
-
-//++
-// Details: CDataObjectBase copy assignment.
-// Type: Method.
-// Args: vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CDataObjectBase &CMIUtilVariant::CDataObjectBase::
-operator=(const CDataObjectBase &vrOther) {
- Copy(vrOther);
- return *this;
-}
-
-//++
-// Details: CDataObjectBase move assignment.
-// Type: Method.
-// Args: vrwOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CDataObjectBase &CMIUtilVariant::CDataObjectBase::
-operator=(CDataObjectBase &&vrwOther) {
- Copy(vrwOther);
- vrwOther.Destroy();
- return *this;
-}
-
-//++
-// Details: Create a new copy of *this class.
-// Type: Overrideable.
-// Args: None.
-// Return: CDataObjectBase * - Pointer to a new object.
-// Throws: None.
-//--
-CMIUtilVariant::CDataObjectBase *
-CMIUtilVariant::CDataObjectBase::CreateCopyOfSelf() {
- // Override to implement copying of variant's data object
- return new CDataObjectBase();
-}
-
-//++
-// Details: Determine if *this object is a derived from CDataObjectBase.
-// Type: Overrideable.
-// Args: None.
-// Return: bool - True = *this is derived from CDataObjectBase, false =
-// *this is instance of the this base class.
-// Throws: None.
-//--
-bool CMIUtilVariant::CDataObjectBase::GetIsDerivedClass() const {
- // Override to in the derived class and return true
- return false;
-}
-
-//++
-// Details: Perform a bitwise copy of *this object.
-// Type: Overrideable.
-// Args: vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilVariant::CDataObjectBase::Copy(const CDataObjectBase &vrOther) {
- // Override to implement
- MIunused(vrOther);
-}
-
-//++
-// Details: Release any resources used by *this object.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilVariant::CDataObjectBase::Destroy() {
- // Do nothing - override to implement
-}
-
-
-//++
-// Details: CDataObject copy constructor.
-// Type: Method.
-// Args: T - The object's type.
-// vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-template <typename T>
-CMIUtilVariant::CDataObject<T>::CDataObject(const CDataObject &vrOther) {
- if (this == &vrOther)
- return;
- Copy(vrOther);
-}
-
-//++
-// Details: CDataObject copy constructor.
-// Type: Method.
-// Args: T - The object's type.
-// vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-template <typename T>
-CMIUtilVariant::CDataObject<T>::CDataObject(CDataObject &vrOther) {
- if (this == &vrOther)
- return;
- Copy(vrOther);
-}
-
-//++
-// Details: CDataObject move constructor.
-// Type: Method.
-// Args: T - The object's type.
-// vrwOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-template <typename T>
-CMIUtilVariant::CDataObject<T>::CDataObject(CDataObject &&vrwOther) {
- if (this == &vrwOther)
- return;
- Copy(vrwOther);
- vrwOther.Destroy();
-}
-
-//++
-// Details: CDataObject copy assignment.
-// Type: Method.
-// Args: T - The object's type.
-// vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-template <typename T>
-CMIUtilVariant::CDataObject<T> &CMIUtilVariant::CDataObject<T>::
-operator=(const CDataObject &vrOther) {
- if (this == &vrOther)
- return *this;
- Copy(vrOther);
- return *this;
-}
-
-//++
-// Details: CDataObject move assignment.
-// Type: Method.
-// Args: T - The object's type.
-// vrwOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-template <typename T>
-CMIUtilVariant::CDataObject<T> &CMIUtilVariant::CDataObject<T>::
-operator=(CDataObject &&vrwOther) {
- if (this == &vrwOther)
- return *this;
- Copy(vrwOther);
- vrwOther.Destroy();
- return *this;
-}
-
-
-//++
-// Details: CMIUtilVariant constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CMIUtilVariant() : m_pDataObject(nullptr) {}
-
-//++
-// Details: CMIUtilVariant copy constructor.
-// Type: Method.
-// Args: vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CMIUtilVariant(const CMIUtilVariant &vrOther)
- : m_pDataObject(nullptr) {
- if (this == &vrOther)
- return;
-
- Copy(vrOther);
-}
-
-//++
-// Details: CMIUtilVariant copy constructor.
-// Type: Method.
-// Args: vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CMIUtilVariant(CMIUtilVariant &vrOther)
- : m_pDataObject(nullptr) {
- if (this == &vrOther)
- return;
-
- Copy(vrOther);
-}
-
-//++
-// Details: CMIUtilVariant move constructor.
-// Type: Method.
-// Args: vrwOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::CMIUtilVariant(CMIUtilVariant &&vrwOther)
- : m_pDataObject(nullptr) {
- if (this == &vrwOther)
- return;
-
- Copy(vrwOther);
- vrwOther.Destroy();
-}
-
-//++
-// Details: CMIUtilVariant destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant::~CMIUtilVariant() { Destroy(); }
-
-//++
-// Details: CMIUtilVariant copy assignment.
-// Type: Method.
-// Args: vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant &CMIUtilVariant::operator=(const CMIUtilVariant &vrOther) {
- if (this == &vrOther)
- return *this;
-
- Copy(vrOther);
- return *this;
-}
-
-//++
-// Details: CMIUtilVariant move assignment.
-// Type: Method.
-// Args: vrwOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-CMIUtilVariant &CMIUtilVariant::operator=(CMIUtilVariant &&vrwOther) {
- if (this == &vrwOther)
- return *this;
-
- Copy(vrwOther);
- vrwOther.Destroy();
- return *this;
-}
-
-//++
-// Details: Release the resources used by *this object.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilVariant::Destroy() {
- if (m_pDataObject != nullptr)
- delete m_pDataObject;
- m_pDataObject = nullptr;
-}
-
-//++
-// Details: Bitwise copy another data object to *this variant object.
-// Type: Method.
-// Args: vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-void CMIUtilVariant::Copy(const CMIUtilVariant &vrOther) {
- Destroy();
-
- if (vrOther.m_pDataObject != nullptr) {
- m_pDataObject = vrOther.m_pDataObject->CreateCopyOfSelf();
- }
-}
Removed: lldb/trunk/tools/lldb-mi/MIUtilVariant.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilVariant.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilVariant.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilVariant.h (removed)
@@ -1,247 +0,0 @@
-//===-- MIUtilVariant.h -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MIDataTypes.h"
-
-//++
-//============================================================================
-// Details: MI common code utility class. The class implements behaviour of a
-// variant object which holds any data object of type T. A copy of the
-// data object specified is made and stored in *this wrapper. When the
-// *this object is destroyed the data object hold within calls its
-// destructor should it have one.
-//--
-class CMIUtilVariant {
- // Methods:
-public:
- /* ctor */ CMIUtilVariant();
- /* ctor */ CMIUtilVariant(const CMIUtilVariant &vrOther);
- /* ctor */ CMIUtilVariant(CMIUtilVariant &vrOther);
- /* ctor */ CMIUtilVariant(CMIUtilVariant &&vrwOther);
- /* dtor */ ~CMIUtilVariant();
-
- template <typename T> void Set(const T &vArg);
- template <typename T> T *Get() const;
-
- CMIUtilVariant &operator=(const CMIUtilVariant &vrOther);
- CMIUtilVariant &operator=(CMIUtilVariant &&vrwOther);
-
- // Classes:
-private:
- //++ ----------------------------------------------------------------------
- // Details: Base class wrapper to hold the variant's data object when
- // assigned to it by the Set() function. Do not use the
- // CDataObjectBase
- // to create objects, use only CDataObjectBase derived objects,
- // see CDataObject() class.
- //--
- class CDataObjectBase {
- // Methods:
- public:
- /* ctor */ CDataObjectBase();
- /* ctor */ CDataObjectBase(const CDataObjectBase &vrOther);
- /* ctor */ CDataObjectBase(CDataObjectBase &vrOther);
- /* ctor */ CDataObjectBase(CDataObjectBase &&vrwOther);
- //
- CDataObjectBase &operator=(const CDataObjectBase &vrOther);
- CDataObjectBase &operator=(CDataObjectBase &&vrwOther);
-
- // Overrideable:
- public:
- virtual ~CDataObjectBase();
- virtual CDataObjectBase *CreateCopyOfSelf();
- virtual bool GetIsDerivedClass() const;
-
- // Overrideable:
- protected:
- virtual void Copy(const CDataObjectBase &vrOther);
- virtual void Destroy();
- };
-
- //++ ----------------------------------------------------------------------
- // Details: Derived from CDataObjectBase, this class is the wrapper for the
- // data object as it has an aggregate of type T which is a copy
- // of the data object assigned to the variant object.
- //--
- template <typename T> class CDataObject : public CDataObjectBase {
- // Methods:
- public:
- /* ctor */ CDataObject();
- /* ctor */ CDataObject(const T &vArg);
- /* ctor */ CDataObject(const CDataObject &vrOther);
- /* ctor */ CDataObject(CDataObject &vrOther);
- /* ctor */ CDataObject(CDataObject &&vrwOther);
- //
- CDataObject &operator=(const CDataObject &vrOther);
- CDataObject &operator=(CDataObject &&vrwOther);
- //
- T &GetDataObject();
-
- // Overridden:
- public:
- // From CDataObjectBase
- ~CDataObject() override;
- CDataObjectBase *CreateCopyOfSelf() override;
- bool GetIsDerivedClass() const override;
-
- // Overrideable:
- private:
- virtual void Duplicate(const CDataObject &vrOther);
-
- // Overridden:
- private:
- // From CDataObjectBase
- void Destroy() override;
-
- // Attributes:
- private:
- T m_dataObj;
- };
-
- // Methods
-private:
- void Destroy();
- void Copy(const CMIUtilVariant &vrOther);
-
- // Attributes:
-private:
- CDataObjectBase *m_pDataObject;
-};
-
-
-//++
-// Details: CDataObject constructor.
-// Type: Method.
-// Args: T - The object's type.
-// Return: None.
-// Throws: None.
-//--
-template <typename T> CMIUtilVariant::CDataObject<T>::CDataObject() {}
-
-//++
-// Details: CDataObject constructor.
-// Type: Method.
-// Args: T - The object's type.
-// vArg - (R) The data object to be stored in the variant object.
-// Return: None.
-// Throws: None.
-//--
-template <typename T>
-CMIUtilVariant::CDataObject<T>::CDataObject(const T &vArg) {
- m_dataObj = vArg;
-}
-
-//++
-// Details: CDataObject destructor.
-// Type: Overridden.
-// Args: T - The object's type.
-// Return: None.
-// Throws: None.
-//--
-template <typename T> CMIUtilVariant::CDataObject<T>::~CDataObject() {
- Destroy();
-}
-
-//++
-// Details: Retrieve the data object hold by *this object wrapper.
-// Type: Method.
-// Args: T - The object's type.
-// Return: T & - Reference to the data object.
-// Throws: None.
-//--
-template <typename T> T &CMIUtilVariant::CDataObject<T>::GetDataObject() {
- return m_dataObj;
-}
-
-//++
-// Details: Create a new copy of *this class.
-// Type: Overridden.
-// Args: T - The object's type.
-// Return: CDataObjectBase * - Pointer to a new object.
-// Throws: None.
-//--
-template <typename T>
-CMIUtilVariant::CDataObjectBase *
-CMIUtilVariant::CDataObject<T>::CreateCopyOfSelf() {
- CDataObject *pCopy = new CDataObject<T>(m_dataObj);
-
- return pCopy;
-}
-
-//++
-// Details: Determine if *this object is a derived from CDataObjectBase.
-// Type: Overridden.
-// Args: T - The object's type.
-// Return: bool - True = *this is derived from CDataObjectBase
-// - False = *this is an instance of the base class.
-// Throws: None.
-//--
-template <typename T>
-bool CMIUtilVariant::CDataObject<T>::GetIsDerivedClass() const {
- return true;
-}
-
-//++
-// Details: Perform a bitwise copy of *this object.
-// Type: Overrideable.
-// Args: T - The object's type.
-// vrOther - (R) The other object.
-// Return: None.
-// Throws: None.
-//--
-template <typename T>
-void CMIUtilVariant::CDataObject<T>::Duplicate(const CDataObject &vrOther) {
- CDataObjectBase::Copy(vrOther);
- m_dataObj = vrOther.m_dataObj;
-}
-
-//++
-// Details: Release any resources used by *this object.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-template <typename T> void CMIUtilVariant::CDataObject<T>::Destroy() {
- CDataObjectBase::Destroy();
-}
-
-
-//++
-// Details: Assign to the variant an object of a specified type.
-// Type: Template method.
-// Args: T - The object's type.
-// vArg - (R) The object to store.
-// Return: None.
-// Throws: None.
-//--
-template <typename T> void CMIUtilVariant::Set(const T &vArg) {
- m_pDataObject = new CDataObject<T>(vArg);
-}
-
-//++
-// Details: Retrieve the data object from *this variant.
-// Type: Template method.
-// Args: T - The object's type.
-// Return: T * - Pointer the data object, NULL = data object not assigned to
-// *this variant.
-// Throws: None.
-//--
-template <typename T> T *CMIUtilVariant::Get() const {
- if ((m_pDataObject != nullptr) && m_pDataObject->GetIsDerivedClass()) {
- CDataObject<T> *pDataObj = static_cast<CDataObject<T> *>(m_pDataObject);
- return &pDataObj->GetDataObject();
- }
-
- // Do not use a CDataObjectBase object, use only CDataObjectBase derived
- // objects
- return nullptr;
-}
Removed: lldb/trunk/tools/lldb-mi/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/Platform.h?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/Platform.h (original)
+++ lldb/trunk/tools/lldb-mi/Platform.h (removed)
@@ -1,87 +0,0 @@
-//===-- Platform.h ----------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#pragma once
-
-#if defined(_MSC_VER)
-
-#include <inttypes.h>
-#include <io.h>
-#include <signal.h>
-
-#include "lldb/Host/HostGetOpt.h"
-#include "lldb/Host/windows/windows.h"
-
-struct winsize {
- long ws_col;
-};
-
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
-
-// fcntl.h // This is not used by MI
-#define O_NOCTTY 0400
-
-// ioctls.h
-#define TIOCGWINSZ 0x5413
-
-// tcsetattr arguments
-#define TCSANOW 0
-
-#define NCCS 32
-struct termios {
- tcflag_t c_iflag; // input mode flags
- tcflag_t c_oflag; // output mode flags
- tcflag_t c_cflag; // control mode flags
- tcflag_t c_lflag; // local mode flags
- cc_t c_line; // line discipline
- cc_t c_cc[NCCS]; // control characters
- speed_t c_ispeed; // input speed
- speed_t c_ospeed; // output speed
-};
-
-typedef long pid_t;
-
-#define STDIN_FILENO 0
-#define PATH_MAX 32768
-#define snprintf _snprintf
-
-extern int ioctl(int d, int request, ...);
-extern int kill(pid_t pid, int sig);
-extern int tcsetattr(int fd, int optional_actions,
- const struct termios *termios_p);
-extern int tcgetattr(int fildes, struct termios *termios_p);
-
-// signal handler function pointer type
-typedef void (*sighandler_t)(int);
-
-// CODETAG_IOR_SIGNALS
-// signal.h
-#define SIGQUIT 3 // Terminal quit signal
-#define SIGKILL 9 // Kill (cannot be caught or ignored)
-#define SIGPIPE 13 // Write on a pipe with no one to read it
-#define SIGCONT 18 // Continue executing, if stopped.
-#define SIGTSTP 20 // Terminal stop signal
-#define SIGSTOP 23 // Stop executing (cannot be caught or ignored)
-#define SIGWINCH 28 // (== SIGVTALRM)
-
-#else
-
-#include <inttypes.h>
-#include <limits.h>
-
-#include <getopt.h>
-#include <libgen.h>
-#include <sys/ioctl.h>
-#include <termios.h>
-#include <unistd.h>
-
-#include <pthread.h>
-#include <sys/time.h>
-
-#endif
Removed: lldb/trunk/tools/lldb-mi/lldb-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/lldb-Info.plist?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/lldb-Info.plist (original)
+++ lldb/trunk/tools/lldb-mi/lldb-Info.plist (removed)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleIdentifier</key>
- <string>com.apple.lldb</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>lldb-mi</string>
- <key>CFBundleVersion</key>
- <string>2</string>
- <key>SecTaskAccess</key>
- <array>
- <string>allowed</string>
- <string>debug</string>
- </array>
-</dict>
-</plist>
Removed: lldb/trunk/tools/lldb-mi/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/module.modulemap?rev=366464&view=auto
==============================================================================
--- lldb/trunk/tools/lldb-mi/module.modulemap (original)
+++ lldb/trunk/tools/lldb-mi/module.modulemap (removed)
@@ -1,79 +0,0 @@
-module lldb_mi {
- module MICmdArgContext { header "MICmdArgContext.h" export * }
- module MICmdArgSet { header "MICmdArgSet.h" export * }
- module MICmdArgValBase { header "MICmdArgValBase.h" export * }
- module MICmdArgValConsume { header "MICmdArgValConsume.h" export * }
- module MICmdArgValFile { header "MICmdArgValFile.h" export * }
- module MICmdArgValListBase { header "MICmdArgValListBase.h" export * }
- module MICmdArgValListOfN { header "MICmdArgValListOfN.h" export * }
- module MICmdArgValNumber { header "MICmdArgValNumber.h" export * }
- module MICmdArgValOptionLong { header "MICmdArgValOptionLong.h" export * }
- module MICmdArgValOptionShort { header "MICmdArgValOptionShort.h" export * }
- module MICmdArgValPrintValues { header "MICmdArgValPrintValues.h" export * }
- module MICmdArgValString { header "MICmdArgValString.h" export * }
- module MICmdArgValThreadGrp { header "MICmdArgValThreadGrp.h" export * }
- module MICmdBase { header "MICmdBase.h" export * }
- module MICmdCmdBreak { header "MICmdCmdBreak.h" export * }
- module MICmdCmdData { header "MICmdCmdData.h" export * }
- module MICmdCmdEnviro { header "MICmdCmdEnviro.h" export * }
- module MICmdCmdExec { header "MICmdCmdExec.h" export * }
- module MICmdCmdFile { header "MICmdCmdFile.h" export * }
- module MICmdCmdGdbInfo { header "MICmdCmdGdbInfo.h" export * }
- module MICmdCmdGdbSet { header "MICmdCmdGdbSet.h" export * }
- module MICmdCmdGdbShow { header "MICmdCmdGdbShow.h" export * }
- module MICmdCmdGdbThread { header "MICmdCmdGdbThread.h" export * }
- module MICmdCmd { header "MICmdCmd.h" export * }
- module MICmdCmdMiscellanous { header "MICmdCmdMiscellanous.h" export * }
- module MICmdCmdStack { header "MICmdCmdStack.h" export * }
- module MICmdCmdSupportInfo { header "MICmdCmdSupportInfo.h" export * }
- module MICmdCmdSupportList { header "MICmdCmdSupportList.h" export * }
- module MICmdCmdSymbol { header "MICmdCmdSymbol.h" export * }
- module MICmdCmdTarget { header "MICmdCmdTarget.h" export * }
- module MICmdCmdThread { header "MICmdCmdThread.h" export * }
- module MICmdCmdTrace { header "MICmdCmdTrace.h" export * }
- module MICmdCmdVar { header "MICmdCmdVar.h" export * }
- module MICmdCommands { header "MICmdCommands.h" export * }
- module MICmdData { header "MICmdData.h" export * }
- module MICmdFactory { header "MICmdFactory.h" export * }
- module MICmdInterpreter { header "MICmdInterpreter.h" export * }
- module MICmdInvoker { header "MICmdInvoker.h" export * }
- module MICmdMgr { header "MICmdMgr.h" export * }
- module MICmdMgrSetCmdDeleteCallback { header "MICmdMgrSetCmdDeleteCallback.h" export * }
- module MICmnBase { header "MICmnBase.h" export * }
- module MICmnConfig { header "MICmnConfig.h" export * }
- module MICmnLLDBBroadcaster { header "MICmnLLDBBroadcaster.h" export * }
- module MICmnLLDBDebugger { header "MICmnLLDBDebugger.h" export * }
- module MICmnLLDBDebuggerHandleEvents { header "MICmnLLDBDebuggerHandleEvents.h" export * }
- module MICmnLLDBDebugSessionInfo { header "MICmnLLDBDebugSessionInfo.h" export * }
- module MICmnLLDBDebugSessionInfoVarObj { header "MICmnLLDBDebugSessionInfoVarObj.h" export * }
- module MICmnLLDBProxySBValue { header "MICmnLLDBProxySBValue.h" export * }
- module MICmnLLDBUtilSBValue { header "MICmnLLDBUtilSBValue.h" export * }
- module MICmnLog { header "MICmnLog.h" export * }
- module MICmnLogMediumFile { header "MICmnLogMediumFile.h" export * }
- module MICmnMIOutOfBandRecord { header "MICmnMIOutOfBandRecord.h" export * }
- module MICmnMIResultRecord { header "MICmnMIResultRecord.h" export * }
- module MICmnMIValueConst { header "MICmnMIValueConst.h" export * }
- module MICmnMIValue { header "MICmnMIValue.h" export * }
- module MICmnMIValueList { header "MICmnMIValueList.h" export * }
- module MICmnMIValueResult { header "MICmnMIValueResult.h" export * }
- module MICmnMIValueTuple { header "MICmnMIValueTuple.h" export * }
- module MICmnResources { header "MICmnResources.h" export * }
- module MICmnStreamStderr { header "MICmnStreamStderr.h" export * }
- module MICmnStreamStdin { header "MICmnStreamStdin.h" export * }
- module MICmnStreamStdout { header "MICmnStreamStdout.h" export * }
- module MICmnThreadMgrStd { header "MICmnThreadMgrStd.h" export * }
- module MIDataTypes { header "MIDataTypes.h" export * }
- module MIDriverBase { header "MIDriverBase.h" export * }
- module MIDriver { header "MIDriver.h" export * }
- module MIDriverMgr { header "MIDriverMgr.h" export * }
- module MIUtilDateTimeStd { header "MIUtilDateTimeStd.h" export * }
- module MIUtilDebug { header "MIUtilDebug.h" export * }
- module MIUtilFileStd { header "MIUtilFileStd.h" export * }
- module MIUtilMapIdToVariant { header "MIUtilMapIdToVariant.h" export * }
- module MIUtilSingletonBase { header "MIUtilSingletonBase.h" export * }
- module MIUtilSingletonHelper { header "MIUtilSingletonHelper.h" export * }
- module MIUtilString { header "MIUtilString.h" export * }
- module MIUtilThreadBaseStd { header "MIUtilThreadBaseStd.h" export * }
- module MIUtilVariant { header "MIUtilVariant.h" export * }
- module Platform { header "Platform.h" export * }
-}
Modified: lldb/trunk/unittests/tools/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/CMakeLists.txt?rev=366465&r1=366464&r2=366465&view=diff
==============================================================================
--- lldb/trunk/unittests/tools/CMakeLists.txt (original)
+++ lldb/trunk/unittests/tools/CMakeLists.txt Thu Jul 18 10:06:06 2019
@@ -1,6 +1,3 @@
-if(LLDB_TOOL_LLDB_MI_BUILD)
- add_subdirectory(lldb-mi)
-endif()
if(LLDB_TOOL_LLDB_SERVER_BUILD)
add_subdirectory(lldb-server)
endif()
More information about the lldb-commits
mailing list