[Lldb-commits] [llvm] [lldb] [clang] [BOLT] Extend calculateEmittedSize for Block Size Calculation (PR #73076)

2023-11-22 Thread via lldb-commits

https://github.com/ShatianWang updated 
https://github.com/llvm/llvm-project/pull/73076

>From 322c9ed213a0aa674d822a01e8b809eb1be628a5 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Tue, 1 Jun 2021 11:37:41 -0700
Subject: [PATCH 1/3] Rebase: [Facebook] Add clang driver options to test debug
 info and BOLT

Summary:
This is an essential piece of infrastructure for us to be
continuously testing debug info with BOLT. We can't only make changes
to a test repo because we need to change debuginfo tests to call BOLT,
hence, this diff needs to sit in our opensource repo. But when upstreaming
to LLVM, this should be kept BOLT-only outside of LLVM. When upstreaming,
we need to git diff and check all folders that are being modified by our
commits and discard this one (and leave as an internal diff).

To test BOLT in debuginfo tests, configure it with -DLLVM_TEST_BOLT=ON.
Then run check-lldb and check-debuginfo.

Manual rebase conflict history:
https://phabricator.intern.facebook.com/D29205224
https://phabricator.intern.facebook.com/D29564078
https://phabricator.intern.facebook.com/D33289118
https://phabricator.intern.facebook.com/D34957174
https://phabricator.intern.facebook.com/D35317341

Test Plan:
tested locally
Configured with:
-DLLVM_ENABLE_PROJECTS="clang;lld;lldb;compiler-rt;bolt;debuginfo-tests"
-DLLVM_TEST_BOLT=ON
Ran test suite with:
ninja check-debuginfo
ninja check-lldb

Reviewers: maks, #llvm-bolt

Reviewed By: maks

Subscribers: ayermolo, phabricatorlinter

Differential Revision: https://phabricator.intern.facebook.com/D46256657

Tasks: T92898286
---
 clang/include/clang/Driver/Options.td  |  4 
 clang/lib/Driver/ToolChains/Gnu.cpp| 29 ++
 cross-project-tests/lit.cfg.py | 14 -
 cross-project-tests/lit.site.cfg.py.in |  4 
 lldb/test/API/lit.cfg.py   |  5 +
 lldb/test/API/lit.site.cfg.py.in   |  8 +++
 lldb/test/Shell/helper/toolchain.py|  5 +
 lldb/test/Shell/lit.site.cfg.py.in |  9 
 llvm/CMakeLists.txt|  4 
 9 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index b2f2bcb6ac379109..c1a06aab30534fd4 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5199,6 +5199,10 @@ def pg : Flag<["-"], "pg">, HelpText<"Enable mcount 
instrumentation">,
   MarshallingInfoFlag>;
 def pipe : Flag<["-", "--"], "pipe">,
   HelpText<"Use pipes between commands, when possible">;
+// Facebook T92898286
+def post_link_optimize : Flag<["--"], "post-link-optimize">,
+  HelpText<"Apply post-link optimizations using BOLT">;
+// End Facebook T92898286
 def prebind__all__twolevel__modules : Flag<["-"], 
"prebind_all_twolevel_modules">;
 def prebind : Flag<["-"], "prebind">;
 def preload : Flag<["-"], "preload">;
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 2b1e8f02cf663885..07f2d90c82386497 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -662,12 +662,41 @@ void tools::gnutools::Linker::ConstructJob(Compilation 
&C, const JobAction &JA,
 }
   }
 
+  // Facebook T92898286
+  if (Args.hasArg(options::OPT_post_link_optimize))
+CmdArgs.push_back("-q");
+  // End Facebook T92898286
+
   Args.AddAllArgs(CmdArgs, options::OPT_T);
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),
  Exec, CmdArgs, Inputs, Output));
