diff options
author | Alex Langford <alangford@apple.com> | 2023-04-24 16:58:18 -0700 |
---|---|---|
committer | Alex Langford <alangford@apple.com> | 2023-04-26 10:24:28 -0700 |
commit | c997acb97a9b15468d991116c28bb003afecb07c (patch) | |
tree | d0faf35ccac2a8d700519ee13954a58cf3c16925 /lldb/source/Commands/CommandObjectWatchpoint.cpp | |
parent | 3ce3ee6169828060d3671be1de6a67c21efcc668 (diff) | |
download | llvm-c997acb97a9b15468d991116c28bb003afecb07c.zip llvm-c997acb97a9b15468d991116c28bb003afecb07c.tar.gz llvm-c997acb97a9b15468d991116c28bb003afecb07c.tar.bz2 |
[lldb] Add support for specifying language when setting watchpoint by expression
This is useful in contexts where you have multiple languages in play:
You may be stopped in a frame for language A, but want to set a watchpoint
with an expression using language B. The current way to do this is to
use the setting `target.language` while setting the watchpoint and
unset it after the watchpoint is set, but that's kind of clunky and
somewhat error-prone. This should add a better way to do this.
rdar://108202559
Differential Revision: https://reviews.llvm.org/D149111
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpoint.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index 8b8c196..14180f9 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -835,8 +835,7 @@ corresponding to the byte size of the data type."); m_arguments.push_back(arg); // Absorb the '-w' and '-s' options into our option group. - m_option_group.Append(&m_option_watchpoint, LLDB_OPT_SET_ALL, - LLDB_OPT_SET_1); + m_option_group.Append(&m_option_watchpoint, LLDB_OPT_SET_1, LLDB_OPT_SET_1); m_option_group.Finalize(); } @@ -990,6 +989,7 @@ public: : CommandObjectRaw( interpreter, "watchpoint set expression", "Set a watchpoint on an address by supplying an expression. " + "Use the '-l' option to specify the language of the expression. " "Use the '-w' option to specify the type of watchpoint and " "the '-s' option to specify the byte size to watch for. " "If no '-w' option is specified, it defaults to write. " @@ -1083,6 +1083,8 @@ protected: options.SetKeepInMemory(false); options.SetTryAllThreads(true); options.SetTimeout(std::nullopt); + if (m_option_watchpoint.language_type != eLanguageTypeUnknown) + options.SetLanguage(m_option_watchpoint.language_type); ExpressionResults expr_result = target->EvaluateExpression(expr, frame, valobj_sp, options); |