[Lldb-commits] [lldb] r215655 - Fix command "gdb-set" to handle long option --threadgroup and accept --longOption type words as just words for string types.
Deepak Panickal
deepak at codeplay.com
Thu Aug 14 09:40:16 PDT 2014
Author: panickal
Date: Thu Aug 14 11:40:15 2014
New Revision: 215655
URL: http://llvm.org/viewvc/llvm-project?rev=215655&view=rev
Log:
Fix command "gdb-set" to handle long option --threadgroup and accept --longOption type words as just words for string types.
For example, MI command "17-gdb-set --thread-group i1 args --interpreter" is now acceptable, "--interpreter" was previous not valid.
Modified:
lldb/trunk/tools/lldb-mi/MICmdArgValListBase.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValListBase.h
lldb/trunk/tools/lldb-mi/MICmdArgValListOfN.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValString.h
lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h
Modified: lldb/trunk/tools/lldb-mi/MICmdArgValListBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValListBase.cpp?rev=215655&r1=215654&r2=215655&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdArgValListBase.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValListBase.cpp Thu Aug 14 11:40:15 2014
@@ -150,6 +150,9 @@ CMICmdArgValBase * CMICmdArgValListBase:
case eArgValType_StringQuotedNumberPath:
pOptionObj = new CMICmdArgValString( true, true, true );
break;
+ case eArgValType_StringAnything:
+ pOptionObj = new CMICmdArgValString( true );
+ break;
case eArgValType_ThreadGrp:
pOptionObj = new CMICmdArgValThreadGrp();
break;
@@ -204,6 +207,9 @@ bool CMICmdArgValListBase::IsExpectedCor
case eArgValType_StringQuotedNumberPath:
bValid = CMICmdArgValString( true, true, true ).IsStringArg( vrTxt );
break;
+ case eArgValType_StringAnything:
+ bValid = CMICmdArgValString( true ).IsStringArg( vrTxt );
+ break;
case eArgValType_ThreadGrp:
bValid = CMICmdArgValThreadGrp().IsArgThreadGrp( vrTxt );
break;
Modified: lldb/trunk/tools/lldb-mi/MICmdArgValListBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValListBase.h?rev=215655&r1=215654&r2=215655&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdArgValListBase.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValListBase.h Thu Aug 14 11:40:15 2014
@@ -71,6 +71,7 @@ public:
eArgValType_StringQuoted,
eArgValType_StringQuotedNumber,
eArgValType_StringQuotedNumberPath,
+ eArgValType_StringAnything, // Accept any words for a string 'type' even if they look like --longOptions for example
eArgValType_ThreadGrp,
eArgValType_count, // Always the last one
eArgValType_invalid
Modified: lldb/trunk/tools/lldb-mi/MICmdArgValListOfN.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValListOfN.cpp?rev=215655&r1=215654&r2=215655&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdArgValListOfN.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValListOfN.cpp Thu Aug 14 11:40:15 2014
@@ -111,7 +111,8 @@ bool CMICmdArgValListOfN::CreateList( co
CMIUtilString::VecString_t vecOptions;
if( (m_eArgType == eArgValType_StringQuoted) ||
(m_eArgType == eArgValType_StringQuotedNumber) ||
- (m_eArgType == eArgValType_StringQuotedNumberPath) )
+ (m_eArgType == eArgValType_StringQuotedNumberPath) ||
+ (m_eArgType == eArgValType_StringAnything) )
{
if( vrTxt.SplitConsiderQuotes( " ", vecOptions ) == 0 )
return MIstatus::failure;
@@ -147,9 +148,10 @@ bool CMICmdArgValListOfN::CreateList( co
bool CMICmdArgValListOfN::IsListOfN( const CMIUtilString & vrTxt ) const
{
CMIUtilString::VecString_t vecOptions;
- if ( m_eArgType == eArgValType_StringQuoted ||
- m_eArgType == eArgValType_StringQuotedNumber ||
- m_eArgType == eArgValType_StringQuotedNumberPath )
+ if( (m_eArgType == eArgValType_StringQuoted) ||
+ (m_eArgType == eArgValType_StringQuotedNumber) ||
+ (m_eArgType == eArgValType_StringQuotedNumberPath) ||
+ (m_eArgType == eArgValType_StringAnything) )
{
if( vrTxt.SplitConsiderQuotes( " ", vecOptions ) == 0 )
return false;
Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp?rev=215655&r1=215654&r2=215655&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp Thu Aug 14 11:40:15 2014
@@ -34,6 +34,22 @@ CMICmdArgValString::CMICmdArgValString(
: m_bHandleQuotedString( false )
, m_bAcceptNumbers( false )
, m_bHandleDirPaths( false )
+, m_bHandleAnything( false )
+{
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: CMICmdArgValString constructor.
+// Type: Method.
+// Args: vbAnything - (R) True = Parse a string and accept anything, false = do not accept anything.
+// Return: None.
+// Throws: None.
+//--
+CMICmdArgValString::CMICmdArgValString( const bool vbAnything )
+: m_bHandleQuotedString( false )
+, m_bAcceptNumbers( false )
+, m_bHandleDirPaths( false )
+, m_bHandleAnything( vbAnything )
{
}
@@ -50,6 +66,7 @@ CMICmdArgValString::CMICmdArgValString(
: m_bHandleQuotedString( vbHandleQuotes )
, m_bAcceptNumbers( vbAcceptNumbers )
, m_bHandleDirPaths( vbHandleDirPaths )
+, m_bHandleAnything( false )
{
}
@@ -69,6 +86,7 @@ CMICmdArgValString::CMICmdArgValString(
, m_bHandleQuotedString( vbHandleQuotes )
, m_bAcceptNumbers( vbAcceptNumbers )
, m_bHandleDirPaths( false )
+, m_bHandleAnything( false )
{
}
@@ -345,6 +363,10 @@ bool CMICmdArgValString::IsStringArg( co
//--
bool CMICmdArgValString::IsStringArgSingleText( const CMIUtilString & vrTxt ) const
{
+ // Accept anything as string word
+ if( m_bHandleAnything )
+ return true;
+
if( !m_bHandleDirPaths )
{
// Look for directory file paths, if found reject
Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.h?rev=215655&r1=215654&r2=215655&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdArgValString.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValString.h Thu Aug 14 11:40:15 2014
@@ -43,6 +43,7 @@ class CMICmdArgValString : public CMICmd
// Methods:
public:
/* ctor */ CMICmdArgValString( void );
+ /* ctor */ CMICmdArgValString( const bool vbAnything );
/* ctor */ CMICmdArgValString( const bool vbHandleQuotes, const bool vbAcceptNumbers, const bool vbHandleDirPaths );
/* ctor */ CMICmdArgValString( const CMIUtilString & vrArgName, const bool vbMandatory, const bool vbHandleByCmd, const bool vbHandleQuotes = false, const bool vbAcceptNumbers = false );
//
@@ -71,4 +72,5 @@ private:
bool m_bHandleQuotedString; // True = Parse a string surrounded by quotes spaces are not delimitors, false = only text up to next delimiting space character
bool m_bAcceptNumbers; // True = Parse a string and accept as a number if number, false = numbers not recognised as string types
bool m_bHandleDirPaths; // True = Parse a string and accept directory file style string if present, false = directory file path not accepted
+ bool m_bHandleAnything; // True = Parse a string and accept anything if present, false = validate for criteria matches
};
Modified: lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp?rev=215655&r1=215654&r2=215655&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.cpp Thu Aug 14 11:40:15 2014
@@ -25,6 +25,7 @@
#include "MICmnMIValueConst.h"
#include "MICmdArgValString.h"
#include "MICmdArgValListOfN.h"
+#include "MICmdArgValOptionLong.h"
#include "MICmnLLDBDebugSessionInfo.h"
// Instantiations:
@@ -44,7 +45,8 @@ const CMICmdCmdGdbSet::MapGdbOptionNameT
// Throws: None.
//--
CMICmdCmdGdbSet::CMICmdCmdGdbSet( void )
-: m_constStrArgNamedGdbOption( "option" )
+: m_constStrArgNamedThreadGrp( "thread-group" )
+, m_constStrArgNamedGdbOption( "option" )
, m_bGdbOptionRecognised( true )
, m_bGdbOptionFnSuccessful( false )
, m_bGbbOptionFnHasError( false )
@@ -79,7 +81,8 @@ CMICmdCmdGdbSet::~CMICmdCmdGdbSet( void
//--
bool CMICmdCmdGdbSet::ParseArgs( void )
{
- bool bOk = m_setCmdArgs.Add( *(new CMICmdArgValListOfN( m_constStrArgNamedGdbOption, true, true, CMICmdArgValListBase::eArgValType_StringQuotedNumberPath ) ) );
+ bool bOk = m_setCmdArgs.Add( *(new CMICmdArgValOptionLong( m_constStrArgNamedThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1 ) ) );
+ bOk = bOk && m_setCmdArgs.Add( *(new CMICmdArgValListOfN( m_constStrArgNamedGdbOption, true, true, CMICmdArgValListBase::eArgValType_StringAnything ) ) );
return (bOk && ParseValidateCmdOptions() );
}
Modified: lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h?rev=215655&r1=215654&r2=215655&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdGdbSet.h Thu Aug 14 11:40:15 2014
@@ -86,6 +86,7 @@ private:
private:
const static MapGdbOptionNameToFnGdbOptionPtr_t ms_mapGdbOptionNameToFnGdbOptionPtr;
//
+ const CMIUtilString m_constStrArgNamedThreadGrp;
const CMIUtilString m_constStrArgNamedGdbOption;
bool m_bGdbOptionRecognised; // True = This command has a function with a name that matches the Print argument, false = not found
bool m_bGdbOptionFnSuccessful; // True = The print function completed its task ok, false = function failed for some reason
More information about the lldb-commits
mailing list