diff --git a/src/MICmnResources.cpp b/src/MICmnResources.cpp index 621e7ae..add0823 100644 --- a/src/MICmnResources.cpp +++ b/src/MICmnResources.cpp @@ -88,6 +88,10 @@ const CMICmnResources::SRsrcTextData {IDE_MI_APP_ARG_VERSION_LONG, "--versionLong\n\tPrints out MI Driver " "version information. Exit the MI " "Driver\n\timmediately."}, + {IDE_MI_APP_ARG_VERSION_FULL, "--versionFull\n\tPrints out MI Driver " + "full version information including lldb" + " llvm clang versions. 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"}, diff --git a/src/MICmnResources.h b/src/MICmnResources.h index 732d462..d01164d 100644 --- a/src/MICmnResources.h +++ b/src/MICmnResources.h @@ -69,6 +69,7 @@ enum { IDE_MI_APP_ARG_HELP, IDE_MI_APP_ARG_VERSION, IDE_MI_APP_ARG_VERSION_LONG, + IDE_MI_APP_ARG_VERSION_FULL, IDE_MI_APP_ARG_INTERPRETER, IDE_MI_APP_ARG_EXECUTEABLE, IDE_MI_APP_ARG_SOURCE, diff --git a/src/MIDriver.cpp b/src/MIDriver.cpp index ff7ac68..c6c1af8 100644 --- a/src/MIDriver.cpp +++ b/src/MIDriver.cpp @@ -41,6 +41,7 @@ const CMIUtilString CMIDriver::ms_constMIVersion = const CMIUtilString CMIDriver::ms_constAppNameShort(MIRSRC(IDS_MI_APPNAME_SHORT)); const CMIUtilString CMIDriver::ms_constAppNameLong(MIRSRC(IDS_MI_APPNAME_LONG)); +CMIUtilString CMIDriver::ms_MIVersionFull = ""; //++ // Details: CMIDriver constructor. @@ -134,6 +135,21 @@ const CMIUtilString &CMIDriver::GetVersionDescription() const { return ms_constMIVersion; } +//++ +// Details: Retrive MI's lldb version decription. +// Type: Method. +// Args: None. +// Return: CMIUtilString & - Text description. +// Throws: None. +//-- +const CMIUtilString &CMIDriver::GetVersionDescriptionFull() { + if (ms_MIVersionFull == "") { + ms_MIVersionFull = + CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().GetVersionString(); + } + return ms_MIVersionFull; +} + //++ // Details: Initialize setup *this driver ready for use. // Type: Method. diff --git a/src/MIDriver.h b/src/MIDriver.h index c197ede..4607042 100644 --- a/src/MIDriver.h +++ b/src/MIDriver.h @@ -81,6 +81,7 @@ class CMIDriver : public CMICmnBase, const CMIUtilString &GetAppNameShort() const; const CMIUtilString &GetAppNameLong() const; const CMIUtilString &GetVersionDescription() const; + const CMIUtilString &GetVersionDescriptionFull(); // MI do work bool WriteMessageToLog(const CMIUtilString &vMessage); @@ -154,6 +155,7 @@ class CMIDriver : public CMICmnBase, static const CMIUtilString ms_constAppNameShort; static const CMIUtilString ms_constAppNameLong; static const CMIUtilString ms_constMIVersion; + static CMIUtilString ms_MIVersionFull; // bool m_bFallThruToOtherDriverEnabled; // True = yes fall through, false = do // not pass on command diff --git a/src/MIDriverMgr.cpp b/src/MIDriverMgr.cpp index 9bb2e6a..2d95313 100644 --- a/src/MIDriverMgr.cpp +++ b/src/MIDriverMgr.cpp @@ -487,6 +487,7 @@ bool CMIDriverMgr::ParseArgs(const int argc, const char *argv[], bool bHaveArgInterpret = false; bool bHaveArgVersion = false; bool bHaveArgVersionLong = false; + bool bHaveArgVersionFull = false; bool bHaveArgLog = false; bool bHaveArgLogDir = false; bool bHaveArgHelp = false; @@ -513,6 +514,9 @@ bool CMIDriverMgr::ParseArgs(const int argc, const char *argv[], if ("--versionLong" == strArg) { bHaveArgVersionLong = true; } + if ("--versionFull" == strArg) { + bHaveArgVersionFull = true; + } if ("--log" == strArg) { bHaveArgLog = true; } @@ -555,6 +559,15 @@ bool CMIDriverMgr::ParseArgs(const int argc, const char *argv[], return bOk; } + // Todo: Make this the --version when the above --version version is removed + // Handle --versionlong option (ignore the --interpreter option if present) + if (bHaveArgVersionFull) { + vwbExiting = true; + bOk = (bOk && + CMICmnStreamStdout::Instance().WriteMIResponse(GetAppVersionFull())); + 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) { @@ -603,6 +616,23 @@ CMIUtilString CMIDriverMgr::GetAppVersion() const { return strVrsnInfo; } +//++ +// Details: Return formatted application version and name information. +// Type: Method. +// Args: None. +// Return: CMIUtilString - Text data. +// Throws: None. +//-- +CMIUtilString CMIDriverMgr::GetAppVersionFull() const { + const CMIUtilString strProj(MIRSRC(IDS_PROJNAME)); + const CMIUtilString strVn(CMIDriver::Instance().GetVersionDescriptionFull()); + const CMIUtilString strGdb(MIRSRC(IDE_MI_VERSION_GDB)); + const CMIUtilString strVrsnInfo(CMIUtilString::Format( + "%s\n%s\n%s", strProj.c_str(), strVn.c_str(), strGdb.c_str())); + + return strVrsnInfo; +} + //++ // Details: Return formatted help information on all the MI command line // options. @@ -619,6 +649,7 @@ CMIUtilString CMIDriverMgr::GetHelpOnCmdLineArgOptions() const { MIRSRC(IDE_MI_APP_ARG_HELP), MIRSRC(IDE_MI_APP_ARG_VERSION), MIRSRC(IDE_MI_APP_ARG_VERSION_LONG), + MIRSRC(IDE_MI_APP_ARG_VERSION_FULL), MIRSRC(IDE_MI_APP_ARG_INTERPRETER), MIRSRC(IDE_MI_APP_ARG_SOURCE), MIRSRC(IDE_MI_APP_ARG_EXECUTEABLE), diff --git a/src/MIDriverMgr.h b/src/MIDriverMgr.h index a7a1dbb..64f8dd4 100644 --- a/src/MIDriverMgr.h +++ b/src/MIDriverMgr.h @@ -78,6 +78,7 @@ class CMIDriverMgr : public CMICmnBase, public MI::ISingleton { bool Shutdown() override; // CMIUtilString GetAppVersion() const; + CMIUtilString GetAppVersionFull() const; bool RegisterDriver(const IDriver &vrADriver, const CMIUtilString &vrDriverID); bool UnregisterDriver(const IDriver &vrADriver);