diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2012-02-08 01:13:31 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2012-02-08 01:13:31 +0000 |
| commit | 34ddc8db22b0faef3050fe41e502d1fea6bee062 (patch) | |
| tree | 1340628892e15a1fd3a002087f7c1dacf95a80d3 /lldb/source/Commands/CommandObjectWatchpoint.h | |
| parent | 5c3c1286a55561d21bbe158f710143d29a90110f (diff) | |
| download | bcm5719-llvm-34ddc8db22b0faef3050fe41e502d1fea6bee062.tar.gz bcm5719-llvm-34ddc8db22b0faef3050fe41e502d1fea6bee062.zip | |
Refine the 'watchpoint set' command to now require either the '-v' option (for watching of a variable) or
the '-e' option (for watching of an address) to be present.
Update some existing test cases with the required option and add some more test cases.
Since the '-v' option takes <variable-name> and the '-e' option takes <expr> as the command arg,
the existing infrastructure for generating the option usage can produce confusing help message,
like:
watchpoint set -e [-w <watch-type>] [-x <byte-size>] <variable-name | expr>
watchpoint set -v [-w <watch-type>] [-x <byte-size>] <variable-name | expr>
The solution adopted is to provide an extra member field to the struct CommandArgumentData called
(uint32_t)arg_opt_set_association, whose purpose is to link this particular argument data with some
option set(s). Also modify the signature of CommandObject::GetFormattedCommandArguments() to:
GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL)
it now takes an additional opt_set_mask which can be used to generate a filtered formatted command
args for help message.
Options::GenerateOptionUsage() impl is modified to call the GetFormattedCommandArguments() appropriately.
So that the help message now looks like:
watchpoint set -e [-w <watch-type>] [-x <byte-size>] <expr>
watchpoint set -v [-w <watch-type>] [-x <byte-size>] <variable-name>
rdar://problem/10703256
llvm-svn: 150032
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.h')
| -rw-r--r-- | lldb/source/Commands/CommandObjectWatchpoint.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.h b/lldb/source/Commands/CommandObjectWatchpoint.h index c61ebf44d3a..ff8d613abd2 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.h +++ b/lldb/source/Commands/CommandObjectWatchpoint.h @@ -251,6 +251,36 @@ class CommandObjectWatchpointSet : public CommandObject { public: + class CommandOptions : public OptionGroup + { + public: + + CommandOptions (); + + virtual + ~CommandOptions (); + + virtual uint32_t + GetNumDefinitions (); + + virtual const OptionDefinition* + GetDefinitions (); + + virtual Error + SetOptionValue (CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value); + + virtual void + OptionParsingStarting (CommandInterpreter &interpreter); + + // Options table: Required for subclasses of Options. + + static OptionDefinition g_option_table[]; + bool m_do_expression; + bool m_do_variable; + }; + CommandObjectWatchpointSet (CommandInterpreter &interpreter); virtual @@ -266,6 +296,7 @@ public: private: OptionGroupOptions m_option_group; OptionGroupWatchpoint m_option_watchpoint; + CommandOptions m_command_options; }; } // namespace lldb_private |

