diff options
| -rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp | 46 | ||||
| -rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdGdbSet.h | 1 | ||||
| -rw-r--r-- | lldb/tools/lldb-mi/MICmnResources.cpp | 1 | ||||
| -rw-r--r-- | lldb/tools/lldb-mi/MICmnResources.h | 1 | 
4 files changed, 48 insertions, 1 deletions
diff --git a/lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp b/lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp index 169d60cb9e1..44cc9551133 100644 --- a/lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp +++ b/lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp @@ -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 CMIUtilString &vrPrintFnName, FnGdbOptionPtr  }  //++ ------------------------------------------------------------------------------------ +// 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. diff --git a/lldb/tools/lldb-mi/MICmdCmdGdbSet.h b/lldb/tools/lldb-mi/MICmdCmdGdbSet.h index f0840026a29..d9684bd9316 100644 --- a/lldb/tools/lldb-mi/MICmdCmdGdbSet.h +++ b/lldb/tools/lldb-mi/MICmdCmdGdbSet.h @@ -69,6 +69,7 @@ class CMICmdCmdGdbSet : public CMICmdBase      // 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); diff --git a/lldb/tools/lldb-mi/MICmnResources.cpp b/lldb/tools/lldb-mi/MICmnResources.cpp index 784847cd089..69420ba90d7 100644 --- a/lldb/tools/lldb-mi/MICmnResources.cpp +++ b/lldb/tools/lldb-mi/MICmnResources.cpp @@ -243,6 +243,7 @@ const CMICmnResources::SRsrcTextData CMICmnResources::ms_pResourceId2TextData[]      {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"}};  //++ ------------------------------------------------------------------------------------ diff --git a/lldb/tools/lldb-mi/MICmnResources.h b/lldb/tools/lldb-mi/MICmnResources.h index e1d8aea5456..68523034d18 100644 --- a/lldb/tools/lldb-mi/MICmnResources.h +++ b/lldb/tools/lldb-mi/MICmnResources.h @@ -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  };  | 

