JDevlieghere updated this revision to Diff 204842.
JDevlieghere added a comment.

Match dwarfdump color scheme


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62743/new/

https://reviews.llvm.org/D62743

Files:
  lldb/source/Core/Debugger.cpp

Index: lldb/source/Core/Debugger.cpp
===================================================================
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -101,14 +101,14 @@
      "Show disassembly when there is no source information, or the source file "
      "is missing when displaying a stop context."},
     {Debugger::eStopDisassemblyTypeAlways, "always",
-     "Always show disassembly when displaying a stop context."} };
+     "Always show disassembly when displaying a stop context."}};
 
 static constexpr OptionEnumValueElement g_language_enumerators[] = {
     {eScriptLanguageNone, "none", "Disable scripting languages."},
     {eScriptLanguagePython, "python",
      "Select python as the default scripting language."},
     {eScriptLanguageDefault, "default",
-     "Select the lldb default as the default scripting language."} };
+     "Select the lldb default as the default scripting language."}};
 
 #define MODULE_WITH_FUNC                                                       \
   "{ "                                                                         \
@@ -121,7 +121,9 @@
   "{${frame.no-debug}${function.pc-offset}}}}"
 
 #define FILE_AND_LINE                                                          \
-  "{ at ${line.file.basename}:${line.number}{:${line.column}}}"
+  "{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}"                    \
+  ":${line.number}{:${line.column}}}"
+
 #define IS_OPTIMIZED "{${function.is-optimized} [opt]}"
 
 #define IS_ARTIFICIAL "{${frame.is-artificial} [artificial]}"
@@ -129,32 +131,36 @@
 #define DEFAULT_THREAD_FORMAT                                                  \
   "thread #${thread.index}: tid = ${thread.id%tid}"                            \
   "{, ${frame.pc}}" MODULE_WITH_FUNC FILE_AND_LINE                             \
-  "{, name = '${thread.name}'}"                                                \
-  "{, queue = '${thread.queue}'}"                                              \
-  "{, activity = '${thread.info.activity.name}'}"                              \
+  "{, name = ${ansi.fg.green}'${thread.name}'${ansi.normal}}"                  \
+  "{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}"                \
+  "{, activity = "                                                             \
+  "${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}"              \
   "{, ${thread.info.trace_messages} messages}"                                 \
-  "{, stop reason = ${thread.stop-reason}}"                                    \
+  "{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}"        \
   "{\\nReturn value: ${thread.return-value}}"                                  \
   "{\\nCompleted expression: ${thread.completed-expression}}"                  \
   "\\n"
 
 #define DEFAULT_THREAD_STOP_FORMAT                                             \
   "thread #${thread.index}{, name = '${thread.name}'}"                         \
-  "{, queue = '${thread.queue}'}"                                              \
-  "{, activity = '${thread.info.activity.name}'}"                              \
+  "{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}"                \
+  "{, activity = "                                                             \
+  "${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}"              \
   "{, ${thread.info.trace_messages} messages}"                                 \
-  "{, stop reason = ${thread.stop-reason}}"                                    \
+  "{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}"        \
   "{\\nReturn value: ${thread.return-value}}"                                  \
   "{\\nCompleted expression: ${thread.completed-expression}}"                  \
   "\\n"
 
 #define DEFAULT_FRAME_FORMAT                                                   \
-  "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC FILE_AND_LINE          \
+  "frame #${frame.index}: "                                                    \
+  "${ansi.fg.yellow}${frame.pc}${ansi.normal}" MODULE_WITH_FUNC FILE_AND_LINE  \
       IS_OPTIMIZED IS_ARTIFICIAL "\\n"
 
 #define DEFAULT_FRAME_FORMAT_NO_ARGS                                           \
-  "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC_NO_ARGS FILE_AND_LINE  \
-      IS_OPTIMIZED IS_ARTIFICIAL "\\n"
+  "frame #${frame.index}: "                                                    \
+  "${ansi.fg.yellow}${frame.pc}${ansi.normal}" MODULE_WITH_FUNC_NO_ARGS        \
+      FILE_AND_LINE IS_OPTIMIZED IS_ARTIFICIAL "\\n"
 
 // Three parts to this disassembly format specification:
 //   1. If this is a new function/symbol (no previous symbol/function), print
@@ -186,9 +192,10 @@
      "Highlight the stop column with ANSI terminal codes when color/ANSI mode "
      "is enabled; otherwise, fall back to using a text-only caret (^) as if "
      "\"caret-only\" mode was selected."},
-    {eStopShowColumnAnsi, "ansi", "Highlight the stop column with ANSI "
-                                  "terminal codes when running LLDB with "
-                                  "color/ANSI enabled."},
+    {eStopShowColumnAnsi, "ansi",
+     "Highlight the stop column with ANSI "
+     "terminal codes when running LLDB with "
+     "color/ANSI enabled."},
     {eStopShowColumnCaret, "caret",
      "Highlight the stop column with a caret character (^) underneath the stop "
      "column. This method introduces a new line in source listings that "
@@ -196,90 +203,191 @@
     {eStopShowColumnNone, "none", "Do not highlight the stop column."}};
 
 static constexpr PropertyDefinition g_properties[] = {
-    {"auto-confirm", OptionValue::eTypeBoolean, true, false, nullptr, {},
+    {"auto-confirm",
+     OptionValue::eTypeBoolean,
+     true,
+     false,
+     nullptr,
+     {},
      "If true all confirmation prompts will receive their default reply."},
-    {"disassembly-format", OptionValue::eTypeFormatEntity, true, 0,
-     DEFAULT_DISASSEMBLY_FORMAT, {},
+    {"disassembly-format",
+     OptionValue::eTypeFormatEntity,
+     true,
+     0,
+     DEFAULT_DISASSEMBLY_FORMAT,
+     {},
      "The default disassembly format "
      "string to use when disassembling "
      "instruction sequences."},
-    {"frame-format", OptionValue::eTypeFormatEntity, true, 0,
-     DEFAULT_FRAME_FORMAT, {},
+    {"frame-format",
+     OptionValue::eTypeFormatEntity,
+     true,
+     0,
+     DEFAULT_FRAME_FORMAT,
+     {},
      "The default frame format string to use "
      "when displaying stack frame information "
      "for threads."},
-    {"notify-void", OptionValue::eTypeBoolean, true, false, nullptr, {},
+    {"notify-void",
+     OptionValue::eTypeBoolean,
+     true,
+     false,
+     nullptr,
+     {},
      "Notify the user explicitly if an expression returns void (default: "
      "false)."},
-    {"prompt", OptionValue::eTypeString, true,
-     OptionValueString::eOptionEncodeCharacterEscapeSequences, "(lldb) ", {},
+    {"prompt",
+     OptionValue::eTypeString,
+     true,
+     OptionValueString::eOptionEncodeCharacterEscapeSequences,
+     "(lldb) ",
+     {},
      "The debugger command line prompt displayed for the user."},
     {"script-lang", OptionValue::eTypeEnum, true, eScriptLanguagePython,
      nullptr, OptionEnumValues(g_language_enumerators),
      "The script language to be used for evaluating user-written scripts."},
-    {"stop-disassembly-count", OptionValue::eTypeSInt64, true, 4, nullptr, {},
+    {"stop-disassembly-count",
+     OptionValue::eTypeSInt64,
+     true,
+     4,
+     nullptr,
+     {},
      "The number of disassembly lines to show when displaying a "
      "stopped context."},
     {"stop-disassembly-display", OptionValue::eTypeEnum, true,
      Debugger::eStopDisassemblyTypeNoDebugInfo, nullptr,
      OptionEnumValues(g_show_disassembly_enum_values),
      "Control when to display disassembly when displaying a stopped context."},
-    {"stop-line-count-after", OptionValue::eTypeSInt64, true, 3, nullptr, {},
+    {"stop-line-count-after",
+     OptionValue::eTypeSInt64,
+     true,
+     3,
+     nullptr,
+     {},
      "The number of sources lines to display that come after the "
      "current source line when displaying a stopped context."},
-    {"stop-line-count-before", OptionValue::eTypeSInt64, true, 3, nullptr, {},
+    {"stop-line-count-before",
+     OptionValue::eTypeSInt64,
+     true,
+     3,
+     nullptr,
+     {},
      "The number of sources lines to display that come before the "
      "current source line when displaying a stopped context."},
-    {"highlight-source", OptionValue::eTypeBoolean, true, true, nullptr, {},
+    {"highlight-source",
+     OptionValue::eTypeBoolean,
+     true,
+     true,
+     nullptr,
+     {},
      "If true, LLDB will highlight the displayed source code."},
     {"stop-show-column", OptionValue::eTypeEnum, false,
-     eStopShowColumnAnsiOrCaret, nullptr, OptionEnumValues(s_stop_show_column_values),
+     eStopShowColumnAnsiOrCaret, nullptr,
+     OptionEnumValues(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::eTypeString, true, 0,
-     "${ansi.underline}", {},
+    {"stop-show-column-ansi-prefix",
+     OptionValue::eTypeString,
+     true,
+     0,
+     "${ansi.underline}",
+     {},
      "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::eTypeString, true, 0,
-     "${ansi.normal}", {},
+    {"stop-show-column-ansi-suffix",
+     OptionValue::eTypeString,
+     true,
+     0,
+     "${ansi.normal}",
+     {},
      "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."},
-    {"term-width", OptionValue::eTypeSInt64, true, 80, nullptr, {},
+    {"term-width",
+     OptionValue::eTypeSInt64,
+     true,
+     80,
+     nullptr,
+     {},
      "The maximum number of columns to use for displaying text."},
-    {"thread-format", OptionValue::eTypeFormatEntity, true, 0,
-     DEFAULT_THREAD_FORMAT, {},
+    {"thread-format",
+     OptionValue::eTypeFormatEntity,
+     true,
+     0,
+     DEFAULT_THREAD_FORMAT,
+     {},
      "The default thread format string to use "
      "when displaying thread information."},
-    {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0,
-     DEFAULT_THREAD_STOP_FORMAT, {},
+    {"thread-stop-format",
+     OptionValue::eTypeFormatEntity,
+     true,
+     0,
+     DEFAULT_THREAD_STOP_FORMAT,
+     {},
      "The default thread format  "
      "string to use when displaying thread "
      "information as part of the stop display."},
-    {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr, {},
+    {"use-external-editor",
+     OptionValue::eTypeBoolean,
+     true,
+     false,
+     nullptr,
+     {},
      "Whether to use an external editor or not."},
-    {"use-color", OptionValue::eTypeBoolean, true, true, nullptr, {},
+    {"use-color",
+     OptionValue::eTypeBoolean,
+     true,
+     true,
+     nullptr,
+     {},
      "Whether to use Ansi color codes or not."},
-    {"auto-one-line-summaries", OptionValue::eTypeBoolean, true, true, nullptr,
+    {"auto-one-line-summaries",
+     OptionValue::eTypeBoolean,
+     true,
+     true,
+     nullptr,
      {},
      "If true, LLDB will automatically display small structs in "
      "one-liner format (default: true)."},
-    {"auto-indent", OptionValue::eTypeBoolean, true, true, nullptr, {},
+    {"auto-indent",
+     OptionValue::eTypeBoolean,
+     true,
+     true,
+     nullptr,
+     {},
      "If true, LLDB will auto indent/outdent code. Currently only supported in "
      "the REPL (default: true)."},
-    {"print-decls", OptionValue::eTypeBoolean, true, true, nullptr, {},
+    {"print-decls",
+     OptionValue::eTypeBoolean,
+     true,
+     true,
+     nullptr,
+     {},
      "If true, LLDB will print the values of variables declared in an "
      "expression. Currently only supported in the REPL (default: true)."},
-    {"tab-size", OptionValue::eTypeUInt64, true, 4, nullptr, {},
+    {"tab-size",
+     OptionValue::eTypeUInt64,
+     true,
+     4,
+     nullptr,
+     {},
      "The tab size to use when indenting code in multi-line input mode "
      "(default: 4)."},
-    {"escape-non-printables", OptionValue::eTypeBoolean, true, true, nullptr,
+    {"escape-non-printables",
+     OptionValue::eTypeBoolean,
+     true,
+     true,
+     nullptr,
      {},
      "If true, LLDB will automatically escape non-printable and "
      "escape characters when formatting strings."},
-    {"frame-format-unique", OptionValue::eTypeFormatEntity, true, 0,
-     DEFAULT_FRAME_FORMAT_NO_ARGS, {},
+    {"frame-format-unique",
+     OptionValue::eTypeFormatEntity,
+     true,
+     0,
+     DEFAULT_FRAME_FORMAT_NO_ARGS,
+     {},
      "The default frame format string to use when displaying stack frame"
      "information for threads from thread backtrace unique."}};
 
@@ -317,7 +425,8 @@
                                   VarSetOperationType op,
                                   llvm::StringRef property_path,
                                   llvm::StringRef value) {
-  bool is_load_script = (property_path == "target.load-script-from-symbol-file");
+  bool is_load_script =
+      (property_path == "target.load-script-from-symbol-file");
   bool is_escape_non_printables = (property_path == "escape-non-printables");
   TargetSP target_sp;
   LoadScriptFromSymFile load_script_old_value;
@@ -710,8 +819,7 @@
   }
 }
 
-DebuggerSP
-Debugger::FindDebuggerWithInstanceName(ConstString instance_name) {
+DebuggerSP Debugger::FindDebuggerWithInstanceName(ConstString instance_name) {
   DebuggerSP debugger_sp;
   if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
     std::lock_guard<std::recursive_mutex> guard(*g_debugger_list_mutex_ptr);
@@ -1631,12 +1739,14 @@
                                          eBroadcastBitEventThreadIsListening);
 
     auto thread_name =
-        full_name.GetLength() < llvm::get_max_thread_name_length() ?
-        full_name.AsCString() : "dbg.evt-handler";
+        full_name.GetLength() < llvm::get_max_thread_name_length()
+            ? full_name.AsCString()
+            : "dbg.evt-handler";
 
     // Use larger 8MB stack for this thread
-    m_event_handler_thread = ThreadLauncher::LaunchThread(thread_name,
-        EventHandlerThread, this, nullptr, g_debugger_event_thread_stack_bytes);
+    m_event_handler_thread = ThreadLauncher::LaunchThread(
+        thread_name, EventHandlerThread, this, nullptr,
+        g_debugger_event_thread_stack_bytes);
 
     // Make sure DefaultEventHandler() is running and listening to events
     // before we return from this function. We are only listening for events of
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to