[Lldb-commits] [lldb] r237429 - Fix parsing of print-values arg (MI)
Tamas Berghammer
tberghammer at google.com
Fri May 15 04:18:03 PDT 2015
Hi Ilia,
This CL cause 2 new failure on the Linux build bots (
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/2414).
Please fix them if it is a trivial or XFAIL them to get the bot green again.
Thanks
Tamas
On Fri, May 15, 2015 at 10:46 AM, Ilia K <ki.stfu at gmail.com> wrote:
> Author: ki.stfu
> Date: Fri May 15 04:46:28 2015
> New Revision: 237429
>
> URL: http://llvm.org/viewvc/llvm-project?rev=237429&view=rev
> Log:
> Fix parsing of print-values arg (MI)
>
> # Add CMICmdArgValPrintValues argument
> # Rework
> -stack-list-arguments/-stack-list-locals/-stack-list-variables/-var-update/-var-list-children
> commands to use the CMICmdArgValPrintValues argument instead of usage of
> pair of non-mandatory
> arguments like: CMICmdArgValNumber(0) ||
> CMICmdArgValLongOptions("no-values")
>
>
> Added:
> lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.cpp
> lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.h
> Modified:
> lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
> lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
> lldb/trunk/tools/lldb-mi/CMakeLists.txt
> lldb/trunk/tools/lldb-mi/MICmdCmdStack.cpp
> lldb/trunk/tools/lldb-mi/MICmdCmdStack.h
> lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
> lldb/trunk/tools/lldb-mi/MICmdCmdVar.h
>
> Modified: lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py?rev=237429&r1=237428&r2=237429&view=diff
>
> ==============================================================================
> --- lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py (original)
> +++ lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py Fri May 15 04:46:28
> 2015
> @@ -43,16 +43,14 @@ class MiStackTestCase(lldbmi_testcase.Mi
> # Test that -stack-list-arguments lists stack arguments with all
> values
> self.runCmd("-stack-list-arguments 1 0 0")
>
> self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
> - # FIXME: first 0 is treated as --no-values
> self.runCmd("-stack-list-arguments --all-values 0 0")
> -
> #self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
> +
> self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
>
> # Test that -stack-list-arguments lists stack arguments with
> simple values
> self.runCmd("-stack-list-arguments 2 0 1")
>
> self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}")
> - # FIXME: first 0 is treated as --no-values
> self.runCmd("-stack-list-arguments --simple-values 0 1")
> -
> #self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}")
> +
> self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}")
>
> # Test that an invalid low-frame is handled
> # FIXME: -1 is treated as unsigned int
>
> Modified: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py?rev=237429&r1=237428&r2=237429&view=diff
>
> ==============================================================================
> --- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py (original)
> +++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py Fri May 15
> 04:46:28 2015
> @@ -254,12 +254,12 @@ class MiVarTestCase(lldbmi_testcase.MiTe
>
> self.expect("\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type
> \[2\]\",thread-id=\"1\",has_more=\"0\"")
>
> # Test that -var-list-children lists empty children if range is
> empty
> - # FIXME (and that print-values is optional)
> - self.runCmd("-var-list-children 0 var_complx 0 0")
> + # (and that print-values is optional)
> + self.runCmd("-var-list-children var_complx 0 0")
> self.expect("\^done,numchild=\"0\",has_more=\"1\"")
> - self.runCmd("-var-list-children 0 var_complx 99 0")
> + self.runCmd("-var-list-children var_complx 99 0")
> self.expect("\^done,numchild=\"0\",has_more=\"1\"")
> - self.runCmd("-var-list-children 0 var_complx 99 3")
> + self.runCmd("-var-list-children var_complx 99 3")
> self.expect("\^done,numchild=\"0\",has_more=\"0\"")
>
> # Test that -var-list-children lists all children with their
> values
> @@ -272,39 +272,32 @@ class MiVarTestCase(lldbmi_testcase.MiTe
> # Test that -var-list-children lists children without values
> self.runCmd("-var-list-children 0 var_complx 0 1")
>
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
> - # FIXME: first 0 is treated as --no-values
> self.runCmd("-var-list-children --no-values var_complx 0 1")
> - #
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
> +
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
>
> # Test that -var-list-children lists children with all values
> self.runCmd("-var-list-children 1 var_complx 1 2")
>
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
> struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
> - # FIXME: first 1 is treated as --all-values
> self.runCmd("-var-list-children --all-values var_complx 1 2")
> - #
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
> struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
> +
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
> struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
>
> # Test that -var-list-children lists children with simple values
> self.runCmd("-var-list-children 2 var_complx 2 4")
>
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type
> \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
> - # FIXME: first 2 is treated as --simple-values
> self.runCmd("-var-list-children --simple-values var_complx 2 4")
> - #
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type
> \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
> +
> self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type
> \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
>
> # Test that an invalid from is handled
> - # FIXME: first 0 is treated as --no-values
> # FIXME: -1 is treated as unsigned int
> self.runCmd("-var-list-children 0 var_complx -1 0")
> #self.expect("\^error,msg=\"Command 'var-list-children'\.
> Variable children range invalid\"")
>
> # Test that an invalid to is handled
> - # FIXME: first 0 is treated as --no-values
> # FIXME: -1 is treated as unsigned int
> self.runCmd("-var-list-children 0 var_complx 0 -1")
> #self.expect("\^error,msg=\"Command 'var-list-children'\.
> Variable children range invalid\"")
>
> # Test that a missing low-frame or high-frame is handled
> - # FIXME: first 0 is treated as --no-values
> - # FIXME: -1 is treated as unsigned int
> self.runCmd("-var-list-children 0 var_complx 0")
> self.expect("\^error,msg=\"Command 'var-list-children'. Variable
> children range invalid\"")
>
>
> Modified: lldb/trunk/tools/lldb-mi/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/CMakeLists.txt?rev=237429&r1=237428&r2=237429&view=diff
>
> ==============================================================================
> --- lldb/trunk/tools/lldb-mi/CMakeLists.txt (original)
> +++ lldb/trunk/tools/lldb-mi/CMakeLists.txt Fri May 15 04:46:28 2015
> @@ -11,6 +11,7 @@ set(LLDB_MI_SOURCES
> MICmdArgValNumber.cpp
> MICmdArgValOptionLong.cpp
> MICmdArgValOptionShort.cpp
> + MICmdArgValPrintValues.cpp
> MICmdArgValString.cpp
> MICmdArgValThreadGrp.cpp
> MICmdBase.cpp
>
> Added: lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.cpp?rev=237429&view=auto
>
> ==============================================================================
> --- lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.cpp (added)
> +++ lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.cpp Fri May 15
> 04:46:28 2015
> @@ -0,0 +1,129 @@
> +//===-- MICmdArgValPrintValues.cpp ------------------------------*- C++
> -*-===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
>
> +//===----------------------------------------------------------------------===//
> +
> +// In-house headers:
> +#include "MICmdArgValPrintValues.h"
> +#include "MICmdArgContext.h"
> +
> +//++
> ------------------------------------------------------------------------------------
> +// Details: CMICmdArgValPrintValues constructor.
> +// Type: Method.
> +// Args: None.
> +// Return: None.
> +// Throws: None.
> +//--
> +CMICmdArgValPrintValues::CMICmdArgValPrintValues(void)
> + : m_nPrintValues(0)
> +{
> +}
> +
> +//++
> ------------------------------------------------------------------------------------
> +// Details: CMICmdArgValPrintValues constructor.
> +// Type: Method.
> +// Args: vrArgName - (R) Argument's name to search by.
> +// vbMandatory - (R) True = Yes must be present, false =
> optional argument.
> +// vbHandleByCmd - (R) True = Command processes *this option,
> false = not handled.
> +// Return: None.
> +// Throws: None.
> +//--
> +CMICmdArgValPrintValues::CMICmdArgValPrintValues(const CMIUtilString
> &vrArgName, const bool vbMandatory, const bool vbHandleByCmd)
> + : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd)
> + , m_nPrintValues(0)
> +{
> +}
> +
> +//++
> ------------------------------------------------------------------------------------
> +// Details: CMICmdArgValPrintValues destructor.
> +// Type: Overridden.
> +// Args: None.
> +// Return: None.
> +// Throws: None.
> +//--
> +CMICmdArgValPrintValues::~CMICmdArgValPrintValues(void)
> +{
> +}
> +
> +//++
> ------------------------------------------------------------------------------------
> +// Details: Parse the command's argument options string and try to
> extract the value *this
> +// argument is looking for.
> +// Type: Overridden.
> +// Args: vwArgContext - (RW) The command's argument options string.
> +// Return: MIstatus::success - Functional succeeded.
> +// MIstatus::failure - Functional failed.
> +// Throws: None.
> +//--
> +bool
> +CMICmdArgValPrintValues::Validate(CMICmdArgContext &vwArgContext)
> +{
> + if (vwArgContext.IsEmpty())
> + return MIstatus::success;
> +
> + const CMIUtilString &rArg(vwArgContext.GetArgs()[0]);
> + if (IsArgPrintValues(rArg) && ExtractPrintValues(rArg))
> + {
> + m_bFound = true;
> + m_bValid = true;
> + m_argValue = GetPrintValues();
> + vwArgContext.RemoveArg(rArg);
> + return MIstatus::success;
> + }
> +
> + return MIstatus::failure;
> +}
> +
> +//++
> ------------------------------------------------------------------------------------
> +// Details: Examine the string and determine if it is a valid string type
> argument.
> +// Type: Method.
> +// Args: vrTxt - (R) Some text.
> +// Return: bool - True = yes valid arg, false = no.
> +// Throws: None.
> +//--
> +bool
> +CMICmdArgValPrintValues::IsArgPrintValues(const CMIUtilString &vrTxt)
> const
> +{
> + return (CMIUtilString::Compare(vrTxt, "0") ||
> CMIUtilString::Compare(vrTxt, "--no-values") ||
> + CMIUtilString::Compare(vrTxt, "1") ||
> CMIUtilString::Compare(vrTxt, "--all-values") ||
> + CMIUtilString::Compare(vrTxt, "2") ||
> CMIUtilString::Compare(vrTxt, "--simple-values"));
> +}
> +
> +//++
> ------------------------------------------------------------------------------------
> +// Details: Extract the print-values from the print-values argument.
> +// Type: Method.
> +// Args: vrTxt - (R) Some text.
> +// Return: MIstatus::success - Functional succeeded.
> +// MIstatus::failure - Functional failed.
> +// Throws: None.
> +//--
> +bool
> +CMICmdArgValPrintValues::ExtractPrintValues(const CMIUtilString &vrTxt)
> +{
> + if (CMIUtilString::Compare(vrTxt, "0") ||
> CMIUtilString::Compare(vrTxt, "--no-values"))
> + m_nPrintValues = 0;
> + else if (CMIUtilString::Compare(vrTxt, "1") ||
> CMIUtilString::Compare(vrTxt, "--all-values"))
> + m_nPrintValues = 1;
> + else if (CMIUtilString::Compare(vrTxt, "2") ||
> CMIUtilString::Compare(vrTxt, "--simple-values"))
> + m_nPrintValues = 2;
> + else
> + return MIstatus::failure;
> +
> + return MIstatus::success;
> +}
> +
> +//++
> ------------------------------------------------------------------------------------
> +// Details: Retrieve the print-values found in the argument.
> +// Type: Method.
> +// Args: None.
> +// Return: MIuint - The print-values.
> +// Throws: None.
> +//--
> +MIuint
> +CMICmdArgValPrintValues::GetPrintValues(void) const
> +{
> + return m_nPrintValues;
> +}
>
> Added: lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.h?rev=237429&view=auto
>
> ==============================================================================
> --- lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.h (added)
> +++ lldb/trunk/tools/lldb-mi/MICmdArgValPrintValues.h Fri May 15 04:46:28
> 2015
> @@ -0,0 +1,53 @@
> +//===-- MICmdArgValPrintValues.h --------------------------------*- C++
> -*-===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
>
> +//===----------------------------------------------------------------------===//
> +
> +#pragma once
> +
> +// In-house headers:
> +#include "MICmdArgValBase.h"
> +
> +// Declarations:
> +class CMICmdArgContext;
> +
> +//++
> ============================================================================
> +// Details: MI common code class. Command argument class. Arguments object
> +// needing specialization derived from the CMICmdArgValBase
> class.
> +// An argument knows what type of argument it is and how it is to
> +// interpret the options (context) string to find and validate a
> matching
> +// argument and so extract a value from it. The print-values
> looks like:
> +// 0 or --no-values
> +// 1 or --all-values
> +// 2 or --simple-values
> +// Based on the Interpreter pattern.
> +//--
> +class CMICmdArgValPrintValues : public CMICmdArgValBaseTemplate<MIuint>
> +{
> + // Methods:
> + public:
> + /* ctor */ CMICmdArgValPrintValues(void);
> + /* ctor */ CMICmdArgValPrintValues(const CMIUtilString &vrArgName,
> const bool vbMandatory, const bool vbHandleByCmd);
> + //
> + bool IsArgPrintValues(const CMIUtilString &vrTxt) const;
> +
> + // Overridden:
> + public:
> + // From CMICmdArgValBase
> + /* dtor */ virtual ~CMICmdArgValPrintValues(void);
> + // From CMICmdArgSet::IArg
> + virtual bool Validate(CMICmdArgContext &vArgContext);
> +
> + // Methods:
> + private:
> + bool ExtractPrintValues(const CMIUtilString &vrTxt);
> + MIuint GetPrintValues(void) const;
> +
> + // Attributes:
> + private:
> + MIuint m_nPrintValues;
> +};
>
> Modified: lldb/trunk/tools/lldb-mi/MICmdCmdStack.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdStack.cpp?rev=237429&r1=237428&r2=237429&view=diff
>
> ==============================================================================
> --- lldb/trunk/tools/lldb-mi/MICmdCmdStack.cpp (original)
> +++ lldb/trunk/tools/lldb-mi/MICmdCmdStack.cpp Fri May 15 04:46:28 2015
> @@ -29,6 +29,7 @@
> #include "MICmdArgValThreadGrp.h"
> #include "MICmdArgValOptionLong.h"
> #include "MICmdArgValOptionShort.h"
> +#include "MICmdArgValPrintValues.h"
> #include "MICmdArgValListOfN.h"
>
> //++
> ------------------------------------------------------------------------------------
> @@ -449,9 +450,6 @@ CMICmdCmdStackListArguments::CMICmdCmdSt
> , m_miValueList(true)
> , m_constStrArgThread("thread")
> , m_constStrArgPrintValues("print-values")
> - , m_constStrArgNoValues("no-values")
> - , m_constStrArgAllValues("all-values")
> - , m_constStrArgSimpleValues("simple-values")
> , m_constStrArgFrameLow("low-frame")
> , m_constStrArgFrameHigh("high-frame")
> {
> @@ -487,10 +485,7 @@ CMICmdCmdStackListArguments::ParseArgs(v
> {
> bool bOk =
> m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgThread, false, true,
> CMICmdArgValListBase::eArgValType_Number, 1)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgPrintValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgNoValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgAllValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgSimpleValues, false, true)));
> + bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValPrintValues(m_constStrArgPrintValues, true, true)));
> bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgFrameLow, false, true)));
> bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgFrameHigh, false, true)));
> return (bOk && ParseValidateCmdOptions());
> @@ -509,10 +504,7 @@ bool
> CMICmdCmdStackListArguments::Execute(void)
> {
> CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
> - CMICMDBASE_GETOPTION(pArgPrintValues, Number,
> m_constStrArgPrintValues);
> - CMICMDBASE_GETOPTION(pArgNoValues, OptionLong, m_constStrArgNoValues);
> - CMICMDBASE_GETOPTION(pArgAllValues, OptionLong,
> m_constStrArgAllValues);
> - CMICMDBASE_GETOPTION(pArgSimpleValues, OptionLong,
> m_constStrArgSimpleValues);
> + CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues,
> m_constStrArgPrintValues);
> CMICMDBASE_GETOPTION(pArgFrameLow, Number, m_constStrArgFrameLow);
> CMICMDBASE_GETOPTION(pArgFrameHigh, Number, m_constStrArgFrameHigh);
>
> @@ -527,28 +519,7 @@ CMICmdCmdStackListArguments::Execute(voi
> }
> }
>
> - CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat;
> - if (pArgPrintValues->GetFound())
> - {
> - const MIuint nPrintValues = pArgPrintValues->GetValue();
> - if (nPrintValues >=
> CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
> - {
> -
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES),
> m_cmdData.strMiCmd.c_str()));
> - return MIstatus::failure;
> - }
> - eVarInfoFormat =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(nPrintValues);
> - }
> - else if (pArgNoValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> - else if (pArgAllValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues;
> - else if (pArgSimpleValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues;
> - else
> - {
> -
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES),
> m_cmdData.strMiCmd.c_str()));
> - return MIstatus::failure;
> - }
> + const CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat
> =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(pArgPrintValues->GetValue());
>
> MIuint nFrameLow = 0;
> MIuint nFrameHigh = UINT32_MAX;
> @@ -667,9 +638,6 @@ CMICmdCmdStackListLocals::CMICmdCmdStack
> , m_constStrArgThread("thread")
> , m_constStrArgFrame("frame")
> , m_constStrArgPrintValues("print-values")
> - , m_constStrArgNoValues("no-values")
> - , m_constStrArgAllValues("all-values")
> - , m_constStrArgSimpleValues("simple-values")
> {
> // Command factory matches this name with that received from the
> stdin stream
> m_strMiCmd = "stack-list-locals";
> @@ -705,10 +673,7 @@ CMICmdCmdStackListLocals::ParseArgs(void
> m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgThread, false, true,
> CMICmdArgValListBase::eArgValType_Number, 1)));
> bOk = bOk &&
> m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgFrame, false, true,
> CMICmdArgValListBase::eArgValType_Number, 1)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgPrintValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgNoValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgAllValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgSimpleValues, false, true)));
> + bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValPrintValues(m_constStrArgPrintValues, true, true)));
> return (bOk && ParseValidateCmdOptions());
> }
>
> @@ -726,10 +691,7 @@ CMICmdCmdStackListLocals::Execute(void)
> {
> CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
> CMICMDBASE_GETOPTION(pArgFrame, OptionLong, m_constStrArgFrame);
> - CMICMDBASE_GETOPTION(pArgPrintValues, Number,
> m_constStrArgPrintValues);
> - CMICMDBASE_GETOPTION(pArgNoValues, OptionLong, m_constStrArgNoValues);
> - CMICMDBASE_GETOPTION(pArgAllValues, OptionLong,
> m_constStrArgAllValues);
> - CMICMDBASE_GETOPTION(pArgSimpleValues, OptionLong,
> m_constStrArgSimpleValues);
> + CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues,
> m_constStrArgPrintValues);
>
> // Retrieve the --thread option's thread ID (only 1)
> MIuint64 nThreadId = UINT64_MAX;
> @@ -752,28 +714,7 @@ CMICmdCmdStackListLocals::Execute(void)
> }
> }
>
> - CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat;
> - if (pArgPrintValues->GetFound())
> - {
> - const MIuint nPrintValues = pArgPrintValues->GetValue();
> - if (nPrintValues >=
> CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
> - {
> -
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES),
> m_cmdData.strMiCmd.c_str()));
> - return MIstatus::failure;
> - }
> - eVarInfoFormat =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(nPrintValues);
> - }
> - else if (pArgNoValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> - else if (pArgAllValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues;
> - else if (pArgSimpleValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues;
> - else
> - {
> -
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES),
> m_cmdData.strMiCmd.c_str()));
> - return MIstatus::failure;
> - }
> + const CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat
> =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(pArgPrintValues->GetValue());
>
> CMICmnLLDBDebugSessionInfo
> &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
> lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
> @@ -862,9 +803,6 @@ CMICmdCmdStackListVariables::CMICmdCmdSt
> , m_constStrArgThread("thread")
> , m_constStrArgFrame("frame")
> , m_constStrArgPrintValues("print-values")
> - , m_constStrArgNoValues("no-values")
> - , m_constStrArgAllValues("all-values")
> - , m_constStrArgSimpleValues("simple-values")
> {
> // Command factory matches this name with that received from the
> stdin stream
> m_strMiCmd = "stack-list-variables";
> @@ -900,10 +838,7 @@ CMICmdCmdStackListVariables::ParseArgs(v
> m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgThread,
> false, true, CMICmdArgValListBase::eArgValType_Number, 1)));
> bOk = bOk &&
> m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgFrame,
> false, true, CMICmdArgValListBase::eArgValType_Number, 1)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgPrintValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgNoValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgAllValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgSimpleValues, false, true)));
> + bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValPrintValues(m_constStrArgPrintValues, true, true)));
> return (bOk && ParseValidateCmdOptions());
> }
>
> @@ -921,10 +856,7 @@ CMICmdCmdStackListVariables::Execute(voi
> {
> CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
> CMICMDBASE_GETOPTION(pArgFrame, OptionLong, m_constStrArgFrame);
> - CMICMDBASE_GETOPTION(pArgPrintValues, Number,
> m_constStrArgPrintValues);
> - CMICMDBASE_GETOPTION(pArgNoValues, OptionLong, m_constStrArgNoValues);
> - CMICMDBASE_GETOPTION(pArgAllValues, OptionLong,
> m_constStrArgAllValues);
> - CMICMDBASE_GETOPTION(pArgSimpleValues, OptionLong,
> m_constStrArgSimpleValues);
> + CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues,
> m_constStrArgPrintValues);
>
> // Retrieve the --thread option's thread ID (only 1)
> MIuint64 nThreadId = UINT64_MAX;
> @@ -947,28 +879,7 @@ CMICmdCmdStackListVariables::Execute(voi
> }
> }
>
> - CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat;
> - if (pArgPrintValues->GetFound())
> - {
> - const MIuint nPrintValues = pArgPrintValues->GetValue();
> - if (nPrintValues >=
> CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
> - {
> -
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES),
> m_cmdData.strMiCmd.c_str()));
> - return MIstatus::failure;
> - }
> - eVarInfoFormat =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(nPrintValues);
> - }
> - else if (pArgNoValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> - else if (pArgAllValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues;
> - else if (pArgSimpleValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues;
> - else
> - {
> -
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES),
> m_cmdData.strMiCmd.c_str()));
> - return MIstatus::failure;
> - }
> + const CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat
> =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(pArgPrintValues->GetValue());
>
> CMICmnLLDBDebugSessionInfo
> &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
> lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
>
> Modified: lldb/trunk/tools/lldb-mi/MICmdCmdStack.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdStack.h?rev=237429&r1=237428&r2=237429&view=diff
>
> ==============================================================================
> --- lldb/trunk/tools/lldb-mi/MICmdCmdStack.h (original)
> +++ lldb/trunk/tools/lldb-mi/MICmdCmdStack.h Fri May 15 04:46:28 2015
> @@ -166,9 +166,6 @@ class CMICmdCmdStackListArguments : publ
> CMICmnMIValueList m_miValueList;
> const CMIUtilString m_constStrArgThread; // Not specified in MI
> spec but Eclipse gives this option
> const CMIUtilString m_constStrArgPrintValues;
> - const CMIUtilString m_constStrArgNoValues;
> - const CMIUtilString m_constStrArgAllValues;
> - const CMIUtilString m_constStrArgSimpleValues;
> const CMIUtilString m_constStrArgFrameLow;
> const CMIUtilString m_constStrArgFrameHigh;
> };
> @@ -207,9 +204,6 @@ class CMICmdCmdStackListLocals : public
> const CMIUtilString m_constStrArgThread; // Not specified in MI
> spec but Eclipse gives this option
> const CMIUtilString m_constStrArgFrame; // Not specified in MI
> spec but Eclipse gives this option
> const CMIUtilString m_constStrArgPrintValues;
> - const CMIUtilString m_constStrArgNoValues;
> - const CMIUtilString m_constStrArgAllValues;
> - const CMIUtilString m_constStrArgSimpleValues;
> };
>
> //++
> ============================================================================
> @@ -243,9 +237,6 @@ private:
> const CMIUtilString m_constStrArgThread;
> const CMIUtilString m_constStrArgFrame;
> const CMIUtilString m_constStrArgPrintValues;
> - const CMIUtilString m_constStrArgNoValues;
> - const CMIUtilString m_constStrArgAllValues;
> - const CMIUtilString m_constStrArgSimpleValues;
> };
>
> //++
> ============================================================================
>
> Modified: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp?rev=237429&r1=237428&r2=237429&view=diff
>
> ==============================================================================
> --- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp (original)
> +++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp Fri May 15 04:46:28 2015
> @@ -33,6 +33,7 @@
> #include "MICmdArgValThreadGrp.h"
> #include "MICmdArgValOptionLong.h"
> #include "MICmdArgValOptionShort.h"
> +#include "MICmdArgValPrintValues.h"
> #include "MICmdArgValListOfN.h"
> #include "MICmnLLDBProxySBValue.h"
> #include "MICmnLLDBUtilSBValue.h"
> @@ -322,9 +323,6 @@ CMICmdCmdVarCreate::CompleteSBValue(lldb
> CMICmdCmdVarUpdate::CMICmdCmdVarUpdate(void)
> : m_constStrArgPrintValues("print-values")
> , m_constStrArgName("name")
> - , m_constStrArgNoValues("no-values")
> - , m_constStrArgAllValues("all-values")
> - , m_constStrArgSimpleValues("simple-values")
> , m_bValueChanged(false)
> , m_miValueList(true)
> {
> @@ -358,10 +356,7 @@ CMICmdCmdVarUpdate::~CMICmdCmdVarUpdate(
> bool
> CMICmdCmdVarUpdate::ParseArgs(void)
> {
> - bool bOk = m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgPrintValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgNoValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgAllValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgSimpleValues, false, true)));
> + bool bOk = m_setCmdArgs.Add(*(new
> CMICmdArgValPrintValues(m_constStrArgPrintValues, false, true)));
> bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValString(m_constStrArgName, true, true)));
> return (bOk && ParseValidateCmdOptions());
> }
> @@ -378,32 +373,12 @@ CMICmdCmdVarUpdate::ParseArgs(void)
> bool
> CMICmdCmdVarUpdate::Execute(void)
> {
> - CMICMDBASE_GETOPTION(pArgPrintValues, Number,
> m_constStrArgPrintValues);
> - CMICMDBASE_GETOPTION(pArgNoValues, OptionLong, m_constStrArgNoValues);
> - CMICMDBASE_GETOPTION(pArgAllValues, OptionLong,
> m_constStrArgAllValues);
> - CMICMDBASE_GETOPTION(pArgSimpleValues, OptionLong,
> m_constStrArgSimpleValues);
> + CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues,
> m_constStrArgPrintValues);
> CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
>
> - CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat;
> + CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> if (pArgPrintValues->GetFound())
> - {
> - const MIuint nPrintValues = pArgPrintValues->GetValue();
> - if (nPrintValues >=
> CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
> - {
> -
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES),
> m_cmdData.strMiCmd.c_str()));
> - return MIstatus::failure;
> - }
> - eVarInfoFormat =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(nPrintValues);
> - }
> - else if (pArgNoValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> - else if (pArgAllValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues;
> - else if (pArgSimpleValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues;
> - else
> - // If no print-values, default is "no-values"
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> + eVarInfoFormat =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(pArgPrintValues->GetValue());
>
> const CMIUtilString &rVarObjName(pArgName->GetValue());
> CMICmnLLDBDebugSessionInfoVarObj varObj;
> @@ -945,9 +920,6 @@ CMICmdCmdVarSetFormat::CreateSelf(void)
> //--
> CMICmdCmdVarListChildren::CMICmdCmdVarListChildren(void)
> : m_constStrArgPrintValues("print-values")
> - , m_constStrArgNoValues("no-values")
> - , m_constStrArgAllValues("all-values")
> - , m_constStrArgSimpleValues("simple-values")
> , m_constStrArgName("name")
> , m_constStrArgFrom("from")
> , m_constStrArgTo("to")
> @@ -986,10 +958,7 @@ CMICmdCmdVarListChildren::~CMICmdCmdVarL
> bool
> CMICmdCmdVarListChildren::ParseArgs(void)
> {
> - bool bOk = m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgPrintValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgNoValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgAllValues, false, true)));
> - bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValOptionLong(m_constStrArgSimpleValues, false, true)));
> + bool bOk = m_setCmdArgs.Add(*(new
> CMICmdArgValPrintValues(m_constStrArgPrintValues, false, true)));
> bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValString(m_constStrArgName, true, true)));
> bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgFrom, false, true)));
> bOk = bOk && m_setCmdArgs.Add(*(new
> CMICmdArgValNumber(m_constStrArgTo, false, true)));
> @@ -1008,34 +977,14 @@ CMICmdCmdVarListChildren::ParseArgs(void
> bool
> CMICmdCmdVarListChildren::Execute(void)
> {
> - CMICMDBASE_GETOPTION(pArgPrintValues, Number,
> m_constStrArgPrintValues);
> - CMICMDBASE_GETOPTION(pArgNoValues, OptionLong, m_constStrArgNoValues);
> - CMICMDBASE_GETOPTION(pArgAllValues, OptionLong,
> m_constStrArgAllValues);
> - CMICMDBASE_GETOPTION(pArgSimpleValues, OptionLong,
> m_constStrArgSimpleValues);
> + CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues,
> m_constStrArgPrintValues);
> CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
> CMICMDBASE_GETOPTION(pArgFrom, Number, m_constStrArgFrom);
> CMICMDBASE_GETOPTION(pArgTo, Number, m_constStrArgTo);
>
> - CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat;
> + CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> if (pArgPrintValues->GetFound())
> - {
> - const MIuint nPrintValues = pArgPrintValues->GetValue();
> - if (nPrintValues >=
> CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
> - {
> -
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES),
> m_cmdData.strMiCmd.c_str()));
> - return MIstatus::failure;
> - }
> - eVarInfoFormat =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(nPrintValues);
> - }
> - else if (pArgNoValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> - else if (pArgAllValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues;
> - else if (pArgSimpleValues->GetFound())
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues;
> - else
> - // If no print-values, default is "no-values"
> - eVarInfoFormat =
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> + eVarInfoFormat =
> static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(pArgPrintValues->GetValue());
>
> const CMIUtilString &rVarObjName(pArgName->GetValue());
> CMICmnLLDBDebugSessionInfoVarObj varObj;
>
> Modified: lldb/trunk/tools/lldb-mi/MICmdCmdVar.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdVar.h?rev=237429&r1=237428&r2=237429&view=diff
>
> ==============================================================================
> --- lldb/trunk/tools/lldb-mi/MICmdCmdVar.h (original)
> +++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.h Fri May 15 04:46:28 2015
> @@ -128,9 +128,6 @@ class CMICmdCmdVarUpdate : public CMICmd
> private:
> const CMIUtilString m_constStrArgPrintValues;
> const CMIUtilString m_constStrArgName;
> - const CMIUtilString m_constStrArgNoValues;
> - const CMIUtilString m_constStrArgAllValues;
> - const CMIUtilString m_constStrArgSimpleValues;
> bool m_bValueChanged; // True = yes value changed, false = no change
> CMICmnMIValueList m_miValueList;
> };
> @@ -266,9 +263,6 @@ class CMICmdCmdVarListChildren : public
> // Attributes:
> private:
> const CMIUtilString m_constStrArgPrintValues;
> - const CMIUtilString m_constStrArgNoValues;
> - const CMIUtilString m_constStrArgAllValues;
> - const CMIUtilString m_constStrArgSimpleValues;
> const CMIUtilString m_constStrArgName;
> const CMIUtilString m_constStrArgFrom;
> const CMIUtilString m_constStrArgTo;
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150515/85391ef7/attachment.html>
More information about the lldb-commits
mailing list