summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectWatchpoint.cpp
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2016-08-11 23:51:28 +0000
committerTodd Fiala <todd.fiala@gmail.com>2016-08-11 23:51:28 +0000
commite1cfbc79420fee0b71bad62f8d413b68a0eca91e (patch)
treeab91f6f91be4051731e37ed69ca9ff8c7bdad1ff /lldb/source/Commands/CommandObjectWatchpoint.cpp
parent1602421c852d9d7fddbe8c5f014d7861a7848865 (diff)
downloadbcm5719-llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.tar.gz
bcm5719-llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.zip
Decoupled Options from CommandInterpreter.
Options used to store a reference to the CommandInterpreter instance in the base Options class. This made it impossible to parse options independent of a CommandInterpreter. This change removes the reference from the base class. Instead, it modifies the options-parsing-related methods to take an ExecutionContext pointer, which the options may inspect if they need to do so. Closes https://reviews.llvm.org/D23416 Reviewers: clayborg, jingham llvm-svn: 278440
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index 977b6bb3743..f232311fcf3 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -170,7 +170,7 @@ public:
"watchpoint list",
"List all watchpoints at configurable levels of detail.",
nullptr),
- m_options(interpreter)
+ m_options()
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -189,8 +189,8 @@ public:
class CommandOptions : public Options
{
public:
- CommandOptions (CommandInterpreter &interpreter) :
- Options(interpreter),
+ CommandOptions() :
+ Options(),
m_level(lldb::eDescriptionLevelBrief) // Watchpoint List defaults to brief descriptions
{
}
@@ -198,7 +198,8 @@ public:
~CommandOptions() override = default;
Error
- SetOptionValue (uint32_t option_idx, const char *option_arg) override
+ SetOptionValue(uint32_t option_idx, const char *option_arg,
+ ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@@ -223,7 +224,7 @@ public:
}
void
- OptionParsingStarting () override
+ OptionParsingStarting(ExecutionContext *execution_context) override
{
m_level = lldb::eDescriptionLevelFull;
}
@@ -589,7 +590,7 @@ public:
"watchpoint ignore",
"Set ignore count on the specified watchpoint(s). If no watchpoints are specified, set them all.",
nullptr),
- m_options (interpreter)
+ m_options()
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -608,8 +609,8 @@ public:
class CommandOptions : public Options
{
public:
- CommandOptions (CommandInterpreter &interpreter) :
- Options (interpreter),
+ CommandOptions() :
+ Options(),
m_ignore_count (0)
{
}
@@ -617,7 +618,8 @@ public:
~CommandOptions() override = default;
Error
- SetOptionValue (uint32_t option_idx, const char *option_arg) override
+ SetOptionValue(uint32_t option_idx, const char *option_arg,
+ ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@@ -638,7 +640,7 @@ public:
}
void
- OptionParsingStarting () override
+ OptionParsingStarting(ExecutionContext *execution_context) override
{
m_ignore_count = 0;
}
@@ -738,7 +740,7 @@ public:
"If no watchpoint is specified, act on the last created watchpoint. "
"Passing an empty argument clears the modification.",
nullptr),
- m_options (interpreter)
+ m_options()
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -757,8 +759,8 @@ public:
class CommandOptions : public Options
{
public:
- CommandOptions (CommandInterpreter &interpreter) :
- Options (interpreter),
+ CommandOptions() :
+ Options(),
m_condition (),
m_condition_passed (false)
{
@@ -767,7 +769,8 @@ public:
~CommandOptions() override = default;
Error
- SetOptionValue (uint32_t option_idx, const char *option_arg) override
+ SetOptionValue(uint32_t option_idx, const char *option_arg,
+ ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@@ -790,7 +793,7 @@ public:
}
void
- OptionParsingStarting () override
+ OptionParsingStarting(ExecutionContext *execution_context) override
{
m_condition.clear();
m_condition_passed = false;
@@ -907,7 +910,7 @@ public:
eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
- m_option_group (interpreter),
+ m_option_group(),
m_option_watchpoint ()
{
SetHelpLong(
@@ -1116,7 +1119,7 @@ public:
eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
- m_option_group (interpreter),
+ m_option_group(),
m_option_watchpoint ()
{
SetHelpLong(
@@ -1162,7 +1165,8 @@ protected:
bool
DoExecute (const char *raw_command, CommandReturnObject &result) override
{
- m_option_group.NotifyOptionParsingStarting(); // This is a raw command, so notify the option group
+ auto exe_ctx = GetCommandInterpreter().GetExecutionContext();
+ m_option_group.NotifyOptionParsingStarting(&exe_ctx); // This is a raw command, so notify the option group
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
StackFrame *frame = m_exe_ctx.GetFramePtr();
@@ -1197,7 +1201,8 @@ protected:
if (!ParseOptions (args, result))
return false;
- Error error (m_option_group.NotifyOptionParsingFinished());
+ Error error(m_option_group.NotifyOptionParsingFinished(
+ &exe_ctx));
if (error.Fail())
{
result.AppendError (error.AsCString());
OpenPOWER on IntegriCloud