summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Interpreter/CommandObject.h6
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp68
-rw-r--r--lldb/source/Interpreter/CommandObject.cpp20
3 files changed, 30 insertions, 64 deletions
diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h
index f389ab875da..27bcae1cee3 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -361,6 +361,12 @@ protected:
bool m_is_alias;
Flags m_flags;
std::vector<CommandArgumentEntry> m_arguments;
+
+ // Helper function to populate IDs or ID ranges as the command argument data
+ // to the specified command argument entry.
+ static void
+ AddIDsArgumentData(CommandArgumentEntry &arg);
+
};
} // namespace lldb_private
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 2b9643ebe3d..5c96a7f6d92 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -826,22 +826,7 @@ CommandObjectBreakpointEnable::CommandObjectBreakpointEnable (CommandInterpreter
NULL)
{
CommandArgumentEntry arg;
- CommandArgumentData bp_id_arg;
- CommandArgumentData bp_id_range_arg;
-
- // Create the first variant for the first (and only) argument for this command.
- bp_id_arg.arg_type = eArgTypeBreakpointID;
- bp_id_arg.arg_repetition = eArgRepeatOptional;
-
- // Create the second variant for the first (and only) argument for this command.
- bp_id_range_arg.arg_type = eArgTypeBreakpointIDRange;
- bp_id_range_arg.arg_repetition = eArgRepeatOptional;
-
- // The first (and only) argument for this command could be either a bp_id or a bp_id_range.
- // Push both variants into the entry for the first argument for this command.
- arg.push_back (bp_id_arg);
- arg.push_back (bp_id_range_arg);
-
+ CommandObject::AddIDsArgumentData(arg);
// Add the entry for the first argument for this command to the object's arguments vector.
m_arguments.push_back (arg);
}
@@ -942,22 +927,7 @@ CommandObjectBreakpointDisable::CommandObjectBreakpointDisable (CommandInterpret
NULL)
{
CommandArgumentEntry arg;
- CommandArgumentData bp_id_arg;
- CommandArgumentData bp_id_range_arg;
-
- // Create the first variant for the first (and only) argument for this command.
- bp_id_arg.arg_type = eArgTypeBreakpointID;
- bp_id_arg.arg_repetition = eArgRepeatOptional;
-
- // Create the second variant for the first (and only) argument for this command.
- bp_id_range_arg.arg_type = eArgTypeBreakpointIDRange;
- bp_id_range_arg.arg_repetition = eArgRepeatOptional;
-
- // The first (and only) argument for this command could be either a bp_id or a bp_id_range.
- // Push both variants into the entry for the first argument for this command.
- arg.push_back (bp_id_arg);
- arg.push_back (bp_id_range_arg);
-
+ CommandObject::AddIDsArgumentData(arg);
// Add the entry for the first argument for this command to the object's arguments vector.
m_arguments.push_back (arg);
}
@@ -1238,22 +1208,7 @@ CommandObjectBreakpointDelete::CommandObjectBreakpointDelete(CommandInterpreter
NULL)
{
CommandArgumentEntry arg;
- CommandArgumentData bp_id_arg;
- CommandArgumentData bp_id_range_arg;
-
- // Create the first variant for the first (and only) argument for this command.
- bp_id_arg.arg_type = eArgTypeBreakpointID;
- bp_id_arg.arg_repetition = eArgRepeatOptional;
-
- // Create the second variant for the first (and only) argument for this command.
- bp_id_range_arg.arg_type = eArgTypeBreakpointIDRange;
- bp_id_range_arg.arg_repetition = eArgRepeatOptional;
-
- // The first (and only) argument for this command could be either a bp_id or a bp_id_range.
- // Push both variants into the entry for the first argument for this command.
- arg.push_back (bp_id_arg);
- arg.push_back (bp_id_range_arg);
-
+ CommandObject::AddIDsArgumentData(arg);
// Add the entry for the first argument for this command to the object's arguments vector.
m_arguments.push_back (arg);
}
@@ -1513,22 +1468,7 @@ CommandObjectBreakpointModify::CommandObjectBreakpointModify (CommandInterpreter
m_options (interpreter)
{
CommandArgumentEntry arg;
- CommandArgumentData bp_id_arg;
- CommandArgumentData bp_id_range_arg;
-
- // Create the first variant for the first (and only) argument for this command.
- bp_id_arg.arg_type = eArgTypeBreakpointID;
- bp_id_arg.arg_repetition = eArgRepeatPlain;
-
- // Create the second variant for the first (and only) argument for this command.
- bp_id_range_arg.arg_type = eArgTypeBreakpointIDRange;
- bp_id_range_arg.arg_repetition = eArgRepeatPlain;
-
- // The first (and only) argument for this command could be either a bp_id or a bp_id_range.
- // Push both variants into the entry for the first argument for this command.
- arg.push_back (bp_id_arg);
- arg.push_back (bp_id_range_arg);
-
+ CommandObject::AddIDsArgumentData(arg);
// Add the entry for the first argument for this command to the object's arguments vector.
m_arguments.push_back (arg);
}
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index ebfbb0fe078..0bf42799015 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -743,6 +743,26 @@ ExprPathHelpTextCallback()
" meaning of array slicing (taking elements n thru m inside the array or pointed-to memory).";
}
+void
+CommandObject::AddIDsArgumentData(CommandArgumentEntry &arg)
+{
+ CommandArgumentData id_arg;
+ CommandArgumentData id_range_arg;
+
+ // Create the first variant for the first (and only) argument for this command.
+ id_arg.arg_type = eArgTypeBreakpointID;
+ id_arg.arg_repetition = eArgRepeatOptional;
+
+ // Create the second variant for the first (and only) argument for this command.
+ id_range_arg.arg_type = eArgTypeBreakpointIDRange;
+ id_range_arg.arg_repetition = eArgRepeatOptional;
+
+ // The first (and only) argument for this command could be either a id or a id_range.
+ // Push both variants into the entry for the first argument for this command.
+ arg.push_back(id_arg);
+ arg.push_back(id_range_arg);
+}
+
const char *
CommandObject::GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type)
{
OpenPOWER on IntegriCloud