diff options
author | Raphael Isemann <teemperor@gmail.com> | 2018-08-30 00:09:21 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2018-08-30 00:09:21 +0000 |
commit | 207863261ca5466bf529bbd13ba0502a649e00d0 (patch) | |
tree | 3783a4456fc7e4c92119dc71f0f66ef2f4cc6848 /lldb/source/Core/Debugger.cpp | |
parent | db92a4a83944d3999497ec7b97e5f4e0947cf267 (diff) | |
download | bcm5719-llvm-207863261ca5466bf529bbd13ba0502a649e00d0.tar.gz bcm5719-llvm-207863261ca5466bf529bbd13ba0502a649e00d0.zip |
Move the column marking functionality to the Highlighter framework
Summary:
The syntax highlighting feature so far is mutually exclusive with the lldb feature
that marks the current column in the line by underlining it via an ANSI color code.
Meaning that if you enable one, the other is automatically disabled by LLDB.
This was caused by the fact that both features inserted color codes into the the
source code and were likely to interfere with each other (which would result
in a broken source code printout to the user).
This patch moves the cursor code into the highlighting framework, which provides
the same feature to the user in normal non-C source code. For any source code
that is highlighted by Clang, we now also have cursor marking for the whole token
that is under the current source location. E.g., before we underlined only the '!' in the
expression '1 != 2', but now the whole token '!=' is underlined. The same for function
calls and so on. Below you can see two examples where we before only underlined
the first character of the token, but now underline the whole token.
{F7075400}
{F7075414}
It also simplifies the DisplaySourceLines method in the SourceManager as most of
the code in there was essentially just for getting this column marker to work as
a FormatEntity.
Reviewers: aprantl
Reviewed By: aprantl
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D51466
llvm-svn: 341003
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 763c89e6f04..692856f17bf 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -177,9 +177,6 @@ OptionEnumValueElement g_language_enumerators[] = { // args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name- // without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}: -#define DEFAULT_STOP_SHOW_COLUMN_ANSI_PREFIX "${ansi.underline}" -#define DEFAULT_STOP_SHOW_COLUMN_ANSI_SUFFIX "${ansi.normal}" - static OptionEnumValueElement s_stop_show_column_values[] = { {eStopShowColumnAnsiOrCaret, "ansi-or-caret", "Highlight the stop column with ANSI terminal codes when color/ANSI mode " @@ -239,13 +236,13 @@ static PropertyDefinition g_properties[] = { eStopShowColumnAnsiOrCaret, nullptr, s_stop_show_column_values, "If true, LLDB will use the column information from the debug info to " "mark the current position when displaying a stopped context."}, - {"stop-show-column-ansi-prefix", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_STOP_SHOW_COLUMN_ANSI_PREFIX, nullptr, + {"stop-show-column-ansi-prefix", OptionValue::eTypeString, true, 0, + "${ansi.underline}", nullptr, "When displaying the column marker in a color-enabled (i.e. ANSI) " "terminal, use the ANSI terminal code specified in this format at the " "immediately before the column to be marked."}, - {"stop-show-column-ansi-suffix", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_STOP_SHOW_COLUMN_ANSI_SUFFIX, nullptr, + {"stop-show-column-ansi-suffix", OptionValue::eTypeString, true, 0, + "${ansi.normal}", nullptr, "When displaying the column marker in a color-enabled (i.e. ANSI) " "terminal, use the ANSI terminal code specified in this format " "immediately after the column to be marked."}, @@ -485,14 +482,14 @@ StopShowColumn Debugger::GetStopShowColumn() const { nullptr, idx, g_properties[idx].default_uint_value); } -const FormatEntity::Entry *Debugger::GetStopShowColumnAnsiPrefix() const { +llvm::StringRef Debugger::GetStopShowColumnAnsiPrefix() const { const uint32_t idx = ePropertyStopShowColumnAnsiPrefix; - return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx); + return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, ""); } -const FormatEntity::Entry *Debugger::GetStopShowColumnAnsiSuffix() const { +llvm::StringRef Debugger::GetStopShowColumnAnsiSuffix() const { const uint32_t idx = ePropertyStopShowColumnAnsiSuffix; - return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx); + return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, ""); } uint32_t Debugger::GetStopSourceLineCount(bool before) const { |