+  // Facebook T92898286
+  if (!Args.hasArg(options::OPT_post_link_optimize) || !Output.isFilename())
+return;
+
+  const char *MvExec = Args.MakeArgString(ToolChain.GetProgramPath("mv"));
+  ArgStringList MoveCmdArgs;
+  MoveCmdArgs.push_back(Output.getFilename());
+  const char *PreBoltBin =
+  Args.MakeArgString(Twine(Output.getFilename()) + ".pre-bolt");
+  MoveCmdArgs.push_back(PreBoltBin);
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ MvExec, MoveCmdArgs, std::nullopt));
+
+  ArgStringList BoltCmdArgs;
+  const char *BoltExec =
+  Args.MakeArgString(ToolChain.GetProgramPath("llvm-bolt"));
+  BoltCmdArgs.push_back(PreBoltBin);
+  BoltCmdArgs.push_back("-reorder-blocks=reverse");
+  BoltCmdArgs.push_back("-update-debug-sections");
+  BoltCmdArgs.push_back("-o");
+  BoltCmdArgs.push_back(Output.getFilename());
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ BoltExec, BoltCmdArgs, std::nullopt));
+  // End Facebook T92898286
 }
 
 void tools::gnutools::Assembler::ConstructJob(Compilation &C,
diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py
index 774c4eaf4d976b26..619634578dfe609a 100644
--- a/cross-project-te

[Lldb-commits] [llvm] [lldb] [clang] [BOLT] Extend calculateEmittedSize for Block Size Calculation (PR #73076)

2023-11-22 Thread via lldb-commits

llvmbot wrote:



@llvm/pr-subscribers-clang-driver
@llvm/pr-subscribers-mc

@llvm/pr-subscribers-lldb

Author: ShatianWang (ShatianWang)


Changes

This commit modifies BinaryContext::calculateEmittedSize to update the 
BinaryBasicBlock::OutputAddressRange for each basic block in the input BF. The 
modification is done in place, where BB.OutputAddressRange.second less 
BB.OutputAddressRange.first now gives the emitted size of the basic block.

---

Patch is 31.51 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/73076.diff


21 Files Affected:

- (modified) bolt/include/bolt/Core/BinaryContext.h (+3) 
- (modified) bolt/lib/Core/BinaryContext.cpp (+29-6) 
- (modified) bolt/lib/Core/BinaryEmitter.cpp (+1) 
- (modified) clang/include/clang/Driver/Options.td (+4) 
- (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+29) 
- (modified) cross-project-tests/lit.cfg.py (+13-1) 
- (modified) cross-project-tests/lit.site.cfg.py.in (+4) 
- (modified) lldb/test/API/lit.cfg.py (+5) 
- (modified) lldb/test/API/lit.site.cfg.py.in (+8) 
- (modified) lldb/test/Shell/helper/toolchain.py (+5) 
- (modified) lldb/test/Shell/lit.site.cfg.py.in (+9) 
- (modified) llvm/CMakeLists.txt (+4) 
- (modified) llvm/include/llvm/MC/MCFragment.h (+22) 
- (modified) llvm/include/llvm/MC/MCObjectStreamer.h (+2) 
- (modified) llvm/include/llvm/MC/MCStreamer.h (+6) 
- (modified) llvm/lib/MC/MCAssembler.cpp (+81-37) 
- (modified) llvm/lib/MC/MCFragment.cpp (+12) 
- (modified) llvm/lib/MC/MCObjectStreamer.cpp (+5) 
- (modified) llvm/lib/MC/MCStreamer.cpp (+2) 
- (modified) llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp (+24) 
- (added) llvm/test/MC/X86/directive-avoid_end_align.s (+208) 


``diff
diff --git a/bolt/include/bolt/Core/BinaryContext.h 
b/bolt/include/bolt/Core/BinaryContext.h
index a4e84cb93c093dc2..258063e8584bb5d2 100644
--- a/bolt/include/bolt/Core/BinaryContext.h
+++ b/bolt/include/bolt/Core/BinaryContext.h
@@ -1230,6 +1230,9 @@ class BinaryContext {
   ///
   /// Return the pair where the first size is for the main part, and the second
   /// size is for the cold one.
+  /// Modify BinaryBasicBlock::OutputAddressRange for each basic block in the
+  /// function in place so that BB.OutputAddressRange.second less
+  /// BB.OutputAddressRange.first gives the emitted size of BB.
   std::pair calculateEmittedSize(BinaryFunction &BF,
  bool FixBranches = true);
 
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index cd70bdb7a4228d0b..af33398c9a9f2736 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -2322,14 +2322,37 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, 
bool FixBranches) {
   MCAsmLayout Layout(Assembler);
   Assembler.layout(Layout);
 
+  // Obtain fragment sizes.
+  std::vector FragmentSizes;
+  // Main fragment size.
   const uint64_t HotSize =
   Layout.getSymbolOffset(*EndLabel) - Layout.getSymbolOffset(*StartLabel);
-  const uint64_t ColdSize =
-  std::accumulate(SplitLabels.begin(), SplitLabels.end(), 0ULL,
-  [&](const uint64_t Accu, const LabelRange &Labels) {
-return Accu + Layout.getSymbolOffset(*Labels.second) -
-   Layout.getSymbolOffset(*Labels.first);
-  });
+  FragmentSizes.push_back(HotSize);
+  // Split fragment sizes.
+  uint64_t ColdSize = 0;
+  for (const auto &Labels : SplitLabels) {
+uint64_t Size = Layout.getSymbolOffset(*Labels.second) -
+Layout.getSymbolOffset(*Labels.first);
+FragmentSizes.push_back(Size);
+ColdSize += Size;
+  }
+
+  // Populate new start and end offsets of each basic block.
+  BinaryBasicBlock *PrevBB = nullptr;
+  uint64_t FragmentIndex = 0;
+  for (FunctionFragment &FF : BF.getLayout().fragments()) {
+for (BinaryBasicBlock *BB : FF) {
+  const uint64_t BBStartOffset = Layout.getSymbolOffset(*(BB->getLabel()));
+  BB->setOutputStartAddress(BBStartOffset);
+  if (PrevBB)
+PrevBB->setOutputEndAddress(BBStartOffset);
+  PrevBB = BB;
+}
+if (PrevBB)
+  PrevBB->setOutputEndAddress(FragmentSizes[FragmentIndex]);
+FragmentIndex++;
+PrevBB = nullptr;
+  }
 
   // Clean-up the effect of the code emission.
   for (const MCSymbol &Symbol : Assembler.symbols()) {
diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp
index fb1bf530c1974aa2..82fbd8c0f67b215f 100644
--- a/bolt/lib/Core/BinaryEmitter.cpp
+++ b/bolt/lib/Core/BinaryEmitter.cpp
@@ -482,6 +482,7 @@ void BinaryEmitter::emitFunctionBody(BinaryFunction &BF, 
FunctionFragment &FF,
 // This assumes the second instruction in the macro-op pair will get
 // assigned to its own MCRelaxableFragment. Since all JCC instructions
 // are relaxable, we should be safe.
+Streamer.emitNeverAlignCodeAtEnd(/*Alignment to avoid=*/64, *BC.STI);
 

[Lldb-commits] [llvm] [lldb] [clang] [BOLT] Extend calculateEmittedSize for Block Size Calculation (PR #73076)

2023-11-22 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
e07fec10ac208c2868a24c5c0be88e45778b297e..98e1f4c3b15f677e5dbfa85dace75e4c092bb99f
 cross-project-tests/lit.cfg.py lldb/test/API/lit.cfg.py 
lldb/test/Shell/helper/toolchain.py
``





View the diff from darker here.


``diff
--- cross-project-tests/lit.cfg.py  2023-11-21 09:11:25.00 +
+++ cross-project-tests/lit.cfg.py  2023-11-22 16:55:56.106328 +
@@ -85,11 +85,14 @@
 if not hasattr(config, "clang_src_dir"):
 config.clang_src_dir = ""
 # Facebook T92898286
 should_test_bolt = get_required_attr(config, "llvm_test_bolt")
 if should_test_bolt:
-llvm_config.use_clang(required=("clang" in config.llvm_enabled_projects), 
additional_flags=["--post-link-optimize"])
+llvm_config.use_clang(
+required=("clang" in config.llvm_enabled_projects),
+additional_flags=["--post-link-optimize"],
+)
 else:
 llvm_config.use_clang(required=("clang" in config.llvm_enabled_projects))
 # End Facebook T92898286
 
 if not hasattr(config, "lld_src_dir"):

``




https://github.com/llvm/llvm-project/pull/73076
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

2023-11-22 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/69422

From 8e5e67ff640aa0ff14b1a0bd0110b88c539ccfe8 Mon Sep 17 00:00:00 2001
From: taalhaataahir0102 <23100...@lums.edu.pk>
Date: Wed, 11 Oct 2023 14:27:15 +0500
Subject: [PATCH 1/3] colorization

---
 lldb/include/lldb/Core/Address.h |   6 +
 lldb/include/lldb/Symbol/Symbol.h|   3 +
 lldb/include/lldb/Symbol/SymbolContext.h |  11 +
 lldb/source/Commands/CommandObjectTarget.cpp |  97 -
 lldb/source/Core/Address.cpp | 428 +++
 lldb/source/Symbol/Symbol.cpp|  68 +++
 lldb/source/Symbol/SymbolContext.cpp | 248 +++
 7 files changed, 859 insertions(+), 2 deletions(-)

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index b19e694427546f8b..4151817813c7e352 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -249,6 +249,12 @@ class Address {
 uint32_t addr_byte_size = UINT32_MAX,
 bool all_ranges = false) const;
 
+
+  bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,const 
char* name,
+DumpStyle fallback_style = DumpStyleInvalid,
+uint32_t addr_byte_size = UINT32_MAX,
+bool all_ranges = false) const;
+
   AddressClass GetAddressClass() const;
 
   /// Get the file address.
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index 44a2d560010fe403..a9e91fbac055a924 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -177,6 +177,9 @@ class Symbol : public SymbolContextScope {
   void GetDescription(Stream *s, lldb::DescriptionLevel level,
   Target *target) const;
 
+  void GetDescription(Stream *s, lldb::DescriptionLevel level,
+  Target *target, const char* name) const;
+
   bool IsSynthetic() const { return m_is_synthetic; }
 
   bool IsSyntheticWithAutoGeneratedName() const;
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h 
b/lldb/include/lldb/Symbol/SymbolContext.h
index b0f5ffead2a16569..947c39eec96e53a9 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -153,6 +153,14 @@ class SymbolContext {
bool show_function_arguments,
bool show_function_name) const;
 
+  bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
+   const Address &so_addr, bool show_fullpaths,
+   bool show_module, bool show_inlined_frames,
+   bool show_function_arguments,
+   bool show_function_name, 
+   const char* name) const;
+   
+
   /// Get the address range contained within a symbol context.
   ///
   /// Address range priority is as follows:
@@ -220,6 +228,9 @@ class SymbolContext {
   void GetDescription(Stream *s, lldb::DescriptionLevel level,
   Target *target) const;
 
+  void GetDescription(Stream *s, lldb::DescriptionLevel level,
+  Target *target, const char* name) const;
+
   uint32_t GetResolvedMask() const;
 
   lldb::LanguageType GetLanguage() const;
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 0ef0926d61f0..aa59e3680a37872c 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1513,6 +1513,98 @@ static bool LookupAddressInModule(CommandInterpreter 
&interpreter, Stream &strm,
   return false;
 }
 
+//===
+static void PrintRed(Stream &strm, const char *text, const char *name) {
+const char *red_start = "\033[31m";  // Set text color to red
+const char *reset_color = "\033[0m";   // Reset text color to default
+
+// Escape1(ansi.red)
+
+const char *match = text;
+size_t name_len = strlen(name);
+
+while ((match = strstr(match, name))) {
+size_t prefix_len = match - text;
+
+strm.Write(text, prefix_len);
+strm.PutCString(red_start);
+strm.Write(match, name_len);
+strm.PutCString(reset_color);
+
+text = match + name_len;
+match = text;
+}
+
+strm.PutCString(text); // Print any remaining text
+}
+
+
+// static void PrintRed(Stream &strm, const char *text, const char *name) {
+// const char *red_start = "\033[31m";  // Set text color to red
+// const char *reset_color = "\033[0m";   // Reset text color to default
+
+// const char *match = text;
+
+// // Split the name into parts using the delimiter '|'
+// std::vector name_parts;
+// const char *delimiter = "|";  // Delimiter for splitting the name
+// const char *token = strtok(const_cast(name), delimiter);
+// while (token

[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

2023-11-22 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/69422

From a15d0cdc0330fe811ce65dc4d62374fd12304cef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Tue, 7 Nov 2023 16:57:18 -0300
Subject: [PATCH] [lldb] colorize symbols in image lookup

Updated Testcases

changed Address::DumpName to Stream::PutCStringColorHighlighted

coreected test cases

update PutCStringColorHighlighted docstrings and minor changes

update PutCStringColorHighlighted docstrings and minor changes

minor changes

Co-authored-by: Talha 
---
 lldb/include/lldb/Core/Address.h  |  4 +-
 lldb/include/lldb/Symbol/Symbol.h |  4 +-
 lldb/include/lldb/Symbol/SymbolContext.h  |  8 ++--
 lldb/include/lldb/Utility/Stream.h| 16 
 lldb/source/Commands/CommandObjectTarget.cpp  | 16 +---
 lldb/source/Core/Address.cpp  | 21 ++
 lldb/source/Symbol/Symbol.cpp | 18 ++---
 lldb/source/Symbol/SymbolContext.cpp  | 16 +---
 lldb/source/Utility/Stream.cpp| 28 +
 .../Commands/command-image-lookup-color.test  | 39 +++
 10 files changed, 138 insertions(+), 32 deletions(-)
 create mode 100644 lldb/test/Shell/Commands/command-image-lookup-color.test

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index b19e694427546f8..c3f2832be424efd 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -246,8 +246,8 @@ class Address {
   /// \see Address::DumpStyle
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
-uint32_t addr_byte_size = UINT32_MAX,
-bool all_ranges = false) const;
+uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
+const char *pattern = nullptr) const;
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index 44a2d560010fe40..0e41cd95e0ef17d 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -174,8 +174,8 @@ class Symbol : public SymbolContextScope {
 
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
-  void GetDescription(Stream *s, lldb::DescriptionLevel level,
-  Target *target) const;
+  void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
+  const char *pattern = nullptr) const;
 
   bool IsSynthetic() const { return m_is_synthetic; }
 
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h 
b/lldb/include/lldb/Symbol/SymbolContext.h
index b0f5ffead2a1656..9567c3f4384c175 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -150,8 +150,8 @@ class SymbolContext {
   bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
-   bool show_function_arguments,
-   bool show_function_name) const;
+   bool show_function_arguments, bool show_function_name,
+   const char *pattern = nullptr) const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -217,8 +217,8 @@ class SymbolContext {
   /// The symbol that was found, or \b nullptr if none was found.
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
-  void GetDescription(Stream *s, lldb::DescriptionLevel level,
-  Target *target) const;
+  void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
+  const char *pattern = nullptr) const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 1a5fd343e4df0dc..8e3fd48dfe70579 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -231,6 +231,22 @@ class Stream {
   /// The string to be output to the stream.
   size_t PutCString(llvm::StringRef cstr);
 
+  /// Output a C string to the stream with color highlighting.
+  ///
+  /// Print a C string \a text to the stream, applying red color highlighting 
to
+  /// the portions of the string that match the regex pattern \a pattern. The
+  /// pattern is matched as many times as possible throughout the string. If \a
+  /// pattern is nullptr, then no highlighting is applied.
+  ///
+  /// \param[in] text
+  /// The string to be output to the stream.
+  ///
+  /// \param[in] pattern
+  /// The regex pattern to match against the \a text string. Portions of \a
+  /// text matching this pattern will be colorized. If this parameter is
+  /// nullptr, highlighting is not performed.
+  void PutCStringColorHighli

[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup (PR #69422)

2023-11-22 Thread via lldb-commits

https://github.com/taalhaataahir0102 edited 
https://github.com/llvm/llvm-project/pull/69422
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup (PR #69422)

2023-11-22 Thread via lldb-commits

https://github.com/taalhaataahir0102 ready_for_review 
https://github.com/llvm/llvm-project/pull/69422
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup (PR #69422)

2023-11-22 Thread via lldb-commits

taalhaataahir0102 wrote:

Hi @DavidSpickett ! Sorry for the delay. We've done the required changes and 
believe that it's ready for review 

https://github.com/llvm/llvm-project/pull/69422
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] correct inconsistent order of messages on process launch (PR #73173)

2023-11-22 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl created 
https://github.com/llvm/llvm-project/pull/73173

## Overview

This pull request addresses the issue 
[#68035](https://github.com/llvm/llvm-project/issues/68035), where an 
inconsistency in the order of "Process launched" and "Process stopped" messages 
occurs during `process launch`.

## Impact

Upon implementing this change, two tests failed: 
`lldb/test/Shell/Breakpoint/jit-loader_jitlink_elf.test` and 
`lldb/test/Shell/Breakpoint/jit-loader_rtdyld_elf.test`. These failures are 
anticipated as the tests are designed to expect the "Process stopped" message 
before the "Process launched" message, which is the behavior this PR aims to 
correct.

From e451fe7a466f90557c301f0775d65caaa8955a8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Wed, 22 Nov 2023 18:26:14 -0300
Subject: [PATCH] [lldb] correct inconsistent order of messages on process
 launch

---
 lldb/source/Commands/CommandObjectProcess.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectProcess.cpp 
b/lldb/source/Commands/CommandObjectProcess.cpp
index c7ce1b1258c196c..f601316a6f673ec 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -265,8 +265,6 @@ class CommandObjectProcessLaunch : public 
CommandObjectProcessLaunchOrAttach {
 process_sp->SyncIOHandler(0, std::chrono::seconds(2));
 
 llvm::StringRef data = stream.GetString();
-if (!data.empty())
-  result.AppendMessage(data);
 // If we didn't have a local executable, then we wouldn't have had an
 // executable module before launch.
 if (!exe_module_sp)
@@ -282,6 +280,8 @@ class CommandObjectProcessLaunch : public 
CommandObjectProcessLaunchOrAttach {
   exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
 }
 result.SetStatus(eReturnStatusSuccessFinishResult);
+if (!data.empty())
+  result.AppendMessage(data);
 result.SetDidChangeProcessState(true);
   } else {
 result.AppendError(

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


[Lldb-commits] [lldb] [lldb] correct inconsistent order of messages on process launch (PR #73173)

2023-11-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: José Lira Junior (junior-jl)


Changes

## Overview

This pull request addresses the issue [#68035](https://github.com/llvm/llvm-project/issues/68035), where an 
inconsistency in the order of "Process launched" and "Process stopped" messages 
occurs during `process launch`.

## Impact

Upon implementing this change, two tests failed: 
`lldb/test/Shell/Breakpoint/jit-loader_jitlink_elf.test` and 
`lldb/test/Shell/Breakpoint/jit-loader_rtdyld_elf.test`. These failures are 
anticipated as the tests are designed to expect the "Process stopped" message 
before the "Process launched" message, which is the behavior this PR aims to 
correct.

---
Full diff: https://github.com/llvm/llvm-project/pull/73173.diff


1 Files Affected:

- (modified) lldb/source/Commands/CommandObjectProcess.cpp (+2-2) 


``diff
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp 
b/lldb/source/Commands/CommandObjectProcess.cpp
index c7ce1b1258c196c..f601316a6f673ec 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -265,8 +265,6 @@ class CommandObjectProcessLaunch : public 
CommandObjectProcessLaunchOrAttach {
 process_sp->SyncIOHandler(0, std::chrono::seconds(2));
 
 llvm::StringRef data = stream.GetString();
-if (!data.empty())
-  result.AppendMessage(data);
 // If we didn't have a local executable, then we wouldn't have had an
 // executable module before launch.
 if (!exe_module_sp)
@@ -282,6 +280,8 @@ class CommandObjectProcessLaunch : public 
CommandObjectProcessLaunchOrAttach {
   exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
 }
 result.SetStatus(eReturnStatusSuccessFinishResult);
+if (!data.empty())
+  result.AppendMessage(data);
 result.SetDidChangeProcessState(true);
   } else {
 result.AppendError(

``




https://github.com/llvm/llvm-project/pull/73173
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Add support for parsing type unit entries in .debug_names. (PR #72952)

2023-11-22 Thread via lldb-commits

https://github.com/jeffreytan81 approved this pull request.

Do we want to add a test with duplicate type names? Otherwise, LGTM.

https://github.com/llvm/llvm-project/pull/72952
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits