[Lldb-commits] [lldb] r233018 - Add target-async option in -gdb-set command (MI)

Ilia K ki.stfu at gmail.com
Mon Mar 23 13:49:52 PDT 2015


Author: ki.stfu
Date: Mon Mar 23 15:49:51 2015
New Revision: 233018

URL: http://llvm.org/viewvc/llvm-project?rev=233018&view=rev
Log:
Add target-async option in -gdb-set command (MI)


Modified:
    lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp
    lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h
    lldb/trunk/tools/lldb-mi/MICmnResources.cpp
    lldb/trunk/tools/lldb-mi/MICmnResources.h

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp?rev=233018&r1=233017&r2=233018&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp Mon Mar 23 15:49:51 2015
@@ -20,7 +20,7 @@
 
 // Instantiations:
 const CMICmdCmdGdbSet::MapGdbOptionNameToFnGdbOptionPtr_t CMICmdCmdGdbSet::ms_mapGdbOptionNameToFnGdbOptionPtr = {
-    // { "target-async", &CMICmdCmdGdbSet::OptionFnTargetAsync },       // Example code if need to implement GDB set other options
+    {"target-async", &CMICmdCmdGdbSet::OptionFnTargetAsync},
     // { "auto-solib-add", &CMICmdCmdGdbSet::OptionFnAutoSolibAdd },    // Example code if need to implement GDB set other options
     {"solib-search-path", &CMICmdCmdGdbSet::OptionFnSolibSearchPath},
     {"fallback", &CMICmdCmdGdbSet::OptionFnFallback}};
@@ -210,6 +210,50 @@ CMICmdCmdGdbSet::GetOptionFn(const CMIUt
 }
 
 //++ ------------------------------------------------------------------------------------
+// Details: Carry out work to complete the GDB set option 'target-async' to prepare
+//          and send back information asked for.
+// Type:    Method.
+// Args:    vrWords - (R) List of additional parameters used by this option.
+// Return:  MIstatus::success - Function succeeded.
+//          MIstatus::failure - Function failed.
+// Throws:  None.
+//--
+bool
+CMICmdCmdGdbSet::OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords)
+{
+    bool bAsyncMode;
+    bool bOk = true;
+
+    if (vrWords.size() > 1)
+        // Too many arguments.
+        bOk = false;
+    else if (vrWords.size() == 0)
+        // If no arguments, default is "on".
+        bAsyncMode = true;
+    else if (CMIUtilString::Compare(vrWords[0], "on"))
+        bAsyncMode = true;
+    else if (CMIUtilString::Compare(vrWords[0], "off"))
+        bAsyncMode = false;
+    else
+        // Unrecognized argument.
+        bOk = false;
+
+    if (!bOk)
+    {
+        // Report error.
+        m_bGbbOptionFnHasError = true;
+        m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_TARGETASYNC);
+        return MIstatus::failure;
+    }
+
+    // Turn async mode on/off.
+    CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
+    rSessionInfo.GetDebugger().SetAsync(bAsyncMode);
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
 // Details: Carry out work to complete the GDB set option 'solib-search-path' to prepare
 //          and send back information asked for.
 // Type:    Method.

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h?rev=233018&r1=233017&r2=233018&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h Mon Mar 23 15:49:51 2015
@@ -69,6 +69,7 @@ class CMICmdCmdGdbSet : public CMICmdBas
     // Methods:
   private:
     bool GetOptionFn(const CMIUtilString &vrGdbOptionName, FnGdbOptionPtr &vrwpFn) const;
+    bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
     bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
     bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
 

Modified: lldb/trunk/tools/lldb-mi/MICmnResources.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnResources.cpp?rev=233018&r1=233017&r2=233018&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnResources.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnResources.cpp Mon Mar 23 15:49:51 2015
@@ -243,6 +243,7 @@ const CMICmnResources::SRsrcTextData CMI
     {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 recogised, not implemented"},
     {IDS_CMD_ERR_INFO_PRINTFN_FAILED, "The request '%s' failed."},
+    {IDS_CMD_ERR_GDBSET_OPT_TARGETASYNC, "'target-async' expects \"on\" or \"off\""},
     {IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH, "'solib-search-path' requires at least one argument"}};
 
 //++ ------------------------------------------------------------------------------------

Modified: lldb/trunk/tools/lldb-mi/MICmnResources.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnResources.h?rev=233018&r1=233017&r2=233018&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnResources.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnResources.h Mon Mar 23 15:49:51 2015
@@ -261,6 +261,7 @@ enum
     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_SOLIBSEARCHPATH
 };
 





More information about the lldb-commits mailing list