[Lldb-commits] [PATCH] D121078: Replace links to archived mailing lists by links to Discourse forums

2022-03-07 Thread Aaron Ballman via Phabricator via lldb-commits
aaron.ballman added a comment.

I think we need to retain *some* references to the existing mailing list 
archives. The migration to Discourse worked fairly well, but there were still 
data migration issues.  For example:

https://discourse.llvm.org/t/memory-barrier-problem/57493
https://lists.llvm.org/pipermail/llvm-dev/2021-January/148151.html

Also, the commits mailing lists are still hosted by mailman and remain relevant 
to the community for the foreseeable future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121078

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121078: Replace links to archived mailing lists by links to Discourse forums

2022-03-07 Thread Louis Dionne via Phabricator via lldb-commits
ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

Thanks for doing this! We need to fix a few undefined references, though.




Comment at: libcxx/docs/index.rst:223
 * `libcxx-commits Mailing List`_
 * `libcxx-dev Mailing List`_
 * `Browse libc++ Sources 
`_

I think this needs to be updated!



Comment at: libunwind/docs/index.rst:103
 * `cfe-commits Mailing List`_
 * `cfe-dev Mailing List`_
 * `Browse libunwind Sources 
`_

Probably this one too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121078

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121078: Replace links to archived mailing lists by links to Discourse forums

2022-03-07 Thread Danny Mösch via Phabricator via lldb-commits
SimplyDanny created this revision.
SimplyDanny added a reviewer: tonic.
Herald added subscribers: libcxx-commits, arphaman.
Herald added a reviewer: sscalpone.
Herald added projects: libunwind, Flang, All.
Herald added a reviewer: libunwind.
SimplyDanny requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, Sanitizers, 
jdoerfert.
Herald added projects: clang, Sanitizers, LLDB, libc++, LLVM, clang-tools-extra.
Herald added a reviewer: libc++.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121078

Files:
  clang-tools-extra/README.txt
  clang/README.txt
  clang/www/analyzer/menu.html.incl
  clang/www/demo/index.cgi
  clang/www/menu.html.incl
  compiler-rt/www/menu.html.incl
  flang/docs/GettingInvolved.md
  libcxx/docs/index.rst
  libunwind/docs/index.rst
  lldb/docs/index.rst
  llvm/docs/Contributing.rst
  llvm/docs/ExtendingLLVM.rst
  llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst

Index: llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst
===
--- llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst
+++ llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst
@@ -87,8 +87,8 @@
 Have fun - try doing something crazy and unusual. Building a language
 like everyone else always has, is much less fun than trying something a
 little crazy or off the wall and seeing how it turns out. If you get
-stuck or want to talk about it, feel free to email the `llvm-dev mailing
-list `_: it has lots
+stuck or want to talk about it, feel free to open a thread in the `LLVM
+forum `_: it has lots
 of people who are interested in languages and are often willing to help
 out.
 
@@ -166,9 +166,8 @@
 IR does not itself guarantee safety. The LLVM IR allows unsafe pointer
 casts, use after free bugs, buffer over-runs, and a variety of other
 problems. Safety needs to be implemented as a layer on top of LLVM and,
-conveniently, several groups have investigated this. Ask on the `llvm-dev
-mailing list `_ if
-you are interested in more details.
+conveniently, several groups have investigated this. Ask in the `LLVM
+forum `_ if you are interested in more details.
 
 Language-Specific Optimizations
 ---
Index: llvm/docs/ExtendingLLVM.rst
===
--- llvm/docs/ExtendingLLVM.rst
+++ llvm/docs/ExtendingLLVM.rst
@@ -14,8 +14,8 @@
 When you come to this realization, stop and think. Do you really need to extend
 LLVM? Is it a new fundamental capability that LLVM does not support at its
 current incarnation or can it be synthesized from already pre-existing LLVM
-elements? If you are not sure, ask on the `LLVM-dev
-`_ list. The reason is that
+elements? If you are not sure, ask in the `LLVM forum
+`_ list. The reason is that
 extending LLVM will get involved as you need to update all the different passes
 that you intend to use with your extension, and there are ``many`` LLVM analyses
 and transformations, so it may be quite a bit of work.
Index: llvm/docs/Contributing.rst
===
--- llvm/docs/Contributing.rst
+++ llvm/docs/Contributing.rst
@@ -147,7 +147,7 @@
 
   .. __: http://www.aosabook.org/en/llvm.html
 
-.. _Developer's List (llvm-dev): http://lists.llvm.org/mailman/listinfo/llvm-dev
+.. _Forum: https://discourse.llvm.org
 .. _irc.oftc.net: irc://irc.oftc.net/llvm
 .. _beginner: https://github.com/llvm/llvm-project/issues?q=is%3Aopen+is%3Aissue+label%3Abeginner
 .. _bug tracker: https://github.com/llvm/llvm-project/issues
@@ -155,4 +155,3 @@
 .. _git-clang-format: https://reviews.llvm.org/source/llvm-github/browse/main/clang/tools/clang-format/git-clang-format
 .. _LLVM's Phabricator: https://reviews.llvm.org/
 .. _LLVM's Open Projects page: https://llvm.org/OpenProjects.html#what
-.. _LLVM Developer's mailing list: http://lists.llvm.org/mailman/listinfo/llvm-dev
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -102,10 +102,10 @@
 
 See the :doc:`LLDB Build Page ` for build instructions.
 
-Discussions about LLDB should go to the `lldb-dev
-`__ mailing list. Commit
+Discussions about LLDB should go to the `LLDB forum
+`__. Commit
 messages are automatically sent to the `lldb-commits
-`__ mailing list , and
+`__ mailing list, and
 this is also the preferred mailing list for patch submissions.
 
 See the :doc:`Projects page

[Lldb-commits] [lldb] 080635e - [lldb] Add a setting to change the autosuggestion ANSI escape codes

2022-03-07 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-03-07T08:54:37-08:00
New Revision: 080635ef27914c3f0c20d221bc2f02ab6f13e6b4

URL: 
https://github.com/llvm/llvm-project/commit/080635ef27914c3f0c20d221bc2f02ab6f13e6b4
DIFF: 
https://github.com/llvm/llvm-project/commit/080635ef27914c3f0c20d221bc2f02ab6f13e6b4.diff

LOG: [lldb] Add a setting to change the autosuggestion ANSI escape codes

I'm a big fan of the autosuggestion feature but my terminal/color scheme
doesn't display faint any differently than regular lldb output, which
makes the feature a little confusing. This patch add a setting to change
the autosuggestion ANSI escape codes.

For example, to display the autosuggestion in italic, you can add this
to your ~/.lldbinit

  settings set show-autosuggestion-ansi-prefix ${ansi.italic}
  setting set show-autosuggestion-ansi-suffix ${ansi.normal}

Differential revision: https://reviews.llvm.org/D121064

Added: 


Modified: 
lldb/include/lldb/Core/Debugger.h
lldb/include/lldb/Host/Editline.h
lldb/source/Core/CoreProperties.td
lldb/source/Core/Debugger.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Host/common/Editline.cpp
lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py

Removed: 




diff  --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index d4fae0c5d09cb..d801e2d874df4 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -331,6 +331,10 @@ class Debugger : public 
std::enable_shared_from_this,
 
   bool GetUseAutosuggestion() const;
 
+  llvm::StringRef GetAutosuggestionAnsiPrefix() const;
+
+  llvm::StringRef GetAutosuggestionAnsiSuffix() const;
+
   bool GetUseSourceCache() const;
 
   bool SetUseSourceCache(bool use_source_cache);

diff  --git a/lldb/include/lldb/Host/Editline.h 
b/lldb/include/lldb/Host/Editline.h
index 876f6052311e9..14b6778d20764 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -210,6 +210,14 @@ class Editline {
 m_fix_indentation_callback_chars = indent_chars;
   }
 
+  void SetSuggestionAnsiPrefix(std::string prefix) {
+m_suggestion_ansi_prefix = std::move(prefix);
+  }
+
+  void SetSuggestionAnsiSuffix(std::string suffix) {
+m_suggestion_ansi_suffix = std::move(suffix);
+  }
+
   /// Prompts for and reads a single line of user input.
   bool GetLine(std::string &line, bool &interrupted);
 
@@ -388,9 +396,11 @@ class Editline {
   const char *m_fix_indentation_callback_chars = nullptr;
 
   CompleteCallbackType m_completion_callback;
-
   SuggestionCallbackType m_suggestion_callback;
 
+  std::string m_suggestion_ansi_prefix;
+  std::string m_suggestion_ansi_suffix;
+
   std::size_t m_previous_autosuggestion_size = 0;
   std::mutex m_output_mutex;
 };

diff  --git a/lldb/source/Core/CoreProperties.td 
b/lldb/source/Core/CoreProperties.td
index 399407075a7e0..1811f66efd0e2 100644
--- a/lldb/source/Core/CoreProperties.td
+++ b/lldb/source/Core/CoreProperties.td
@@ -163,4 +163,12 @@ let Definition = "debugger" in {
 Global,
 DefaultFalse,
 Desc<"If true, LLDB will show suggestions to complete the command the user 
typed. Suggestions may be accepted using Ctrl-F.">;
+  def ShowAutosuggestionAnsiPrefix: 
Property<"show-autosuggestion-ansi-prefix", "String">,
+Global,
+DefaultStringValue<"${ansi.faint}">,
+Desc<"When displaying suggestion in a color-enabled (i.e. ANSI) terminal, 
use the ANSI terminal code specified in this format immediately before the 
suggestion.">;
+  def ShowAutosuggestionAnsiSuffix: 
Property<"show-autosuggestion-ansi-suffix", "String">,
+Global,
+DefaultStringValue<"${ansi.normal}">,
+Desc<"When displaying suggestion in a color-enabled (i.e. ANSI) terminal, 
use the ANSI terminal code specified in this format immediately after the 
suggestion.">;
 }

diff  --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index ae4fb93e6d4af..eb0f6b5371d6b 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -384,6 +384,16 @@ bool Debugger::GetUseAutosuggestion() const {
   nullptr, idx, g_debugger_properties[idx].default_uint_value != 0);
 }
 
+llvm::StringRef Debugger::GetAutosuggestionAnsiPrefix() const {
+  const uint32_t idx = ePropertyShowAutosuggestionAnsiPrefix;
+  return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, "");
+}
+
+llvm::StringRef Debugger::GetAutosuggestionAnsiSuffix() const {
+  const uint32_t idx = ePropertyShowAutosuggestionAnsiSuffix;
+  return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, "");
+}
+
 bool Debugger::GetUseSourceCache() const {
   const uint32_t idx = ePropertyUseSourceCache;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(

diff  --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index c35b17990842f..179b60c3586e7 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lld

[Lldb-commits] [PATCH] D121064: [lldb] Add a setting to change the autosuggestion ANSI escape codes

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG080635ef2791: [lldb] Add a setting to change the 
autosuggestion ANSI escape codes (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121064

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Host/Editline.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Host/common/Editline.cpp
  lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py

Index: lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py
===
--- lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py
+++ lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py
@@ -16,6 +16,11 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
+ANSI_FAINT = "\x1b[2m"
+ANSI_RESET = "\x1b[0m"
+ANSI_RED = "\x1b[31m"
+ANSI_CYAN = "\x1b[36m"
+
 # PExpect uses many timeouts internally and doesn't play well
 # under ASAN on a loaded machine..
 @skipIfAsan
@@ -23,15 +28,12 @@
 def test_autosuggestion_add_spaces(self):
 self.launch(extra_args=["-o", "settings set show-autosuggestion true", "-o", "settings set use-color true"])
 
-# Common input codes and escape sequences.
-faint_color = "\x1b[2m"
-reset = "\x1b[0m"
 
 # Check if spaces are added to hide the previous gray characters.
 self.expect("help frame var")
 self.expect("help frame info")
 self.child.send("help frame v")
-self.child.expect_exact(cursor_horizontal_abs("(lldb) help frame ") + "v" + faint_color + "ar" + reset + " ")
+self.child.expect_exact(cursor_horizontal_abs("(lldb) help frame ") + "v" + self.ANSI_FAINT + "ar" + self.ANSI_RESET + " ")
 
 self.quit()
 
@@ -40,10 +42,8 @@
 def test_autosuggestion(self):
 self.launch(extra_args=["-o", "settings set show-autosuggestion true", "-o", "settings set use-color true"])
 
-# Common input codes and escape sequences.
+# Common input codes.
 ctrl_f = "\x06"
-faint_color = "\x1b[2m"
-reset = "\x1b[0m"
 delete = chr(127)
 
 frame_output_needle = "Syntax: frame "
@@ -52,7 +52,7 @@
 
 # Check that LLDB shows the autosuggestion in gray behind the text.
 self.child.send("hel")
-self.child.expect_exact(cursor_horizontal_abs("(lldb) he") + "l" + faint_color + "p frame" + reset)
+self.child.expect_exact(cursor_horizontal_abs("(lldb) he") + "l" + self.ANSI_FAINT + "p frame" + self.ANSI_RESET)
 
 # Apply the autosuggestion and press enter. This should print the
 # 'help frame' output if everything went correctly.
@@ -80,7 +80,7 @@
 # Check that autosuggestion complete to the most recent one.
 self.child.send("help frame variable\n")
 self.child.send("help fr")
-self.child.expect_exact(faint_color + "ame variable" + reset)
+self.child.expect_exact(self.ANSI_FAINT + "ame variable" + self.ANSI_RESET)
 self.child.send("\n")
 
 # Try another command.
@@ -90,7 +90,7 @@
 
 # Check that 'hel' should have an autosuggestion for 'help apropos' now.
 self.child.send("hel")
-self.child.expect_exact(cursor_horizontal_abs("(lldb) he") + "l" + faint_color + "p apropos" + reset)
+self.child.expect_exact(cursor_horizontal_abs("(lldb) he") + "l" + self.ANSI_FAINT + "p apropos" + self.ANSI_RESET)
 
 # Run the command and expect the 'help apropos' output.
 self.child.send(ctrl_f + "\n")
@@ -102,4 +102,19 @@
 self.child.expect_exact(breakpoint_output_needle)
 
 
+self.quit()
+
+@skipIfAsan
+@skipIfEditlineSupportMissing
+def test_autosuggestion_custom_ansi_prefix_suffix(self):
+self.launch(extra_args=["-o", "settings set show-autosuggestion true",
+"-o", "settings set use-color true",
+"-o", "settings set show-autosuggestion-ansi-prefix ${ansi.fg.red}",
+"-o", "setting set show-autosuggestion-ansi-suffix ${ansi.fg.cyan}"])
+
+self.child.send("help frame variable\n")
+self.child.send("help fr")
+self.child.expect_exact(self.ANSI_RED + "ame variable" + self.ANSI_CYAN)
+self.child.send("\n")
+
 self.quit()
Index: lldb/source/Host/common/Editline.cpp
===
--- lldb/source/Host/common/Editline.cpp
+++ lldb/source/Host/common/Editline.cpp
@@ -1080,8 +1080,13 @@
   llvm::StringRef line(line_info->buffer,
line_info->lastchar - line_info->buffer);
 
+  const char *ansi_

[Lldb-commits] [PATCH] D121131: [lldb] Support "bright" ANSI colors

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: teemperor, clayborg.
Herald added a project: All.
JDevlieghere requested review of this revision.
Herald added a project: LLDB.

Support ANSI escape codes for bright colors variants. Most modern terminals 
support them. Still LLDB is not using them by default and there's only there 
for people who want to modify their preferred ANSI prefix/suffix.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121131

Files:
  lldb/include/lldb/Utility/AnsiTerminal.h


Index: lldb/include/lldb/Utility/AnsiTerminal.h
===
--- lldb/include/lldb/Utility/AnsiTerminal.h
+++ lldb/include/lldb/Utility/AnsiTerminal.h
@@ -1,7 +1,3 @@
-#ifndef LLDB_UTILITY_ANSITERMINAL_H
-
-#define LLDB_UTILITY_ANSITERMINAL_H
-
 //===-AnsiTerminal.h *- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
@@ -10,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_UTILITY_ANSITERMINAL_H
+#define LLDB_UTILITY_ANSITERMINAL_H
+
 #define ANSI_FG_COLOR_BLACK 30
 #define ANSI_FG_COLOR_RED 31
 #define ANSI_FG_COLOR_GREEN 32
@@ -19,6 +18,15 @@
 #define ANSI_FG_COLOR_CYAN 36
 #define ANSI_FG_COLOR_WHITE 37
 
+#define ANSI_FG_COLOR_BRIGHT_BLACK 90
+#define ANSI_FG_COLOR_BRIGHT_RED 91
+#define ANSI_FG_COLOR_BRIGHT_GREEN 92
+#define ANSI_FG_COLOR_BRIGHT_YELLOW 93
+#define ANSI_FG_COLOR_BRIGHT_BLUE 94
+#define ANSI_FG_COLOR_BRIGHT_PURPLE 95
+#define ANSI_FG_COLOR_BRIGHT_CYAN 96
+#define ANSI_FG_COLOR_BRIGHT_WHITE 97
+
 #define ANSI_BG_COLOR_BLACK 40
 #define ANSI_BG_COLOR_RED 41
 #define ANSI_BG_COLOR_GREEN 42
@@ -28,6 +36,15 @@
 #define ANSI_BG_COLOR_CYAN 46
 #define ANSI_BG_COLOR_WHITE 47
 
+#define ANSI_BG_COLOR_BRIGHT_BLACK 100
+#define ANSI_BG_COLOR_BRIGHT_RED 101
+#define ANSI_BG_COLOR_BRIGHT_GREEN 102
+#define ANSI_BG_COLOR_BRIGHT_YELLOW 103
+#define ANSI_BG_COLOR_BRIGHT_BLUE 104
+#define ANSI_BG_COLOR_BRIGHT_PURPLE 105
+#define ANSI_BG_COLOR_BRIGHT_CYAN 106
+#define ANSI_BG_COLOR_BRIGHT_WHITE 107
+
 #define ANSI_SPECIAL_FRAMED 51
 #define ANSI_SPECIAL_ENCIRCLED 52
 
@@ -81,6 +98,14 @@
   {"fg.purple}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_PURPLE) 
ANSI_ESC_END},
   {"fg.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_CYAN) ANSI_ESC_END},
   {"fg.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_WHITE) ANSI_ESC_END},
+  {"fg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
+  {"fg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
+  {"fg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
+  {"fg.bright.yellow}", ANSI_ESC_START 
_TO_STR(ANSI_FG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
+  {"fg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLUE) 
ANSI_ESC_END},
+  {"fg.bright.purple}", ANSI_ESC_START 
_TO_STR(ANSI_FG_COLOR_BRIGHT_PURPLE) ANSI_ESC_END},
+  {"fg.bright.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_CYAN) 
ANSI_ESC_END},
+  {"fg.bright.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_WHITE) 
ANSI_ESC_END},
   {"bg.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLACK) ANSI_ESC_END},
   {"bg.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_RED) ANSI_ESC_END},
   {"bg.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_GREEN) ANSI_ESC_END},
@@ -89,6 +114,14 @@
   {"bg.purple}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_PURPLE) 
ANSI_ESC_END},
   {"bg.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_CYAN) ANSI_ESC_END},
   {"bg.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_WHITE) ANSI_ESC_END},
+  {"bg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
+  {"bg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
+  {"bg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
+  {"bg.bright.yellow}", ANSI_ESC_START 
_TO_STR(ANSI_BG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
+  {"bg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLUE) 
ANSI_ESC_END},
+  {"bg.bright.purple}", ANSI_ESC_START 
_TO_STR(ANSI_BG_COLOR_BRIGHT_PURPLE) ANSI_ESC_END},
+  {"bg.bright.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_CYAN) 
ANSI_ESC_END},
+  {"bg.bright.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_WHITE) 
ANSI_ESC_END},
   {"normal}", ANSI_ESC_START _TO_STR(ANSI_CTRL_NORMAL) ANSI_ESC_END},
   {"bold}", ANSI_ESC_START _TO_STR(ANSI_CTRL_BOLD) ANSI_ESC_END},
   {"faint}", ANSI_ESC_START _TO_STR(ANSI_CTRL_FAINT) ANSI_ESC_END},


Index: lldb/include/lldb/Utility/AnsiTerminal.h
===
--- lldb/include/lldb/Utility/AnsiTerminal.h
+++ lldb/include/lldb/Utility/AnsiTerminal.h
@@ -1,7 +1,3 @@
-#ifndef LLDB_UTILITY_ANSITERMINAL_

[Lldb-commits] [PATCH] D121064: [lldb] Add a setting to change the autosuggestion ANSI escape codes

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D121064#3362890 , @teemperor wrote:

> LGTM, thanks! FWIW, if you have `fish` installed you might wanna check what 
> they are doing on your terminal for its autosuggestions (and we might wanna 
> steal their default, even though I thought this was 'faint').

That's exactly what I did. Fish is using bright yellow, which is something we 
don't support yet, which is why I've put up https://reviews.llvm.org/D121131


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121064

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120690: [PDB] Add char8_t type

2022-03-07 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added inline comments.



Comment at: lldb/include/lldb/lldb-enumerations.h:752
   eBasicTypeChar32,
+  eBasicTypeChar8,
   eBasicTypeShort,

ljmf00 wrote:
> You forgot to add it to the Python API. It should also be added at the end to 
> avoid user-code breakage. See D116136 . I can rebase my change and correct 
> this :)
Thanks, it sounds good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120690

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121131: [lldb] Support "bright" ANSI colors

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Adding @aprantl as a reviewer because he also likes colors.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121131

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120755: Fix race condition when launching and attaching.This is a modified version of a previous patch that was reverted: https://reviews.llvm.org/D119797This version only wait

2022-03-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Greg, this is still causing the TestVSCode_attach.py test to fail on  
lldb-x86_64-debian  
(it would probably fail elsewhere as well, but the test is already disabled 
everywhere else). Judging by the error message (`attach failed (process exited 
during launch or attach)`), it definitely seems related to this patch. Can you 
do something about it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120755

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120755: Fix race condition when launching and attaching.This is a modified version of a previous patch that was reverted: https://reviews.llvm.org/D119797This version only wait

2022-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D120755#3364802 , @labath wrote:

> Greg, this is still causing the TestVSCode_attach.py test to fail on  
> lldb-x86_64-debian  
> (it would probably fail elsewhere as well, but the test is already disabled 
> everywhere else). Judging by the error message (`attach failed (process 
> exited during launch or attach)`), it definitely seems related to this patch. 
> Can you do something about it?

I will check into this, yes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120755

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] c41c574 - Fix buildbots after https://reviews.llvm.org/D120755.

2022-03-07 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2022-03-07T11:46:56-08:00
New Revision: c41c57468949036a06695f06a97a8e14e8b252bd

URL: 
https://github.com/llvm/llvm-project/commit/c41c57468949036a06695f06a97a8e14e8b252bd
DIFF: 
https://github.com/llvm/llvm-project/commit/c41c57468949036a06695f06a97a8e14e8b252bd.diff

LOG: Fix buildbots after https://reviews.llvm.org/D120755.

This improves this test a lot because before when using the "attachCommands" to 
run the following commands:

(lldb) target create -d /path/to/a.out
(lldb) process launch

This was racy as it wasn't stopping the program at the entry point, and the 
process might run to completion before we can even debug it. With the recent 
changes to the "attachCommands" we were waiting for the process to stop, but 
the process might be exited already, and that _should_ have caused the attach 
to fail since there was no process to attach to. By adding "--stop-at-entry" to 
the process launch, we ensure this should be less racy and give us a valid 
process to attach to.

Added: 


Modified: 
lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py 
b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
index 211d1f74ec439..1eee182916100 100644
--- a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
+++ b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
@@ -214,7 +214,7 @@ def test_terminate_commands(self):
 # and use it for debugging
 attachCommands = [
 'target create -d "%s"' % (program),
-'process launch'
+'process launch --stop-at-entry'
 ]
 terminateCommands = ['expr 4+2']
 self.attach(program=program,



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120755: Fix race condition when launching and attaching.This is a modified version of a previous patch that was reverted: https://reviews.llvm.org/D119797This version only wait

2022-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I think I found the root cause of the issue in linux and it might fix this test 
for many other platforms:

commit c41c57468949036a06695f06a97a8e14e8b252bd 
 (HEAD -> 
main)
Author: Greg Clayton 
Date:   Mon Mar 7 11:31:21 2022 -0800

  Fix buildbots after https://reviews.llvm.org/D120755.
  
  This improves this test a lot because before when using the "attachCommands" 
to run the following commands:
  
  (lldb) target create -d /path/to/a.out
  (lldb) process launch
  
  This was racy as it wasn't stopping the program at the entry point, and the 
process might run to completion before we can even debug it. With the recent 
changes to the "attachCommands" we were waiting for the process to stop, but 
the process might be exited already, and that _should_ have caused the attach 
to fail since there was no process to attach to. By adding "--stop-at-entry" to 
the process launch, we ensure this should be less racy and give us a valid 
process to attach to.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120755

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D119797: Fix race condition when launching and attaching.

2022-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.
Herald added a project: All.

Here is the diff that should fix things:

https://reviews.llvm.org/rGc41c57468949


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119797

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120755: Fix race condition when launching and attaching.This is a modified version of a previous patch that was reverted: https://reviews.llvm.org/D119797This version only wait

2022-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

https://reviews.llvm.org/rGc41c57468949


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120755

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121036: Fix target.save-jit-objects when the CWD is not writeable

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Interpreter/OptionValue.h:314
   void SetValueChangedCallback(std::function callback) {
-assert(!m_callback);
 m_callback = std::move(callback);

That's a weird assert



Comment at: lldb/source/Target/Target.cpp:4184
+  bool writable = llvm::sys::fs::can_write(path);
+  if (!exists || ! is_directory || !writable) {
+m_collection_sp->GetPropertyAtIndex(nullptr, true, idx)->GetValue()

You could save a level of indentation by turning this into a return.



Comment at: 
lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py:41
 self.assertEquals(self.countJITFiles(), 0,
-"No files emitted with save-jit-objects=false")
-
-self.runCmd("settings set target.save-jit-objects true")
+"No files emitted with save-jit-objects-dir empty")
+





Comment at: 
lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py:48
 self.assertNotEqual(jit_files_count, 0,
-"At least one file emitted with save-jit-objects=true")
+"At least one file emitted with save-jit-objects-dir 
set to the build dir")
 




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

https://reviews.llvm.org/D121036

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120755: Fix race condition when launching and attaching.This is a modified version of a previous patch that was reverted: https://reviews.llvm.org/D119797This version only wait

2022-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

The problem seemed to be we had a test case that was kind of bogus that was 
running attach commands with:

"target create ..." followed by "process launch". There was no synchronization 
before, but now that is. The problem is that the "process launch" was run, but 
the process could run to the exit stage before we synchronized with it. So it 
was correctly saying that the attach failed, because we weren't able to 
actually attach to the process as it had run to the exit point by the time we 
tried to attach. Fix this by adding "--stop-at-entry" to the "process launch" 
command which will ensure it does stop and it validly attached.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120755

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 0acc9e4 - [lldb] Support "bright" ANSI colors

2022-03-07 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-03-07T12:09:53-08:00
New Revision: 0acc9e4b5edd8b39ff3d4c6d0e17f02007671c4e

URL: 
https://github.com/llvm/llvm-project/commit/0acc9e4b5edd8b39ff3d4c6d0e17f02007671c4e
DIFF: 
https://github.com/llvm/llvm-project/commit/0acc9e4b5edd8b39ff3d4c6d0e17f02007671c4e.diff

LOG: [lldb] Support "bright" ANSI colors

Support ANSI escape codes for bright colors variants. Most modern
terminals support them. LLDB is not using them in any of its defaults,
but they're useful for people who want to modify their preferred ANSI
prefix/suffix.

Differential revision: https://reviews.llvm.org/D121131

Added: 


Modified: 
lldb/include/lldb/Utility/AnsiTerminal.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/AnsiTerminal.h 
b/lldb/include/lldb/Utility/AnsiTerminal.h
index c391adb2cf890..cc6765a605a2b 100644
--- a/lldb/include/lldb/Utility/AnsiTerminal.h
+++ b/lldb/include/lldb/Utility/AnsiTerminal.h
@@ -1,7 +1,3 @@
-#ifndef LLDB_UTILITY_ANSITERMINAL_H
-
-#define LLDB_UTILITY_ANSITERMINAL_H
-
 //===-AnsiTerminal.h *- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
@@ -10,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_UTILITY_ANSITERMINAL_H
+#define LLDB_UTILITY_ANSITERMINAL_H
+
 #define ANSI_FG_COLOR_BLACK 30
 #define ANSI_FG_COLOR_RED 31
 #define ANSI_FG_COLOR_GREEN 32
@@ -19,6 +18,15 @@
 #define ANSI_FG_COLOR_CYAN 36
 #define ANSI_FG_COLOR_WHITE 37
 
+#define ANSI_FG_COLOR_BRIGHT_BLACK 90
+#define ANSI_FG_COLOR_BRIGHT_RED 91
+#define ANSI_FG_COLOR_BRIGHT_GREEN 92
+#define ANSI_FG_COLOR_BRIGHT_YELLOW 93
+#define ANSI_FG_COLOR_BRIGHT_BLUE 94
+#define ANSI_FG_COLOR_BRIGHT_PURPLE 95
+#define ANSI_FG_COLOR_BRIGHT_CYAN 96
+#define ANSI_FG_COLOR_BRIGHT_WHITE 97
+
 #define ANSI_BG_COLOR_BLACK 40
 #define ANSI_BG_COLOR_RED 41
 #define ANSI_BG_COLOR_GREEN 42
@@ -28,6 +36,15 @@
 #define ANSI_BG_COLOR_CYAN 46
 #define ANSI_BG_COLOR_WHITE 47
 
+#define ANSI_BG_COLOR_BRIGHT_BLACK 100
+#define ANSI_BG_COLOR_BRIGHT_RED 101
+#define ANSI_BG_COLOR_BRIGHT_GREEN 102
+#define ANSI_BG_COLOR_BRIGHT_YELLOW 103
+#define ANSI_BG_COLOR_BRIGHT_BLUE 104
+#define ANSI_BG_COLOR_BRIGHT_PURPLE 105
+#define ANSI_BG_COLOR_BRIGHT_CYAN 106
+#define ANSI_BG_COLOR_BRIGHT_WHITE 107
+
 #define ANSI_SPECIAL_FRAMED 51
 #define ANSI_SPECIAL_ENCIRCLED 52
 
@@ -67,6 +84,7 @@ inline std::string FormatAnsiTerminalCodes(llvm::StringRef 
format,
bool do_color = true) {
   // Convert "${ansi.XXX}" tokens to ansi values or clear them if do_color is
   // false.
+  // clang-format off
   static const struct {
 const char *name;
 const char *value;
@@ -81,6 +99,14 @@ inline std::string FormatAnsiTerminalCodes(llvm::StringRef 
format,
   {"fg.purple}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_PURPLE) 
ANSI_ESC_END},
   {"fg.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_CYAN) ANSI_ESC_END},
   {"fg.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_WHITE) ANSI_ESC_END},
+  {"fg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
+  {"fg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
+  {"fg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
+  {"fg.bright.yellow}", ANSI_ESC_START 
_TO_STR(ANSI_FG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
+  {"fg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLUE) 
ANSI_ESC_END},
+  {"fg.bright.purple}", ANSI_ESC_START 
_TO_STR(ANSI_FG_COLOR_BRIGHT_PURPLE) ANSI_ESC_END},
+  {"fg.bright.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_CYAN) 
ANSI_ESC_END},
+  {"fg.bright.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_WHITE) 
ANSI_ESC_END},
   {"bg.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLACK) ANSI_ESC_END},
   {"bg.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_RED) ANSI_ESC_END},
   {"bg.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_GREEN) ANSI_ESC_END},
@@ -89,6 +115,14 @@ inline std::string FormatAnsiTerminalCodes(llvm::StringRef 
format,
   {"bg.purple}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_PURPLE) 
ANSI_ESC_END},
   {"bg.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_CYAN) ANSI_ESC_END},
   {"bg.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_WHITE) ANSI_ESC_END},
+  {"bg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
+  {"bg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
+  {"bg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
+  {"bg.bright.yellow}", ANSI_ESC_START 
_TO_STR(ANSI_BG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
+  {"bg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLUE) 
ANSI_ESC_END},
+

[Lldb-commits] [PATCH] D121131: [lldb] Support "bright" ANSI colors

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0acc9e4b5edd: [lldb] Support "bright" ANSI colors 
(authored by JDevlieghere).

Changed prior to commit:
  https://reviews.llvm.org/D121131?vs=413511&id=413585#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121131

Files:
  lldb/include/lldb/Utility/AnsiTerminal.h


Index: lldb/include/lldb/Utility/AnsiTerminal.h
===
--- lldb/include/lldb/Utility/AnsiTerminal.h
+++ lldb/include/lldb/Utility/AnsiTerminal.h
@@ -1,7 +1,3 @@
-#ifndef LLDB_UTILITY_ANSITERMINAL_H
-
-#define LLDB_UTILITY_ANSITERMINAL_H
-
 //===-AnsiTerminal.h *- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
@@ -10,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_UTILITY_ANSITERMINAL_H
+#define LLDB_UTILITY_ANSITERMINAL_H
+
 #define ANSI_FG_COLOR_BLACK 30
 #define ANSI_FG_COLOR_RED 31
 #define ANSI_FG_COLOR_GREEN 32
@@ -19,6 +18,15 @@
 #define ANSI_FG_COLOR_CYAN 36
 #define ANSI_FG_COLOR_WHITE 37
 
+#define ANSI_FG_COLOR_BRIGHT_BLACK 90
+#define ANSI_FG_COLOR_BRIGHT_RED 91
+#define ANSI_FG_COLOR_BRIGHT_GREEN 92
+#define ANSI_FG_COLOR_BRIGHT_YELLOW 93
+#define ANSI_FG_COLOR_BRIGHT_BLUE 94
+#define ANSI_FG_COLOR_BRIGHT_PURPLE 95
+#define ANSI_FG_COLOR_BRIGHT_CYAN 96
+#define ANSI_FG_COLOR_BRIGHT_WHITE 97
+
 #define ANSI_BG_COLOR_BLACK 40
 #define ANSI_BG_COLOR_RED 41
 #define ANSI_BG_COLOR_GREEN 42
@@ -28,6 +36,15 @@
 #define ANSI_BG_COLOR_CYAN 46
 #define ANSI_BG_COLOR_WHITE 47
 
+#define ANSI_BG_COLOR_BRIGHT_BLACK 100
+#define ANSI_BG_COLOR_BRIGHT_RED 101
+#define ANSI_BG_COLOR_BRIGHT_GREEN 102
+#define ANSI_BG_COLOR_BRIGHT_YELLOW 103
+#define ANSI_BG_COLOR_BRIGHT_BLUE 104
+#define ANSI_BG_COLOR_BRIGHT_PURPLE 105
+#define ANSI_BG_COLOR_BRIGHT_CYAN 106
+#define ANSI_BG_COLOR_BRIGHT_WHITE 107
+
 #define ANSI_SPECIAL_FRAMED 51
 #define ANSI_SPECIAL_ENCIRCLED 52
 
@@ -67,6 +84,7 @@
bool do_color = true) {
   // Convert "${ansi.XXX}" tokens to ansi values or clear them if do_color is
   // false.
+  // clang-format off
   static const struct {
 const char *name;
 const char *value;
@@ -81,6 +99,14 @@
   {"fg.purple}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_PURPLE) 
ANSI_ESC_END},
   {"fg.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_CYAN) ANSI_ESC_END},
   {"fg.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_WHITE) ANSI_ESC_END},
+  {"fg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
+  {"fg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
+  {"fg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
+  {"fg.bright.yellow}", ANSI_ESC_START 
_TO_STR(ANSI_FG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
+  {"fg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLUE) 
ANSI_ESC_END},
+  {"fg.bright.purple}", ANSI_ESC_START 
_TO_STR(ANSI_FG_COLOR_BRIGHT_PURPLE) ANSI_ESC_END},
+  {"fg.bright.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_CYAN) 
ANSI_ESC_END},
+  {"fg.bright.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_WHITE) 
ANSI_ESC_END},
   {"bg.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLACK) ANSI_ESC_END},
   {"bg.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_RED) ANSI_ESC_END},
   {"bg.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_GREEN) ANSI_ESC_END},
@@ -89,6 +115,14 @@
   {"bg.purple}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_PURPLE) 
ANSI_ESC_END},
   {"bg.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_CYAN) ANSI_ESC_END},
   {"bg.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_WHITE) ANSI_ESC_END},
+  {"bg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
+  {"bg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
+  {"bg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
+  {"bg.bright.yellow}", ANSI_ESC_START 
_TO_STR(ANSI_BG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
+  {"bg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLUE) 
ANSI_ESC_END},
+  {"bg.bright.purple}", ANSI_ESC_START 
_TO_STR(ANSI_BG_COLOR_BRIGHT_PURPLE) ANSI_ESC_END},
+  {"bg.bright.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_CYAN) 
ANSI_ESC_END},
+  {"bg.bright.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_WHITE) 
ANSI_ESC_END},
   {"normal}", ANSI_ESC_START _TO_STR(ANSI_CTRL_NORMAL) ANSI_ESC_END},
   {"bold}", ANSI_ESC_START _TO_STR(ANSI_CTRL_BOLD) ANSI_ESC_END},
   {"faint}", ANSI_ESC_START _TO_STR(ANSI_CTRL_FAINT) ANSI_ESC_END},
@@ -106,6 +140,7 @@
 #undef _TO_STR
 #undef _TO_STR2
   };
+  // clang-format o

[Lldb-commits] [lldb] 4b093cd - [lldb] Format g_color_tokens as a table (NFC)

2022-03-07 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-03-07T12:13:38-08:00
New Revision: 4b093cdc2886654d8a4fc308dfbb64644e137d2e

URL: 
https://github.com/llvm/llvm-project/commit/4b093cdc2886654d8a4fc308dfbb64644e137d2e
DIFF: 
https://github.com/llvm/llvm-project/commit/4b093cdc2886654d8a4fc308dfbb64644e137d2e.diff

LOG: [lldb] Format g_color_tokens as a table (NFC)

This makes editing the table easier and mistakes more obvious.

Added: 


Modified: 
lldb/include/lldb/Utility/AnsiTerminal.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/AnsiTerminal.h 
b/lldb/include/lldb/Utility/AnsiTerminal.h
index cc6765a605a2b..caad566715378 100644
--- a/lldb/include/lldb/Utility/AnsiTerminal.h
+++ b/lldb/include/lldb/Utility/AnsiTerminal.h
@@ -91,52 +91,48 @@ inline std::string FormatAnsiTerminalCodes(llvm::StringRef 
format,
   } g_color_tokens[] = {
 #define _TO_STR2(_val) #_val
 #define _TO_STR(_val) _TO_STR2(_val)
-  {"fg.black}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BLACK) ANSI_ESC_END},
-  {"fg.red}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_RED) ANSI_ESC_END},
-  {"fg.green}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_GREEN) ANSI_ESC_END},
-  {"fg.yellow}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_YELLOW) 
ANSI_ESC_END},
-  {"fg.blue}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BLUE) ANSI_ESC_END},
-  {"fg.purple}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_PURPLE) 
ANSI_ESC_END},
-  {"fg.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_CYAN) ANSI_ESC_END},
-  {"fg.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_WHITE) ANSI_ESC_END},
-  {"fg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
-  {"fg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
-  {"fg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
+  {"fg.black}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BLACK) 
ANSI_ESC_END},
+  {"fg.red}",   ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_RED) 
ANSI_ESC_END},
+  {"fg.green}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_GREEN) 
ANSI_ESC_END},
+  {"fg.yellow}",ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_YELLOW) 
ANSI_ESC_END},
+  {"fg.blue}",  ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BLUE) 
ANSI_ESC_END},
+  {"fg.purple}",ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_PURPLE) 
ANSI_ESC_END},
+  {"fg.cyan}",  ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_CYAN) 
ANSI_ESC_END},
+  {"fg.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_WHITE) 
ANSI_ESC_END},
+  {"fg.bright.black}",  ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
+  {"fg.bright.red}",ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
+  {"fg.bright.green}",  ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
   {"fg.bright.yellow}", ANSI_ESC_START 
_TO_STR(ANSI_FG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
-  {"fg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLUE) 
ANSI_ESC_END},
+  {"fg.bright.blue}",   ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLUE) 
ANSI_ESC_END},
   {"fg.bright.purple}", ANSI_ESC_START 
_TO_STR(ANSI_FG_COLOR_BRIGHT_PURPLE) ANSI_ESC_END},
-  {"fg.bright.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_CYAN) 
ANSI_ESC_END},
-  {"fg.bright.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_WHITE) 
ANSI_ESC_END},
-  {"bg.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLACK) ANSI_ESC_END},
-  {"bg.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_RED) ANSI_ESC_END},
-  {"bg.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_GREEN) ANSI_ESC_END},
-  {"bg.yellow}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_YELLOW) 
ANSI_ESC_END},
-  {"bg.blue}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLUE) ANSI_ESC_END},
-  {"bg.purple}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_PURPLE) 
ANSI_ESC_END},
-  {"bg.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_CYAN) ANSI_ESC_END},
-  {"bg.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_WHITE) ANSI_ESC_END},
-  {"bg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLACK) 
ANSI_ESC_END},
-  {"bg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_RED) 
ANSI_ESC_END},
-  {"bg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_GREEN) 
ANSI_ESC_END},
+  {"fg.bright.cyan}",   ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_CYAN) 
ANSI_ESC_END},
+  {"fg.bright.white}",  ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_WHITE) 
ANSI_ESC_END},
+  {"bg.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLACK) 
ANSI_ESC_END},
+  {"bg.red}",   ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_RED) 
ANSI_ESC_END},
+  {"bg.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_GREEN) 
ANSI_ESC_END},
+  {"bg.yellow}",ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_YELLOW) 
ANSI_ESC_END},
+  {"bg.blue}",  ANSI_ESC_START

[Lldb-commits] [PATCH] D121155: [lldb] Add --exists flag to `settings set`

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, jasonmolenda, mib.
Herald added a subscriber: dang.
Herald added a project: All.
JDevlieghere requested review of this revision.

Add a --exists/-e flag to `settings set` that sets the setting if it
exists, but doesn't print another error otherwise. This is useful when
setting options in your ~/.lldbinit that might not exist in older
versions of lldb.


https://reviews.llvm.org/D121155

Files:
  lldb/source/Commands/CommandObjectSettings.cpp
  lldb/source/Commands/Options.td
  lldb/test/API/commands/settings/TestSettings.py


Index: lldb/test/API/commands/settings/TestSettings.py
===
--- lldb/test/API/commands/settings/TestSettings.py
+++ lldb/test/API/commands/settings/TestSettings.py
@@ -779,3 +779,13 @@
 # finally, confirm that trying to set a setting that does not exist 
still fails.
 # (SHOWING a setting that does not exist does not currently yield an 
error.)
 self.expect('settings set target.setting-which-does-not-exist true', 
error=True)
+
+def test_settings_set_exists(self):
+cmdinterp = self.dbg.GetCommandInterpreter()
+
+# An unknown option should succeed.
+self.expect('settings set -e foo bar')
+self.expect('settings set --exists foo bar')
+
+# A known option should fail if its argument is invalid.
+self.expect("settings set auto-confirm bogus", error=True)
Index: lldb/source/Commands/Options.td
===
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -22,6 +22,8 @@
 Desc<"Apply the new value to the global default value.">;
   def setset_force : Option<"force", "f">,
 Desc<"Force an empty value to be accepted as the default.">;
+  def setset_exists : Option<"exists", "e">,
+Desc<"Only set the setting if it exists. Don't print an error otherwise.">;
 }
 
 let Command = "settings write" in {
Index: lldb/source/Commands/CommandObjectSettings.cpp
===
--- lldb/source/Commands/CommandObjectSettings.cpp
+++ lldb/source/Commands/CommandObjectSettings.cpp
@@ -102,6 +102,9 @@
   case 'g':
 m_global = true;
 break;
+  case 'e':
+m_exists = true;
+break;
   default:
 llvm_unreachable("Unimplemented option");
   }
@@ -112,6 +115,7 @@
 void OptionParsingStarting(ExecutionContext *execution_context) override {
   m_global = false;
   m_force = false;
+  m_exists = false;
 }
 
 llvm::ArrayRef GetDefinitions() override {
@@ -120,7 +124,8 @@
 
 // Instance variables to hold the values for command options.
 bool m_global = false;
-bool m_force;
+bool m_force = false;
+bool m_exists = false;
   };
 
   void
@@ -219,13 +224,12 @@
  var_name, var_value);
 }
 
-if (error.Fail()) {
+if (error.Fail() && !m_options.m_exists) {
   result.AppendError(error.AsCString());
   return false;
-} else {
-  result.SetStatus(eReturnStatusSuccessFinishResult);
 }
 
+result.SetStatus(eReturnStatusSuccessFinishResult);
 return result.Succeeded();
   }
 


Index: lldb/test/API/commands/settings/TestSettings.py
===
--- lldb/test/API/commands/settings/TestSettings.py
+++ lldb/test/API/commands/settings/TestSettings.py
@@ -779,3 +779,13 @@
 # finally, confirm that trying to set a setting that does not exist still fails.
 # (SHOWING a setting that does not exist does not currently yield an error.)
 self.expect('settings set target.setting-which-does-not-exist true', error=True)
+
+def test_settings_set_exists(self):
+cmdinterp = self.dbg.GetCommandInterpreter()
+
+# An unknown option should succeed.
+self.expect('settings set -e foo bar')
+self.expect('settings set --exists foo bar')
+
+# A known option should fail if its argument is invalid.
+self.expect("settings set auto-confirm bogus", error=True)
Index: lldb/source/Commands/Options.td
===
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -22,6 +22,8 @@
 Desc<"Apply the new value to the global default value.">;
   def setset_force : Option<"force", "f">,
 Desc<"Force an empty value to be accepted as the default.">;
+  def setset_exists : Option<"exists", "e">,
+Desc<"Only set the setting if it exists. Don't print an error otherwise.">;
 }
 
 let Command = "settings write" in {
Index: lldb/source/Commands/CommandObjectSettings.cpp
===
--- lldb/source/Commands/CommandObjectSettings.cpp
+++ lldb/source/Commands/CommandObjectSettings.cpp

[Lldb-commits] [PATCH] D121161: [lldb] Avoid global constructor in LLDBLog.cpp

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: labath.
Herald added a project: All.
JDevlieghere requested review of this revision.

Avoid a static initializer for Log::Channel in LLDBLog.cpp


https://reviews.llvm.org/D121161

Files:
  lldb/source/Utility/LLDBLog.cpp


Index: lldb/source/Utility/LLDBLog.cpp
===
--- lldb/source/Utility/LLDBLog.cpp
+++ lldb/source/Utility/LLDBLog.cpp
@@ -62,18 +62,16 @@
 {{"watch"}, {"log watchpoint related activities"}, LLDBLog::Watchpoints},
 };
 
-static Log::Channel g_log_channel(g_categories,
-  LLDBLog::Process | LLDBLog::Thread |
-  LLDBLog::DynamicLoader |
-  LLDBLog::Breakpoints |
-  LLDBLog::Watchpoints | LLDBLog::Step |
-  LLDBLog::State | LLDBLog::Symbols |
-  LLDBLog::Target | LLDBLog::Commands);
 
 template <> Log::Channel &lldb_private::LogChannelFor() {
+  static Log::Channel g_log_channel(
+  g_categories, LLDBLog::Process | LLDBLog::Thread |
+LLDBLog::DynamicLoader | LLDBLog::Breakpoints |
+LLDBLog::Watchpoints | LLDBLog::Step | LLDBLog::State |
+LLDBLog::Symbols | LLDBLog::Target | 
LLDBLog::Commands);
   return g_log_channel;
 }
 
 void lldb_private::InitializeLldbChannel() {
-  Log::Register("lldb", g_log_channel);
+  Log::Register("lldb", lldb_private::LogChannelFor());
 }


Index: lldb/source/Utility/LLDBLog.cpp
===
--- lldb/source/Utility/LLDBLog.cpp
+++ lldb/source/Utility/LLDBLog.cpp
@@ -62,18 +62,16 @@
 {{"watch"}, {"log watchpoint related activities"}, LLDBLog::Watchpoints},
 };
 
-static Log::Channel g_log_channel(g_categories,
-  LLDBLog::Process | LLDBLog::Thread |
-  LLDBLog::DynamicLoader |
-  LLDBLog::Breakpoints |
-  LLDBLog::Watchpoints | LLDBLog::Step |
-  LLDBLog::State | LLDBLog::Symbols |
-  LLDBLog::Target | LLDBLog::Commands);
 
 template <> Log::Channel &lldb_private::LogChannelFor() {
+  static Log::Channel g_log_channel(
+  g_categories, LLDBLog::Process | LLDBLog::Thread |
+LLDBLog::DynamicLoader | LLDBLog::Breakpoints |
+LLDBLog::Watchpoints | LLDBLog::Step | LLDBLog::State |
+LLDBLog::Symbols | LLDBLog::Target | LLDBLog::Commands);
   return g_log_channel;
 }
 
 void lldb_private::InitializeLldbChannel() {
-  Log::Register("lldb", g_log_channel);
+  Log::Register("lldb", lldb_private::LogChannelFor());
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121078: Replace links to archived mailing lists by links to Discourse forums

2022-03-07 Thread Tanya Lattner via Phabricator via lldb-commits
tonic requested changes to this revision.
tonic added a comment.

Thank you so much for doing this! I have added some comments inline that I 
would like changed.




Comment at: clang/README.txt:22
 If you have questions or comments about Clang, a great place to discuss them is
-on the Clang development mailing list:
-  http://lists.llvm.org/mailman/listinfo/cfe-dev
+in the Clang forum:
+  https://discourse.llvm.org/c/clang/

Should this be "on" the Clang forum? Versus in. 



Comment at: clang/www/analyzer/menu.html.incl:37
   
-http://lists.llvm.org/mailman/listinfo/cfe-dev";>cfe-dev
 http://lists.llvm.org/mailman/listinfo/cfe-commits";>cfe-commits

We should retain a link to the forums here. I would change the heading to 
Mailing List & Forums and then add the link here too. 



Comment at: clang/www/demo/index.cgi:23
 my $MAILADDR= 'sa...@nondot.org';
-my $CONTACT_ADDRESS = 'Questions or comments?  Email the http://lists.llvm.org/mailman/listinfo/llvm-dev";>LLVM-dev mailing 
list.';
+my $CONTACT_ADDRESS = 'Questions or comments?  Discuss in the https://discourse.llvm.org";>LLVM forum.';
 my $LOGO_IMAGE_URL  = 'cathead.png';

I would change to "on" the forums.



Comment at: flang/docs/GettingInvolved.md:23-24
 
-  This list is for people who want to be included in technical discussions 
related to Flang. People post to this list when they have questions about 
writing code
+  This forum is for people who want to be included in technical discussions 
related to Flang. People post in this forum when they have questions about 
writing code
   for or using the Flang tools. It is relatively low volume.
 

This is worded like it is a mailing list. I would reword to something like 
"Flang forums are for technical discussions, questions about writing code for, 
or using Flang tools."



Comment at: flang/docs/GettingInvolved.md:52
 If you can not access the Google Doc, please send an email to Alexis 
Perry-Holby at ape...@lanl.gov requesting to be added to the access list.
--   Minutes from older meetings were sent to 
[flang-dev](http://lists.llvm.org/mailman/listinfo/flang-dev). Search for 
`Flang Biweekly Sync - Notes`.
+-   Minutes from older meetings were posted in the [Flang 
forum](https://discourse.llvm.org/c/subprojects/flang). Search for `Flang 
Biweekly Sync - Notes`.
 

I would say "on" the Flang forum.

As a side note, all the old meeting minutes should be moved to this category. I 
can add it to my TODO list. 



Comment at: llvm/docs/ExtendingLLVM.rst:17-18
 current incarnation or can it be synthesized from already pre-existing LLVM
-elements? If you are not sure, ask on the `LLVM-dev
-`_ list. The reason is that
+elements? If you are not sure, ask in the `LLVM forum
+`_ list. The reason is that
 extending LLVM will get involved as you need to update all the different passes

"on" the forums. Sorry, just my preference :)



Comment at: llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst:90-91
 little crazy or off the wall and seeing how it turns out. If you get
-stuck or want to talk about it, feel free to email the `llvm-dev mailing
-list `_: it has lots
+stuck or want to talk about it, feel free to open a thread in the `LLVM
+forum `_: it has lots
 of people who are interested in languages and are often willing to help

Discourse uses a little different terminology. I would change this to "please 
post on the LLVM forums"



Comment at: llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst:169
 problems. Safety needs to be implemented as a layer on top of LLVM and,
-conveniently, several groups have investigated this. Ask on the `llvm-dev
-mailing list `_ if
-you are interested in more details.
+conveniently, several groups have investigated this. Ask in the `LLVM
+forum `_ if you are interested in more details.

Ask "on"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121078

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121078: Replace links to archived mailing lists by links to Discourse forums

2022-03-07 Thread Danny Mösch via Phabricator via lldb-commits
SimplyDanny updated this revision to Diff 413630.
SimplyDanny marked 9 inline comments as done.
SimplyDanny added a comment.

Updated revision according to review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121078

Files:
  clang-tools-extra/README.txt
  clang/README.txt
  clang/www/analyzer/menu.html.incl
  clang/www/demo/index.cgi
  clang/www/menu.html.incl
  compiler-rt/www/menu.html.incl
  flang/docs/GettingInvolved.md
  libcxx/docs/index.rst
  libunwind/docs/index.rst
  lldb/docs/index.rst
  llvm/docs/Contributing.rst
  llvm/docs/ExtendingLLVM.rst
  llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst

Index: llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst
===
--- llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst
+++ llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst
@@ -87,10 +87,9 @@
 Have fun - try doing something crazy and unusual. Building a language
 like everyone else always has, is much less fun than trying something a
 little crazy or off the wall and seeing how it turns out. If you get
-stuck or want to talk about it, feel free to email the `llvm-dev mailing
-list `_: it has lots
-of people who are interested in languages and are often willing to help
-out.
+stuck or want to talk about it, please post on the `LLVM forums 
+`_: it has lots of people who are interested
+in languages and are often willing to help out.
 
 Before we end this tutorial, I want to talk about some "tips and tricks"
 for generating LLVM IR. These are some of the more subtle things that
@@ -166,9 +165,8 @@
 IR does not itself guarantee safety. The LLVM IR allows unsafe pointer
 casts, use after free bugs, buffer over-runs, and a variety of other
 problems. Safety needs to be implemented as a layer on top of LLVM and,
-conveniently, several groups have investigated this. Ask on the `llvm-dev
-mailing list `_ if
-you are interested in more details.
+conveniently, several groups have investigated this. Ask on the `LLVM
+forums `_ if you are interested in more details.
 
 Language-Specific Optimizations
 ---
Index: llvm/docs/ExtendingLLVM.rst
===
--- llvm/docs/ExtendingLLVM.rst
+++ llvm/docs/ExtendingLLVM.rst
@@ -14,8 +14,8 @@
 When you come to this realization, stop and think. Do you really need to extend
 LLVM? Is it a new fundamental capability that LLVM does not support at its
 current incarnation or can it be synthesized from already pre-existing LLVM
-elements? If you are not sure, ask on the `LLVM-dev
-`_ list. The reason is that
+elements? If you are not sure, ask on the `LLVM forums
+`_. The reason is that
 extending LLVM will get involved as you need to update all the different passes
 that you intend to use with your extension, and there are ``many`` LLVM analyses
 and transformations, so it may be quite a bit of work.
Index: llvm/docs/Contributing.rst
===
--- llvm/docs/Contributing.rst
+++ llvm/docs/Contributing.rst
@@ -147,7 +147,7 @@
 
   .. __: http://www.aosabook.org/en/llvm.html
 
-.. _Developer's List (llvm-dev): http://lists.llvm.org/mailman/listinfo/llvm-dev
+.. _Forum: https://discourse.llvm.org
 .. _irc.oftc.net: irc://irc.oftc.net/llvm
 .. _beginner: https://github.com/llvm/llvm-project/issues?q=is%3Aopen+is%3Aissue+label%3Abeginner
 .. _bug tracker: https://github.com/llvm/llvm-project/issues
@@ -155,4 +155,3 @@
 .. _git-clang-format: https://reviews.llvm.org/source/llvm-github/browse/main/clang/tools/clang-format/git-clang-format
 .. _LLVM's Phabricator: https://reviews.llvm.org/
 .. _LLVM's Open Projects page: https://llvm.org/OpenProjects.html#what
-.. _LLVM Developer's mailing list: http://lists.llvm.org/mailman/listinfo/llvm-dev
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -102,10 +102,10 @@
 
 See the :doc:`LLDB Build Page ` for build instructions.
 
-Discussions about LLDB should go to the `lldb-dev
-`__ mailing list. Commit
+Discussions about LLDB should go to the `LLDB forum
+`__. Commit
 messages are automatically sent to the `lldb-commits
-`__ mailing list , and
+`__ mailing list, and
 this is also the preferred mailing list for patch submissions.
 
 See the :doc:`Projects page ` if you are looking for some
Index: libunwi

[Lldb-commits] [PATCH] D121078: Replace links to archived mailing lists by links to Discourse forums

2022-03-07 Thread Danny Mösch via Phabricator via lldb-commits
SimplyDanny added inline comments.



Comment at: clang/README.txt:22
 If you have questions or comments about Clang, a great place to discuss them is
-on the Clang development mailing list:
-  http://lists.llvm.org/mailman/listinfo/cfe-dev
+in the Clang forum:
+  https://discourse.llvm.org/c/clang/

tonic wrote:
> Should this be "on" the Clang forum? Versus in. 
You tell me. 😉 I'm not a native speaker.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121078

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120755: Fix race condition when launching and attaching.This is a modified version of a previous patch that was reverted: https://reviews.llvm.org/D119797This version only wait

2022-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I verified that my linux server was failing the attach in the same way and it 
is now fixed with the Buildbot patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120755

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120972: [lldb] Show progress events in the command line driver

2022-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/source/Core/CoreProperties.td:137
+DefaultTrue,
+Desc<"Whether to show progress or not.">;
   def UseSourceCache: Property<"use-source-cache", "Boolean">,

Might be nice to clarify that this is for the CLI only? 

Also, if this _is_ for the CLI only, the setting should probably be put into 
the "interpreter" settings as "interpreter.show-progress".





Comment at: lldb/source/Core/Debugger.cpp:1756-1757
+  // can change between iterations so check it inside the loop.
+  if (!GetShowProgress())
+return;
+

Move this to the top of the function so we don't do any work extracting 
anything from the event if it is disabled? Or is this code trying to limit the 
updates of a progress that reports many status updates for the same progress?



Comment at: lldb/source/Core/Debugger.cpp:1763
+  File &output = GetOutputFile();
+  if (!output.GetIsInteractive() || !output.GetIsTerminalWithColors())
+return;

If not interactive should we just dump the start and end progress events on a 
separate line?



Comment at: lldb/source/Core/Debugger.cpp:1768
+// Clear the current line.
+output.Printf("\33[2K\r");
+return;

Do we want some sort of format string here that the user could modify as a 
setting? The idea would be there might be extra settings that the user could 
set like:

(lldb) setting set interpreter.progress-clear-line-format "${ansi}"

and it could default to the above string. Not required, just thinking out loud 
here as I am reading the patch



Comment at: lldb/source/Core/Debugger.cpp:1778-1779
+  if (data->GetTotal() != UINT64_MAX) {
+output.Printf("[%llu/%llu] %s...", data->GetCompleted(), data->GetTotal(),
+  message.c_str());
+  } else {

If we did a format string for each message we could have something like:

"{${progress.is_start}...}{${progress.is_update}...}{${progress.is_end}...}"

where the "progress.is_start" variable would be true for the first progress 
event, "progress.is_update" would be true for any updates, and 
"progress.is_end" would be true if the progress is completed. This would allow 
people to customize how progress events get handled and printed. If someone 
just wants a start and end progress, then they can fill in the "..." after the 
"progress.is_start" and "progress.is_end". If they don't want updates, they can 
leave out the "{${progress.is_update}...}" section. It also would allow ansi 
colors to be used since we already support these. And this would allow non 
interactive sessions to still show progress if they want to (right now if it 
isn't interactive, it doesn't get shown).


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

https://reviews.llvm.org/D120972

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121036: Fix target.save-jit-objects when the CWD is not writeable

2022-03-07 Thread Jim Ingham via Phabricator via lldb-commits
jingham updated this revision to Diff 413648.
jingham added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121036

Files:
  lldb/include/lldb/Interpreter/OptionValue.h
  lldb/include/lldb/Target/Target.h
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/TargetProperties.td
  lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py

Index: lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py
===
--- lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py
+++ lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py
@@ -38,14 +38,14 @@
 self.cleanJITFiles()
 frame.EvaluateExpression("(void*)malloc(0x1)")
 self.assertEquals(self.countJITFiles(), 0,
-"No files emitted with save-jit-objects=false")
-
-self.runCmd("settings set target.save-jit-objects true")
+  "No files emitted with save-jit-objects-dir empty")
+
+self.runCmd("settings set target.save-jit-objects-dir {0}".format(self.getBuildDir()))
 frame.EvaluateExpression("(void*)malloc(0x1)")
 jit_files_count = self.countJITFiles()
 self.cleanJITFiles()
 self.assertNotEqual(jit_files_count, 0,
-"At least one file emitted with save-jit-objects=true")
+"At least one file emitted with save-jit-objects-dir set to the build dir")
 
 process.Kill()
 os.chdir(self.getSourceDir())
Index: lldb/source/Target/TargetProperties.td
===
--- lldb/source/Target/TargetProperties.td
+++ lldb/source/Target/TargetProperties.td
@@ -63,9 +63,9 @@
   def NotifyAboutFixIts: Property<"notify-about-fixits", "Boolean">,
 DefaultTrue,
 Desc<"Print the fixed expression text.">;
-  def SaveObjects: Property<"save-jit-objects", "Boolean">,
-DefaultFalse,
-Desc<"Save intermediate object files generated by the LLVM JIT">;
+  def SaveObjectsDir: Property<"save-jit-objects-dir", "FileSpec">,
+DefaultStringValue<"">,
+Desc<"If specified, the directory to save intermediate object files generated by the LLVM JIT">;
   def MaxZeroPaddingInFloatFormat: Property<"max-zero-padding-in-float-format", "UInt64">,
 DefaultUnsignedValue<6>,
 Desc<"The maximum number of zeroes to insert when displaying a very small float before falling back to scientific notation.">;
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -3814,6 +3814,8 @@
 m_collection_sp->SetValueChangedCallback(
 ePropertyDisableSTDIO, [this] { DisableSTDIOValueChangedCallback(); });
 
+m_collection_sp->SetValueChangedCallback(
+ePropertySaveObjectsDir, [this] { CheckJITObjectsDir(); });
 m_experimental_properties_up =
 std::make_unique();
 m_collection_sp->AppendProperty(
@@ -3835,6 +3837,8 @@
 m_collection_sp->AppendProperty(
 ConstString("process"), ConstString("Settings specific to processes."),
 true, Process::GetGlobalProperties().GetValueProperties());
+m_collection_sp->SetValueChangedCallback(
+ePropertySaveObjectsDir, [this] { CheckJITObjectsDir(); });
   }
 }
 
@@ -4164,10 +4168,41 @@
   nullptr, idx, g_target_properties[idx].default_uint_value != 0);
 }
 
-bool TargetProperties::GetEnableSaveObjects() const {
-  const uint32_t idx = ePropertySaveObjects;
-  return m_collection_sp->GetPropertyAtIndexAsBoolean(
-  nullptr, idx, g_target_properties[idx].default_uint_value != 0);
+FileSpec TargetProperties::GetSaveJITObjectsDir() const {
+  const uint32_t idx = ePropertySaveObjectsDir;
+  return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx);
+}
+
+void TargetProperties::CheckJITObjectsDir() {
+  const uint32_t idx = ePropertySaveObjectsDir;
+  FileSpec new_dir = GetSaveJITObjectsDir();
+  const FileSystem &instance = FileSystem::Instance();
+  bool exists = instance.Exists(new_dir);
+  bool is_directory = instance.IsDirectory(new_dir);
+  std::string path = new_dir.GetPath(true);
+  bool writable = llvm::sys::fs::can_write(path);
+  if (exists && is_directory && writable)
+return;
+  m_collection_sp->GetPropertyAtIndex(nullptr, true, idx)->GetValue()
+  ->Clear();
+  StreamSP error_strm_sp;
+  if (m_target) {
+// FIXME: How can I warn the user when setting this on the Debugger?
+error_strm_sp = m_target->GetDebugger().GetAsyncErrorStream();
+  } else if (Debugger::GetNumDebuggers() == 1) {
+error_strm_sp = Debugger::GetDebuggerAtIndex(0)->GetAsyncErrorStream();
+  }
+  if (error_strm_sp) {
+error_strm_sp->Forma

[Lldb-commits] [PATCH] D120972: [lldb] Show progress events in the command line driver

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 413654.
JDevlieghere marked 3 inline comments as done.

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

https://reviews.llvm.org/D120972

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Symbol/LocateSymbolFile.cpp

Index: lldb/source/Symbol/LocateSymbolFile.cpp
===
--- lldb/source/Symbol/LocateSymbolFile.cpp
+++ lldb/source/Symbol/LocateSymbolFile.cpp
@@ -10,6 +10,7 @@
 
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/Progress.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Utility/ArchSpec.h"
@@ -262,6 +263,10 @@
   FileSystem::Instance().Exists(symbol_file_spec))
 return symbol_file_spec;
 
+  Progress progress(llvm::formatv(
+  "Locating external symbol file for {0}",
+  module_spec.GetFileSpec().GetFilename().AsCString("")));
+
   FileSpecList debug_file_search_paths = default_search_paths;
 
   // Add module directory.
Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -378,6 +378,12 @@
   return ret;
 }
 
+bool Debugger::GetShowProgress() const {
+  const uint32_t idx = ePropertyShowProgress;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_debugger_properties[idx].default_uint_value != 0);
+}
+
 bool Debugger::GetUseAutosuggestion() const {
   const uint32_t idx = ePropertyShowAutosuggestion;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(
@@ -1615,6 +1621,11 @@
   CommandInterpreter::eBroadcastBitAsynchronousOutputData |
   CommandInterpreter::eBroadcastBitAsynchronousErrorData);
 
+  if (!m_broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress)) {
+listener_sp->StartListeningForEvents(&m_broadcaster,
+ Debugger::eBroadcastBitProgress);
+  }
+
   // Let the thread that spawned us know that we have started up and that we
   // are now listening to all required events so no events get missed
   m_sync_broadcaster.BroadcastEvent(eBroadcastBitEventThreadIsListening);
@@ -1664,6 +1675,9 @@
 }
   }
 }
+  } else if (broadcaster == &m_broadcaster) {
+if (event_type & Debugger::eBroadcastBitProgress)
+  HandleProgressEvent(event_sp);
   }
 }
 
@@ -1729,6 +1743,61 @@
   return {};
 }
 
+void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
+  auto *data =
+  Debugger::ProgressEventData::GetEventDataFromEvent(event_sp.get());
+  if (!data)
+return;
+
+  // Do some bookkeeping for the current event, regardless of whether we're
+  // going to show the progress.
+  const uint64_t id = data->GetID();
+  if (m_current_event_id) {
+if (id != *m_current_event_id)
+  return;
+if (data->GetCompleted())
+  m_current_event_id.reset();
+  } else {
+m_current_event_id = id;
+  }
+
+  // Decide whether we actually are going to show the progress. This decision
+  // can change between iterations so check it inside the loop.
+  if (!GetShowProgress())
+return;
+
+  // Determine whether the current output file is an interactive terminal with
+  // color support. We assume that if we support ANSI escape codes we support
+  // vt100 escape codes.
+  File &output = GetOutputFile();
+  if (!output.GetIsInteractive() || !output.GetIsTerminalWithColors())
+return;
+
+  if (data->GetCompleted()) {
+// Clear the current line.
+output.Printf("\33[2K\r");
+return;
+  }
+
+  // Print over previous line, if any.
+  output.Printf("\r");
+
+  // Print the progress message.
+  std::string message = data->GetMessage();
+  if (data->GetTotal() != UINT64_MAX) {
+output.Printf("[%llu/%llu] %s...", data->GetCompleted(), data->GetTotal(),
+  message.c_str());
+  } else {
+output.Printf("%s...", message.c_str());
+  }
+
+  // Clear until the end of the line.
+  output.Printf("\x1B[K");
+
+  // Flush the output.
+  output.Flush();
+}
+
 bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); }
 
 bool Debugger::StartIOHandlerThread() {
Index: lldb/source/Core/CoreProperties.td
===
--- lldb/source/Core/CoreProperties.td
+++ lldb/source/Core/CoreProperties.td
@@ -131,6 +131,10 @@
 Global,
 DefaultTrue,
 Desc<"Whether to use Ansi color codes or not.">;
+  def ShowProgress: Property<"show-progress", "Boolean">,
+Global,
+DefaultTrue,
+Desc<"Whether to show progress or not if the debugger's output is an interactive color-enabled terminal.">;
   def UseSourceCache: Property<"use-source-cache", "Boolean">,
 Global,
 DefaultTrue,
Index: l

[Lldb-commits] [PATCH] D120972: [lldb] Show progress events in the command line driver

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Thanks for the review Greg!




Comment at: lldb/source/Core/CoreProperties.td:137
+DefaultTrue,
+Desc<"Whether to show progress or not.">;
   def UseSourceCache: Property<"use-source-cache", "Boolean">,

clayborg wrote:
> Might be nice to clarify that this is for the CLI only? 
> 
> Also, if this _is_ for the CLI only, the setting should probably be put into 
> the "interpreter" settings as "interpreter.show-progress".
> 
> 
I've updated the description to make it clear that this hinges of the debugger 
output being an interactive color enabled terminal.



Comment at: lldb/source/Core/Debugger.cpp:1756-1757
+  // can change between iterations so check it inside the loop.
+  if (!GetShowProgress())
+return;
+

clayborg wrote:
> Move this to the top of the function so we don't do any work extracting 
> anything from the event if it is disabled? Or is this code trying to limit 
> the updates of a progress that reports many status updates for the same 
> progress?
Kind of. `m_current_event_id` ensures that we only deal with one event at the 
same time. If we moved this check before the `m_current_event_id` bookkeeping, 
someone could disable progress before the current progress event completes 
resulting in `m_current_event_id` never getting cleared.

For example:

```
event 1 begin -> m_current_event_id = 1
progress disabled 
event 1 end -> ignored
progress enabled
event 2 begin -> ignored because m_current_event_id == 1
and now every subsequent event is ignored because m_current_event_id will never 
get updated 
```



Comment at: lldb/source/Core/Debugger.cpp:1763
+  File &output = GetOutputFile();
+  if (!output.GetIsInteractive() || !output.GetIsTerminalWithColors())
+return;

clayborg wrote:
> If not interactive should we just dump the start and end progress events on a 
> separate line?
I (personally) think that will quickly generate too much output.



Comment at: lldb/source/Core/Debugger.cpp:1768
+// Clear the current line.
+output.Printf("\33[2K\r");
+return;

clayborg wrote:
> Do we want some sort of format string here that the user could modify as a 
> setting? The idea would be there might be extra settings that the user could 
> set like:
> 
> (lldb) setting set interpreter.progress-clear-line-format "${ansi}"
> 
> and it could default to the above string. Not required, just thinking out 
> loud here as I am reading the patch
Part of that is covered in https://reviews.llvm.org/D121062. 

I didn't make the vt100 escape codes configurable. They're the same as what 
editline uses (which aren't configurable either) and to me are just 
implementation details.



Comment at: lldb/source/Core/Debugger.cpp:1778-1779
+  if (data->GetTotal() != UINT64_MAX) {
+output.Printf("[%llu/%llu] %s...", data->GetCompleted(), data->GetTotal(),
+  message.c_str());
+  } else {

clayborg wrote:
> If we did a format string for each message we could have something like:
> 
> "{${progress.is_start}...}{${progress.is_update}...}{${progress.is_end}...}"
> 
> where the "progress.is_start" variable would be true for the first progress 
> event, "progress.is_update" would be true for any updates, and 
> "progress.is_end" would be true if the progress is completed. This would 
> allow people to customize how progress events get handled and printed. If 
> someone just wants a start and end progress, then they can fill in the "..." 
> after the "progress.is_start" and "progress.is_end". If they don't want 
> updates, they can leave out the "{${progress.is_update}...}" section. It also 
> would allow ansi colors to be used since we already support these. And this 
> would allow non interactive sessions to still show progress if they want to 
> (right now if it isn't interactive, it doesn't get shown).
I intentionally kept things simple for now, but this is definitely something we 
could make more sophisticated/configurable in the future.


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

https://reviews.llvm.org/D120972

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121036: Fix target.save-jit-objects when the CWD is not writeable

2022-03-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121036

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121036: Fix target.save-jit-objects when the CWD is not writeable

2022-03-07 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG94ec0b6c5ab8: Change "target.save-jit-objects" to 
"target.save-jit-objects-dir". (authored by jingham).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121036

Files:
  lldb/include/lldb/Interpreter/OptionValue.h
  lldb/include/lldb/Target/Target.h
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/TargetProperties.td
  lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py

Index: lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py
===
--- lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py
+++ lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py
@@ -38,14 +38,14 @@
 self.cleanJITFiles()
 frame.EvaluateExpression("(void*)malloc(0x1)")
 self.assertEquals(self.countJITFiles(), 0,
-"No files emitted with save-jit-objects=false")
-
-self.runCmd("settings set target.save-jit-objects true")
+  "No files emitted with save-jit-objects-dir empty")
+
+self.runCmd("settings set target.save-jit-objects-dir {0}".format(self.getBuildDir()))
 frame.EvaluateExpression("(void*)malloc(0x1)")
 jit_files_count = self.countJITFiles()
 self.cleanJITFiles()
 self.assertNotEqual(jit_files_count, 0,
-"At least one file emitted with save-jit-objects=true")
+"At least one file emitted with save-jit-objects-dir set to the build dir")
 
 process.Kill()
 os.chdir(self.getSourceDir())
Index: lldb/source/Target/TargetProperties.td
===
--- lldb/source/Target/TargetProperties.td
+++ lldb/source/Target/TargetProperties.td
@@ -63,9 +63,9 @@
   def NotifyAboutFixIts: Property<"notify-about-fixits", "Boolean">,
 DefaultTrue,
 Desc<"Print the fixed expression text.">;
-  def SaveObjects: Property<"save-jit-objects", "Boolean">,
-DefaultFalse,
-Desc<"Save intermediate object files generated by the LLVM JIT">;
+  def SaveObjectsDir: Property<"save-jit-objects-dir", "FileSpec">,
+DefaultStringValue<"">,
+Desc<"If specified, the directory to save intermediate object files generated by the LLVM JIT">;
   def MaxZeroPaddingInFloatFormat: Property<"max-zero-padding-in-float-format", "UInt64">,
 DefaultUnsignedValue<6>,
 Desc<"The maximum number of zeroes to insert when displaying a very small float before falling back to scientific notation.">;
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -3814,6 +3814,8 @@
 m_collection_sp->SetValueChangedCallback(
 ePropertyDisableSTDIO, [this] { DisableSTDIOValueChangedCallback(); });
 
+m_collection_sp->SetValueChangedCallback(
+ePropertySaveObjectsDir, [this] { CheckJITObjectsDir(); });
 m_experimental_properties_up =
 std::make_unique();
 m_collection_sp->AppendProperty(
@@ -3835,6 +3837,8 @@
 m_collection_sp->AppendProperty(
 ConstString("process"), ConstString("Settings specific to processes."),
 true, Process::GetGlobalProperties().GetValueProperties());
+m_collection_sp->SetValueChangedCallback(
+ePropertySaveObjectsDir, [this] { CheckJITObjectsDir(); });
   }
 }
 
@@ -4164,10 +4168,41 @@
   nullptr, idx, g_target_properties[idx].default_uint_value != 0);
 }
 
-bool TargetProperties::GetEnableSaveObjects() const {
-  const uint32_t idx = ePropertySaveObjects;
-  return m_collection_sp->GetPropertyAtIndexAsBoolean(
-  nullptr, idx, g_target_properties[idx].default_uint_value != 0);
+FileSpec TargetProperties::GetSaveJITObjectsDir() const {
+  const uint32_t idx = ePropertySaveObjectsDir;
+  return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx);
+}
+
+void TargetProperties::CheckJITObjectsDir() {
+  const uint32_t idx = ePropertySaveObjectsDir;
+  FileSpec new_dir = GetSaveJITObjectsDir();
+  const FileSystem &instance = FileSystem::Instance();
+  bool exists = instance.Exists(new_dir);
+  bool is_directory = instance.IsDirectory(new_dir);
+  std::string path = new_dir.GetPath(true);
+  bool writable = llvm::sys::fs::can_write(path);
+  if (exists && is_directory && writable)
+return;
+  m_collection_sp->GetPropertyAtIndex(nullptr, true, idx)->GetValue()
+  ->Clear();
+  StreamSP error_strm_sp;
+  if (m_target) {
+// FIXME: How can I warn the user when setting this on the Debugger?
+error_strm_sp = m_target->GetDebugger().GetAsyncErrorStream();
+  } else if (Debugger::GetNumDebuggers() == 1) {
+error_strm_sp = Debugger::

[Lldb-commits] [lldb] 94ec0b6 - Change "target.save-jit-objects" to "target.save-jit-objects-dir".

2022-03-07 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2022-03-07T17:44:51-08:00
New Revision: 94ec0b6c5ab8b5cd2f418f872ae2bbb2be3c550e

URL: 
https://github.com/llvm/llvm-project/commit/94ec0b6c5ab8b5cd2f418f872ae2bbb2be3c550e
DIFF: 
https://github.com/llvm/llvm-project/commit/94ec0b6c5ab8b5cd2f418f872ae2bbb2be3c550e.diff

LOG: Change "target.save-jit-objects" to "target.save-jit-objects-dir".
The old command wrote to CWD, which doesn't always work, and if it
didn't, there was no workaround (and it crashed on failure).  This
patch changed the setting to provide a directory to save the objects
to.

Differential Revision: https://reviews.llvm.org/D121036

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionValue.h
lldb/include/lldb/Target/Target.h
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/TargetProperties.td
lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionValue.h 
b/lldb/include/lldb/Interpreter/OptionValue.h
index 99f52b0411b9c..277a5c9d30f05 100644
--- a/lldb/include/lldb/Interpreter/OptionValue.h
+++ b/lldb/include/lldb/Interpreter/OptionValue.h
@@ -311,7 +311,6 @@ class OptionValue {
   lldb::OptionValueSP GetParent() const { return m_parent_wp.lock(); }
 
   void SetValueChangedCallback(std::function callback) {
-assert(!m_callback);
 m_callback = std::move(callback);
   }
 

diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index 54c1fb5840c9d..faa77a2ac5957 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -158,8 +158,8 @@ class TargetProperties : public Properties {
 
   bool GetEnableNotifyAboutFixIts() const;
 
-  bool GetEnableSaveObjects() const;
-
+  FileSpec GetSaveJITObjectsDir() const;
+  
   bool GetEnableSyntheticValue() const;
 
   uint32_t GetMaxZeroPaddingInFloatFormat() const;
@@ -248,6 +248,9 @@ class TargetProperties : public Properties {
   void DisableASLRValueChangedCallback();
   void InheritTCCValueChangedCallback();
   void DisableSTDIOValueChangedCallback();
+  
+  // Settings checker for target.jit-save-objects-dir:
+  void CheckJITObjectsDir();
 
   Environment ComputeEnvironment() const;
 

diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index 92c91deb46e97..91b92f1ba3003 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Expression/IRExecutionUnit.h"
+#include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Symbol/SymbolFile.h"
@@ -306,27 +307,37 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, 
lldb::addr_t &func_addr,
 
   class ObjectDumper : public llvm::ObjectCache {
   public:
+ObjectDumper(FileSpec output_dir)  : m_out_dir(output_dir) {}
 void notifyObjectCompiled(const llvm::Module *module,
   llvm::MemoryBufferRef object) override {
   int fd = 0;
   llvm::SmallVector result_path;
   std::string object_name_model =
   "jit-object-" + module->getModuleIdentifier() + "-%%%.o";
-  (void)llvm::sys::fs::createUniqueFile(object_name_model, fd, 
result_path);
-  llvm::raw_fd_ostream fds(fd, true);
-  fds.write(object.getBufferStart(), object.getBufferSize());
+  FileSpec model_spec 
+  = m_out_dir.CopyByAppendingPathComponent(object_name_model);
+  std::string model_path = model_spec.GetPath();
+
+  std::error_code result 
+= llvm::sys::fs::createUniqueFile(model_path, fd, result_path);
+  if (!result) {
+  llvm::raw_fd_ostream fds(fd, true);
+  fds.write(object.getBufferStart(), object.getBufferSize());
+  }
 }
-
 std::unique_ptr
-getObject(const llvm::Module *module) override {
+getObject(const llvm::Module *module) override  {
   // Return nothing - we're just abusing the object-cache mechanism to dump
   // objects.
   return nullptr;
-}
+  }
+  private:
+FileSpec m_out_dir;
   };
 
-  if (process_sp->GetTarget().GetEnableSaveObjects()) {
-m_object_cache_up = std::make_unique();
+  FileSpec save_objects_dir = process_sp->GetTarget().GetSaveJITObjectsDir();
+  if (save_objects_dir) {
+m_object_cache_up = std::make_unique(save_objects_dir);
 m_execution_engine_up->setObjectCache(m_object_cache_up.get());
   }
 

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 14b5ecfacf384..6e8cc1df89398 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3814,6 +3814,8 @@ TargetProperties::TargetProperties(Target *target)
 m_collection_sp->SetValueChangedCallback(