[Lldb-commits] [lldb] a756dc4 - [lldb][test] Try a workaround for module cache test on Arm/AArch64 Linux

2023-12-20 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-20T08:46:10Z
New Revision: a756dc4724a279d76898bacd054a04832b02caa8

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

LOG: [lldb][test] Try a workaround for module cache test on Arm/AArch64 Linux

If this works it'll give me a clue for the underlying issue.

Added: 


Modified: 
lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py

Removed: 




diff  --git 
a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py 
b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index dc736d07d885ef..cc9da15b566c25 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -34,10 +34,6 @@ def copy_to_main(self, src, dst):
 # The rerun tests indicate rerunning on Windows doesn't really work, so
 # this one won't either.
 @skipIfWindows
-# On Arm and AArch64 Linux, this test attempts to pop a thread plan when
-# we only have the base plan remaining. Skip it until we can figure out
-# the bug this is exposing.
-@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 def test_OneTargetOneDebugger(self):
 self.do_test(True, True)
 
@@ -104,6 +100,13 @@ def do_test(self, one_target, one_debugger):
 self.old_debugger = self.dbg
 self.dbg = new_debugger
 def cleanupDebugger(self):
+# On Arm and AArch64 Linux, it is suspected that destroying
+# the debugger first causes lldb to try to pop from an 
empty
+# thread plan stack. Try to prove this by killing the 
process
+# first.
+for i in range(self.dbg.GetNumTargets()):
+self.dbg.GetTargetAtIndex(i).GetProcess().Kill()
+
 lldb.SBDebugger.Destroy(self.dbg)
 self.dbg = self.old_debugger
 self.old_debugger = None



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


[Lldb-commits] [lldb] Add a test for evicting unreachable modules from the global module cache (PR #74894)

2023-12-20 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> It would be interesting to see if changing the test to explicitly kill the 
> process, then its target, then the Debugger makes the crash go away.

Trying this as 
https://github.com/llvm/llvm-project/commit/a756dc4724a279d76898bacd054a04832b02caa8.

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


[Lldb-commits] [compiler-rt] [lld] [lldb] [flang] [clang] [mlir] [llvm] [libcxx] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-20 Thread Petr Hosek via lldb-commits

petrhosek wrote:

I have discovered another issue, on Fuchsia `libclang_rt.builtins.a` now has a 
reference to `getauxval` which it didn't have before. This is really 
undesirable because on Fuchsia, there's no `auxv` to begin with. I believe this 
is because before, the `__init_cpu_features` definition was guarded by:

```
#if defined(__has_include)
#if __has_include()
#include 
...
#if __has_include()
#include 
```
These `#if __has_include(...)` conditionals would evaluate to false on Fuchsia 
since we don't have those headers, but they have been moved in the refactored 
version.

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


[Lldb-commits] [llvm] [libc] [mlir] [lldb] [clang] [flang] Make 'UnrollMaxUpperBound' to be overridable by target. (PR #76029)

2023-12-20 Thread via lldb-commits

https://github.com/boxu-zhang updated 
https://github.com/llvm/llvm-project/pull/76029

>From 60030d96d27d23ef2049a3888d65721be51c4481 Mon Sep 17 00:00:00 2001
From: "boxu.zhang" 
Date: Wed, 20 Dec 2023 17:35:25 +0800
Subject: [PATCH] Make 'UnrollMaxUpperBound' to be overridable by target. The
 default value is still 8 and the command line argument
 '--unroll-max-upperbound' takes final effect if provided.

---
 llvm/include/llvm/Analysis/TargetTransformInfo.h | 4 
 llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp| 9 ++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h 
b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index f5114fa40c70ad..6fc697c37c3c33 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -560,6 +560,10 @@ class TargetTransformInfo {
 // (set to UINT_MAX to disable). This does not apply in cases where the
 // loop is being fully unrolled.
 unsigned MaxCount;
+/// Set the maximum upper bound of trip count. Allowing the MaxUpperBound
+/// to be overrided by a target gives more flexiblity on certain cases. 
+/// By default, MaxUpperBound uses UnrollMaxUpperBound which value is 8.
+unsigned MaxUpperBound;
 /// Set the maximum unrolling factor for full unrolling. Like MaxCount, but
 /// applies even if full unrolling is selected. This allows a target to 
fall
 /// back to Partial unrolling if full unrolling is above 
FullUnrollMaxCount.
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp 
b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index f14541a1a037e6..ddc532ea24e275 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -200,6 +200,7 @@ TargetTransformInfo::UnrollingPreferences 
llvm::gatherUnrollingPreferences(
   UP.Count = 0;
   UP.DefaultUnrollRuntimeCount = 8;
   UP.MaxCount = std::numeric_limits::max();
+  UP.MaxUpperBound = UnrollMaxUpperBound; 
   UP.FullUnrollMaxCount = std::numeric_limits::max();
   UP.BEInsns = 2;
   UP.Partial = false;
@@ -237,6 +238,8 @@ TargetTransformInfo::UnrollingPreferences 
llvm::gatherUnrollingPreferences(
 UP.MaxPercentThresholdBoost = UnrollMaxPercentThresholdBoost;
   if (UnrollMaxCount.getNumOccurrences() > 0)
 UP.MaxCount = UnrollMaxCount;
+  if (UnrollMaxUpperBound.getNumOccurrences() > 0)
+UP.MaxUpperBound = UnrollMaxUpperBound;
   if (UnrollFullMaxCount.getNumOccurrences() > 0)
 UP.FullUnrollMaxCount = UnrollFullMaxCount;
   if (UnrollAllowPartial.getNumOccurrences() > 0)
@@ -777,7 +780,7 @@ shouldPragmaUnroll(Loop *L, const PragmaInfo &PInfo,
 return TripCount;
 
   if (PInfo.PragmaEnableUnroll && !TripCount && MaxTripCount &&
-  MaxTripCount <= UnrollMaxUpperBound)
+  MaxTripCount <= UP.MaxUpperBound)
 return MaxTripCount;
 
   // if didn't return until here, should continue to other priorties
@@ -952,7 +955,7 @@ bool llvm::computeUnrollCount(
   // cost of exact full unrolling.  As such, if we have an exact count and
   // found it unprofitable, we'll never chose to bounded unroll.
   if (!TripCount && MaxTripCount && (UP.UpperBound || MaxOrZero) &&
-  MaxTripCount <= UnrollMaxUpperBound) {
+  MaxTripCount <= UP.MaxUpperBound) {
 UP.Count = MaxTripCount;
 if (auto UnrollFactor = shouldFullUnroll(L, TTI, DT, SE, EphValues,
  MaxTripCount, UCE, UP)) {
@@ -1026,7 +1029,7 @@ bool llvm::computeUnrollCount(
   }
 
   // Don't unroll a small upper bound loop unless user or TTI asked to do so.
-  if (MaxTripCount && !UP.Force && MaxTripCount < UnrollMaxUpperBound) {
+  if (MaxTripCount && !UP.Force && MaxTripCount < UP.MaxUpperBound) {
 UP.Count = 0;
 return false;
   }

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan created 
https://github.com/llvm/llvm-project/pull/76030

If adding a user commands fails because a command with the same name already 
exists, we only say that "force replace is not set" without telling the user 
_how_ to set it. There are two ways to do so; this commit changes the error 
message to mention both.

>From a9a1cbc1ac42b2eb66dac8a60aa9d8f54df291c3 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Mon, 18 Dec 2023 11:26:41 -0300
Subject: [PATCH] [lldb] Add actionable feedback when overwriting a command
 fails

If adding a user commands fails because a command with the same name already
exists, we only say that "force replace is not set" without telling the user
_how_ to set it. There are two ways to do so; this commit changes the error
message to mention both.
---
 lldb/source/Interpreter/CommandInterpreter.cpp|  4 +++-
 .../API/commands/command/script/TestCommandScript.py  | 11 +++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index e1275ce711fc17..3d5ecd0612a640 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1160,7 +1160,9 @@ Status CommandInterpreter::AddUserCommand(llvm::StringRef 
name,
 
   if (UserCommandExists(name)) {
 if (!can_replace) {
-  result.SetErrorString("user command exists and force replace not set");
+  result.SetErrorString(
+  "user command exists and force replace not set by --overwrite or "
+  "'settings set interpreter.require-overwrite false'");
   return result;
 }
 if (cmd_sp->IsMultiwordObject()) {
diff --git a/lldb/test/API/commands/command/script/TestCommandScript.py 
b/lldb/test/API/commands/command/script/TestCommandScript.py
index cac11834fa7364..1e1d9b728a965d 100644
--- a/lldb/test/API/commands/command/script/TestCommandScript.py
+++ b/lldb/test/API/commands/command/script/TestCommandScript.py
@@ -161,6 +161,17 @@ def cleanup():
 )
 self.expect("my_command", substrs=["a.out"])
 
+# Test that without --overwrite we are not allowed to redefine the 
command.
+self.expect(
+"command script add my_command --class welcome.TargetnameCommand",
+substrs=[
+"cannot add command: user command exists and force replace not 
set",
+"--overwrite",
+"settings set interpreter.require-overwrite false",
+],
+error=True,
+)
+
 self.runCmd("command script clear")
 
 self.expect(

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Felipe de Azevedo Piovezan (felipepiovezan)


Changes

If adding a user commands fails because a command with the same name already 
exists, we only say that "force replace is not set" without telling the user 
_how_ to set it. There are two ways to do so; this commit changes the error 
message to mention both.

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


2 Files Affected:

- (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+3-1) 
- (modified) lldb/test/API/commands/command/script/TestCommandScript.py (+11) 


``diff
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index e1275ce711fc17..3d5ecd0612a640 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1160,7 +1160,9 @@ Status CommandInterpreter::AddUserCommand(llvm::StringRef 
name,
 
   if (UserCommandExists(name)) {
 if (!can_replace) {
-  result.SetErrorString("user command exists and force replace not set");
+  result.SetErrorString(
+  "user command exists and force replace not set by --overwrite or "
+  "'settings set interpreter.require-overwrite false'");
   return result;
 }
 if (cmd_sp->IsMultiwordObject()) {
diff --git a/lldb/test/API/commands/command/script/TestCommandScript.py 
b/lldb/test/API/commands/command/script/TestCommandScript.py
index cac11834fa7364..1e1d9b728a965d 100644
--- a/lldb/test/API/commands/command/script/TestCommandScript.py
+++ b/lldb/test/API/commands/command/script/TestCommandScript.py
@@ -161,6 +161,17 @@ def cleanup():
 )
 self.expect("my_command", substrs=["a.out"])
 
+# Test that without --overwrite we are not allowed to redefine the 
command.
+self.expect(
+"command script add my_command --class welcome.TargetnameCommand",
+substrs=[
+"cannot add command: user command exists and force replace not 
set",
+"--overwrite",
+"settings set interpreter.require-overwrite false",
+],
+error=True,
+)
+
 self.runCmd("command script clear")
 
 self.expect(

``




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


[Lldb-commits] [lldb] d14d521 - [lldb][test] Add extra logging for module cache test

2023-12-20 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-20T09:41:33Z
New Revision: d14d52158bc444e2d036067305cf54aeea7c9edb

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

LOG: [lldb][test] Add extra logging for module cache test

And remove the workaround I was trying, as this logging may prove what
the actual issue is.

Which I think is that the thread plan map in Process is cleared before
the threads are destroyed. So Thread::ShouldStop could be getting
the current plan, then the plan map is cleared, then Thread::ShouldStop
is deciding based on that plan to pop a plan from the now empty stack.

Added: 


Modified: 
lldb/source/Target/Thread.cpp
lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py

Removed: 




diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 865cee97e6d878..cbfb323f6d9271 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -883,6 +883,18 @@ bool Thread::ShouldStop(Event *event_ptr) {
   // If a Controlling Plan wants to stop, we let it. Otherwise, see if
   // the plan's parent wants to stop.
 
+  // Temporary logging to figure out a crash on Arm/AArch64 Linux.
+  {
+LLDB_LOGF(log, " Thread::ShouldStop plan stack before "
+   "PopPlan ");
+StreamString s;
+s.IndentMore();
+GetProcess()->DumpThreadPlansForTID(
+s, GetID(), eDescriptionLevelVerbose, true /* internal */,
+false /* condense_trivial */, true /* skip_unreported */);
+LLDB_LOG(log, s.GetData());
+  }
+
   PopPlan();
   if (should_stop && current_plan->IsControllingPlan() &&
   !current_plan->OkayToDiscard()) {

diff  --git 
a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py 
b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index cc9da15b566c25..aacfb92735b331 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -34,6 +34,10 @@ def copy_to_main(self, src, dst):
 # The rerun tests indicate rerunning on Windows doesn't really work, so
 # this one won't either.
 @skipIfWindows
+# On Arm and AArch64 Linux, this test attempts to pop a thread plan when
+# we only have the base plan remaining. Skip it until we can figure out
+# the bug this is exposing.
+@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 def test_OneTargetOneDebugger(self):
 self.do_test(True, True)
 
@@ -50,6 +54,11 @@ def test_OneTargetTwoDebuggers(self):
 self.do_test(True, False)
 
 def do_test(self, one_target, one_debugger):
+# Here to debug flakiness on Arm, remove later!
+log_cmd_result = lldb.SBCommandReturnObject()
+interp = self.dbg.GetCommandInterpreter()
+interp.HandleCommand("log enable lldb step", log_cmd_result)
+
 # Make sure that if we have one target, and we run, then
 # change the binary and rerun, the binary (and any .o files
 # if using dwarf in .o file debugging) get removed from the
@@ -100,13 +109,6 @@ def do_test(self, one_target, one_debugger):
 self.old_debugger = self.dbg
 self.dbg = new_debugger
 def cleanupDebugger(self):
-# On Arm and AArch64 Linux, it is suspected that destroying
-# the debugger first causes lldb to try to pop from an 
empty
-# thread plan stack. Try to prove this by killing the 
process
-# first.
-for i in range(self.dbg.GetNumTargets()):
-self.dbg.GetTargetAtIndex(i).GetProcess().Kill()
-
 lldb.SBDebugger.Destroy(self.dbg)
 self.dbg = self.old_debugger
 self.old_debugger = None



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


[Lldb-commits] [lldb] 01c4ecb - [lldb][test] Remove Arm/AArch64 Linux skip for global modules test

2023-12-20 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-20T09:42:07Z
New Revision: 01c4ecb7ae21a61312ff0c0176c0ab9f8656c159

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

LOG: [lldb][test] Remove Arm/AArch64 Linux skip for global modules test

So we can see it failing and get the extra logged information.

Added: 


Modified: 
lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py

Removed: 




diff  --git 
a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py 
b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index aacfb92735b331..b8675532e6394f 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -34,10 +34,6 @@ def copy_to_main(self, src, dst):
 # The rerun tests indicate rerunning on Windows doesn't really work, so
 # this one won't either.
 @skipIfWindows
-# On Arm and AArch64 Linux, this test attempts to pop a thread plan when
-# we only have the base plan remaining. Skip it until we can figure out
-# the bug this is exposing.
-@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 def test_OneTargetOneDebugger(self):
 self.do_test(True, True)
 



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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread David Spickett via lldb-commits


@@ -1160,7 +1160,9 @@ Status CommandInterpreter::AddUserCommand(llvm::StringRef 
name,
 
   if (UserCommandExists(name)) {
 if (!can_replace) {
-  result.SetErrorString("user command exists and force replace not set");
+  result.SetErrorString(
+  "user command exists and force replace not set by --overwrite or "

DavidSpickett wrote:

Can we include the name of the command and "already" here, for example:
```
user command "foo" already exists and force replace not
```

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread David Spickett via lldb-commits


@@ -1160,7 +1160,9 @@ Status CommandInterpreter::AddUserCommand(llvm::StringRef 
name,
 
   if (UserCommandExists(name)) {
 if (!can_replace) {
-  result.SetErrorString("user command exists and force replace not set");
+  result.SetErrorString(
+  "user command exists and force replace not set by --overwrite or "

DavidSpickett wrote:

Also "was not set by" ? (adding "was")

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread David Spickett via lldb-commits


@@ -161,6 +161,17 @@ def cleanup():
 )
 self.expect("my_command", substrs=["a.out"])
 
+# Test that without --overwrite we are not allowed to redefine the 
command.
+self.expect(
+"command script add my_command --class welcome.TargetnameCommand",
+substrs=[
+"cannot add command: user command exists and force replace not 
set",
+"--overwrite",
+"settings set interpreter.require-overwrite false",

DavidSpickett wrote:

You could just check for the start of it if you're trying to save being verbose 
here. There's only one place the error message is generated, so if we have the 
start we have the end.

Or just check for the whole thing, it's not much more effort. If you want to be 
sure anyone updating the message later knows that this test exists and maybe 
needs updating.

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-20 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett updated 
https://github.com/llvm/llvm-project/pull/75927

>From a7770da9e2a997eefced82b9ebb305b464fec70d Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Tue, 19 Dec 2023 12:46:54 +
Subject: [PATCH] [lldb][DWARF] Searchfor symbols in all external modules

The way this code was updated in dd9587795811ba21e6ca6ad52b4531e17e6babd6
meant that if the first module did not have the symbol, the iteration stopped
as returning true means stop. So only if every module had the symbol would we 
find it,
in the last module.

Invert the condition to break when we find the first instance,
which is what the previous code did.
---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 334876620249fc..3e08f2550081f2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -175,7 +175,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const 
SymbolContext &sc,
 *sc.comp_unit, results.GetSearchedSymbolFiles(), [&](Module &module) {
   module.FindTypes(query, results);
   pcm_type_sp = results.GetTypeMap().FirstType();
-  return !pcm_type_sp;
+  return (bool)pcm_type_sp;
 });
   }
 

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-20 Thread David Spickett via lldb-commits


@@ -175,7 +175,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const 
SymbolContext &sc,
 *sc.comp_unit, results.GetSearchedSymbolFiles(), [&](Module &module) {
   module.FindTypes(query, results);
   pcm_type_sp = results.GetTypeMap().FirstType();
-  return !pcm_type_sp;
+  return pcm_type_sp != nullptr;

DavidSpickett wrote:

Done.

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


[Lldb-commits] [lld] [llvm] [libc] [clang] [clang-tools-extra] [lldb] [compiler-rt] [libcxx] [mlir] [flang] Don't emit relax relocs like R_X86_64_REX_GOTPCRELX on X86 target for OPENMP internal vars.

2023-12-20 Thread via lldb-commits

https://github.com/UmeshKalappa0 updated 
https://github.com/llvm/llvm-project/pull/75564

>From 4125e4a709c594562fa6c52f045ba7442e3cb523 Mon Sep 17 00:00:00 2001
From: Umesh Kalappa 
Date: Fri, 15 Dec 2023 11:52:52 +0530
Subject: [PATCH 1/4] Problem :For Kernel Modules ,emitting the relocs like
 R_X86_64_REX_GOTPCRELX  for the OPENMP internal vars like
 https://godbolt.org/z/hhh7ozojz.

Solution : Mark the OpenMP internal variables with dso_local
conditionally for no-pic and no-pie ,then
a)reset the dso_local for thread_local and weak linkage vars.
---
 .../test/OpenMP/gomp_critical_dso_local_var.c | 23 +++
 1 file changed, 23 insertions(+)
 create mode 100644 clang/test/OpenMP/gomp_critical_dso_local_var.c

diff --git a/clang/test/OpenMP/gomp_critical_dso_local_var.c 
b/clang/test/OpenMP/gomp_critical_dso_local_var.c
new file mode 100644
index 00..915f6773bf67bf
--- /dev/null
+++ b/clang/test/OpenMP/gomp_critical_dso_local_var.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fopenmp -x c -emit-llvm %s -o - | FileCheck %s 
--check-prefix=DSO_LOCAL
+
+// DSO_LOCAL-DAG: @.gomp_critical_user_.var = common dso_local global [8 x 
i32] zeroinitializer, align 8
+int omp_critical_test()
+{
+  int sum;
+  int known_sum;
+
+  sum=0;
+#pragma omp parallel
+  {
+int mysum=0;
+int i;
+#pragma omp for
+for (i = 0; i < 1000; i++)
+  mysum = mysum + i;
+#pragma omp critical
+sum = mysum +sum;
+  }
+  known_sum = 999 * 1000 / 2;
+  return (known_sum == sum);
+}
+

>From 842245de490ab15f8a901b94576ae4539c760e1e Mon Sep 17 00:00:00 2001
From: Umesh Kalappa 
Date: Fri, 15 Dec 2023 12:49:48 +0530
Subject: [PATCH 2/4] testcases are changed accordignly.

---
 clang/lib/CodeGen/CGOpenMPRuntime.cpp   | 2 ++
 clang/test/OpenMP/critical_codegen.cpp  | 6 +++---
 clang/test/OpenMP/critical_codegen_attr.cpp | 6 +++---
 clang/test/OpenMP/for_reduction_codegen.cpp | 8 
 clang/test/OpenMP/gomp_critical_dso_local_var.c | 1 -
 clang/test/OpenMP/simd_codegen.cpp  | 4 ++--
 llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp   | 8 
 7 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 7f7e6f53066644..183c757d72b8a7 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1793,6 +1793,8 @@ Address 
CGOpenMPRuntime::getAddrOfArtificialThreadPrivate(CodeGenFunction &CGF,
   if (CGM.getLangOpts().OpenMP && CGM.getLangOpts().OpenMPUseTLS &&
   CGM.getTarget().isTLSSupported()) {
 GAddr->setThreadLocal(/*Val=*/true);
+/// reset the dso_local for thread_local.
+GAddr->setDSOLocal(/*Val=*/false);
 return Address(GAddr, GAddr->getValueType(),
CGM.getContext().getTypeAlignInChars(VarType));
   }
diff --git a/clang/test/OpenMP/critical_codegen.cpp 
b/clang/test/OpenMP/critical_codegen.cpp
index 24145d44d962e5..9a613161ac294a 100644
--- a/clang/test/OpenMP/critical_codegen.cpp
+++ b/clang/test/OpenMP/critical_codegen.cpp
@@ -16,9 +16,9 @@
 #define HEADER
 
 // ALL:   [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, ptr }
-// ALL:   [[UNNAMED_LOCK:@.+]] = common global [8 x i32] zeroinitializer
-// ALL:   [[THE_NAME_LOCK:@.+]] = common global [8 x i32] zeroinitializer
-// ALL:   [[THE_NAME_LOCK1:@.+]] = common global [8 x i32] zeroinitializer
+// ALL:   [[UNNAMED_LOCK:@.+]] = common dso_local global [8 x i32] 
zeroinitializer
+// ALL:   [[THE_NAME_LOCK:@.+]] = common dso_local global [8 x i32] 
zeroinitializer
+// ALL:   [[THE_NAME_LOCK1:@.+]] = common dso_local global [8 x i32] 
zeroinitializer
 
 // ALL:   define {{.*}}void [[FOO:@.+]]()
 
diff --git a/clang/test/OpenMP/critical_codegen_attr.cpp 
b/clang/test/OpenMP/critical_codegen_attr.cpp
index 34d90a9e3a6e48..5f1a76e2ad0f1f 100644
--- a/clang/test/OpenMP/critical_codegen_attr.cpp
+++ b/clang/test/OpenMP/critical_codegen_attr.cpp
@@ -16,9 +16,9 @@
 #define HEADER
 
 // ALL:   [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, ptr }
-// ALL:   [[UNNAMED_LOCK:@.+]] = common global [8 x i32] zeroinitializer
-// ALL:   [[THE_NAME_LOCK:@.+]] = common global [8 x i32] zeroinitializer
-// ALL:   [[THE_NAME_LOCK1:@.+]] = common global [8 x i32] zeroinitializer
+// ALL:   [[UNNAMED_LOCK:@.+]] = common dso_local global [8 x i32] 
zeroinitializer
+// ALL:   [[THE_NAME_LOCK:@.+]] = common dso_local global [8 x i32] 
zeroinitializer
+// ALL:   [[THE_NAME_LOCK1:@.+]] = common dso_local global [8 x i32] 
zeroinitializer
 
 // ALL:   define {{.*}}void [[FOO:@.+]]()
 
diff --git a/clang/test/OpenMP/for_reduction_codegen.cpp 
b/clang/test/OpenMP/for_reduction_codegen.cpp
index 893c606f8d7b9f..b128bd5d79c251 100644
--- a/clang/test/OpenMP/for_reduction_codegen.cpp
+++ b/clang/test/OpenMP/for_reduction_codegen.cpp
@@ -528,12 +528,12 @@ int main() {
 
 #endif
 //.
-// CHECK1: @.gomp_critical_user_.red

[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -161,6 +161,17 @@ def cleanup():
 )
 self.expect("my_command", substrs=["a.out"])
 
+# Test that without --overwrite we are not allowed to redefine the 
command.
+self.expect(
+"command script add my_command --class welcome.TargetnameCommand",
+substrs=[
+"cannot add command: user command exists and force replace not 
set",
+"--overwrite",
+"settings set interpreter.require-overwrite false",

felipepiovezan wrote:

My original intent was to test that "overwrite" and "settings set..." were 
mentioned mentioned _somewhere_ in the message, without having to change the 
test in case someone tweaks the fine print in the future. But I'll update it 
and just check the whole message, one can argue that if someone changes the 
fine print it should cause the test to fail.

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -1160,7 +1160,9 @@ Status CommandInterpreter::AddUserCommand(llvm::StringRef 
name,
 
   if (UserCommandExists(name)) {
 if (!can_replace) {
-  result.SetErrorString("user command exists and force replace not set");
+  result.SetErrorString(
+  "user command exists and force replace not set by --overwrite or "

felipepiovezan wrote:

Yup, good suggestions, I'll update it!

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan updated 
https://github.com/llvm/llvm-project/pull/76030

>From a9a1cbc1ac42b2eb66dac8a60aa9d8f54df291c3 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Mon, 18 Dec 2023 11:26:41 -0300
Subject: [PATCH 1/2] [lldb] Add actionable feedback when overwriting a command
 fails

If adding a user commands fails because a command with the same name already
exists, we only say that "force replace is not set" without telling the user
_how_ to set it. There are two ways to do so; this commit changes the error
message to mention both.
---
 lldb/source/Interpreter/CommandInterpreter.cpp|  4 +++-
 .../API/commands/command/script/TestCommandScript.py  | 11 +++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index e1275ce711fc17..3d5ecd0612a640 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1160,7 +1160,9 @@ Status CommandInterpreter::AddUserCommand(llvm::StringRef 
name,
 
   if (UserCommandExists(name)) {
 if (!can_replace) {
-  result.SetErrorString("user command exists and force replace not set");
+  result.SetErrorString(
+  "user command exists and force replace not set by --overwrite or "
+  "'settings set interpreter.require-overwrite false'");
   return result;
 }
 if (cmd_sp->IsMultiwordObject()) {
diff --git a/lldb/test/API/commands/command/script/TestCommandScript.py 
b/lldb/test/API/commands/command/script/TestCommandScript.py
index cac11834fa7364..1e1d9b728a965d 100644
--- a/lldb/test/API/commands/command/script/TestCommandScript.py
+++ b/lldb/test/API/commands/command/script/TestCommandScript.py
@@ -161,6 +161,17 @@ def cleanup():
 )
 self.expect("my_command", substrs=["a.out"])
 
+# Test that without --overwrite we are not allowed to redefine the 
command.
+self.expect(
+"command script add my_command --class welcome.TargetnameCommand",
+substrs=[
+"cannot add command: user command exists and force replace not 
set",
+"--overwrite",
+"settings set interpreter.require-overwrite false",
+],
+error=True,
+)
+
 self.runCmd("command script clear")
 
 self.expect(

>From 8b278f99e84dc7cc6edb316a203091d4b79915fa Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Wed, 20 Dec 2023 08:02:15 -0300
Subject: [PATCH 2/2] fixup! [lldb] Add actionable feedback when overwriting a
 command fails

---
 lldb/source/Interpreter/CommandInterpreter.cpp| 8 +---
 .../test/API/commands/command/script/TestCommandScript.py | 8 +---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index 3d5ecd0612a640..00651df48b6224 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1160,9 +1160,11 @@ Status 
CommandInterpreter::AddUserCommand(llvm::StringRef name,
 
   if (UserCommandExists(name)) {
 if (!can_replace) {
-  result.SetErrorString(
-  "user command exists and force replace not set by --overwrite or "
-  "'settings set interpreter.require-overwrite false'");
+  result.SetErrorStringWithFormatv(
+  "user command \"{0}\" already exists and force replace was not set "
+  "by --overwrite or 'settings set interpreter.require-overwrite "
+  "false'",
+  name);
   return result;
 }
 if (cmd_sp->IsMultiwordObject()) {
diff --git a/lldb/test/API/commands/command/script/TestCommandScript.py 
b/lldb/test/API/commands/command/script/TestCommandScript.py
index 1e1d9b728a965d..850552032902fd 100644
--- a/lldb/test/API/commands/command/script/TestCommandScript.py
+++ b/lldb/test/API/commands/command/script/TestCommandScript.py
@@ -165,9 +165,11 @@ def cleanup():
 self.expect(
 "command script add my_command --class welcome.TargetnameCommand",
 substrs=[
-"cannot add command: user command exists and force replace not 
set",
-"--overwrite",
-"settings set interpreter.require-overwrite false",
+(
+'user command "my_command" already exists and force 
replace was'
+" not set by --overwrite or 'settings set"
+" interpreter.require-overwrite false'"
+),
 ],
 error=True,
 )

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

Address review comments

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -161,6 +161,19 @@ def cleanup():
 )
 self.expect("my_command", substrs=["a.out"])
 
+# Test that without --overwrite we are not allowed to redefine the 
command.
+self.expect(
+"command script add my_command --class welcome.TargetnameCommand",
+substrs=[
+(
+'user command "my_command" already exists and force 
replace was'
+" not set by --overwrite or 'settings set"
+" interpreter.require-overwrite false'"
+),
+],
+error=True,

felipepiovezan wrote:

this is the format I got from the `black` tool...

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


[Lldb-commits] [lldb] 83f8cae - [lldb][test] Skip runlocker test on AArch64 Linux

2023-12-20 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-20T11:05:52Z
New Revision: 83f8caeab476646eea21bdde619b0beb84ebd70b

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

LOG: [lldb][test] Skip runlocker test on AArch64 Linux

This has been flaky for a while, for example
https://lab.llvm.org/buildbot/#/builders/96/builds/50350

```
Command Output (stdout):
--
lldb version 18.0.0git (https://github.com/llvm/llvm-project.git revision 
3974d89bde66a2ec61261b969b51993da81205c7)
  clang revision 3974d89bde66a2ec61261b969b51993da81205c7
  llvm revision 3974d89bde66a2ec61261b969b51993da81205c7
"can't evaluate expressions when the process is running."
```

```
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ 
and include the crash backtrace.
   #0 0xa46191a0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x529a1a0)
   #1 0xa4617144 llvm::sys::RunSignalHandlers() 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x5298144)
   #2 0xa46198d0 SignalHandler(int) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x529a8d0)
   #3 0xab25b7dc (linux-vdso.so.1+0x7dc)
   #4 0xab13d050 
/build/glibc-Q8DG8B/glibc-2.31/string/../sysdeps/aarch64/multiarch/memcpy_advsimd.S:92:0
   #5 0xa446f420 
lldb_private::process_gdb_remote::GDBRemoteRegisterContext::PrivateSetRegisterValue(unsigned
 int, llvm::ArrayRef) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x50f0420)
   #6 0xa446f7b8 
lldb_private::process_gdb_remote::GDBRemoteRegisterContext::GetPrimordialRegister(lldb_private::RegisterInfo
 const*, lldb_private::process_gdb_remote::GDBRemoteCommunicationClient&) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x50f07b8)
   #7 0xa446f308 
lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegisterBytes(lldb_private::RegisterInfo
 const*) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x50f0308)
   #8 0xa446ec1c 
lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegister(lldb_private::RegisterInfo
 const*, lldb_private::RegisterValue&) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x50efc1c)
   #9 0xa412eaa4 
lldb_private::RegisterContext::ReadRegisterAsUnsigned(lldb_private::RegisterInfo
 const*, unsigned long) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x4dafaa4)
  #10 0xa420861c 
ReadLinuxProcessAddressMask(std::shared_ptr, 
llvm::StringRef) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x4e8961c)
  #11 0xa4208430 ABISysV_arm64::FixCodeAddress(unsigned long) 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x4e89430)
```

Judging by the backtrace something is trying to read the pointer authentication 
address/code mask
registers. This explains why I've not seen this issue locally, as the buildbot 
runs on Graviton
3 with has the pointer authentication extension.

I will try to reproduce, fix and re-enable the test.

Added: 


Modified: 
lldb/test/API/python_api/run_locker/TestRunLocker.py

Removed: 




diff  --git a/lldb/test/API/python_api/run_locker/TestRunLocker.py 
b/lldb/test/API/python_api/run_locker/TestRunLocker.py
index 7604754fff5763..10832840ac0955 100644
--- a/lldb/test/API/python_api/run_locker/TestRunLocker.py
+++ b/lldb/test/API/python_api/run_locker/TestRunLocker.py
@@ -21,6 +21,8 @@ def test_run_locker(self):
 self.runlocker_test(False)
 
 @expectedFailureAll(oslist=["windows"])
+# Is flaky on Linux AArch64 buildbot.
+@skipIf(oslist=["linux"], archs=["aarch64"])
 def test_run_locker_stop_at_entry(self):
 """Test that the run locker is set correctly when we launch"""
 self.build()



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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread David Spickett via lldb-commits


@@ -161,6 +161,19 @@ def cleanup():
 )
 self.expect("my_command", substrs=["a.out"])
 
+# Test that without --overwrite we are not allowed to redefine the 
command.
+self.expect(
+"command script add my_command --class welcome.TargetnameCommand",
+substrs=[
+(
+'user command "my_command" already exists and force 
replace was'
+" not set by --overwrite or 'settings set"
+" interpreter.require-overwrite false'"
+),
+],
+error=True,

DavidSpickett wrote:

I welcome our new robot formatting overlords, even if they do strange things 
sometimes. Iirc it uses `"` if there is `'` in the string and vice versa, 
instead of `"""`.

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread David Spickett via lldb-commits

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

LGTM

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


[Lldb-commits] [llvm] [lldb] [clang-tools-extra] [flang] [clang] [IndVars] Add check of loop invariant for trunc instructions (PR #71072)

2023-12-20 Thread Markos Horro via lldb-commits

markoshorro wrote:

@fhahn yeah, thanks. I'm investigating this.

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


[Lldb-commits] [llvm] [lldb] [clang-tools-extra] [flang] [clang] [IndVars] Add check of loop invariant for trunc instructions (PR #71072)

2023-12-20 Thread Florian Hahn via lldb-commits

fhahn wrote:

@markoshorro Great thanks. Please revert the patch if you won't be able to fix 
this today.

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


[Lldb-commits] [lldb] a8af51d - [lldb][test] Skip global module cache on Arm/AArch64 Linux (again)

2023-12-20 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-20T13:56:40Z
New Revision: a8af51dfa54c4d66a25fafb79dd8fbf00c98be59

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

LOG: [lldb][test] Skip global module cache on Arm/AArch64 Linux (again)

This reverts commit 01c4ecb7ae21a61312ff0c0176c0ab9f8656c159,
d14d52158bc444e2d036067305cf54aeea7c9edb and
a756dc4724a279d76898bacd054a04832b02caa8.

This removes the logging and workaround I added earlier,
and puts back the skip for Arm/AArch64 Linux.

I've not seen it fail on AArch64 since, but let's not create
more noise if it does.

I've written up the issue as https://github.com/llvm/llvm-project/issues/76057.
It's something to do with trying to destroy a process while
a thread is doing a single sep. So my workaround wouldn't have
worked in any case. It needs a more involved fix.

Added: 


Modified: 
lldb/source/Target/Thread.cpp
lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py

Removed: 




diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index cbfb323f6d9271..865cee97e6d878 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -883,18 +883,6 @@ bool Thread::ShouldStop(Event *event_ptr) {
   // If a Controlling Plan wants to stop, we let it. Otherwise, see if
   // the plan's parent wants to stop.
 
-  // Temporary logging to figure out a crash on Arm/AArch64 Linux.
-  {
-LLDB_LOGF(log, " Thread::ShouldStop plan stack before "
-   "PopPlan ");
-StreamString s;
-s.IndentMore();
-GetProcess()->DumpThreadPlansForTID(
-s, GetID(), eDescriptionLevelVerbose, true /* internal */,
-false /* condense_trivial */, true /* skip_unreported */);
-LLDB_LOG(log, s.GetData());
-  }
-
   PopPlan();
   if (should_stop && current_plan->IsControllingPlan() &&
   !current_plan->OkayToDiscard()) {

diff  --git 
a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py 
b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index b8675532e6394f..6bb22c46efb443 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -34,6 +34,10 @@ def copy_to_main(self, src, dst):
 # The rerun tests indicate rerunning on Windows doesn't really work, so
 # this one won't either.
 @skipIfWindows
+# On Arm and AArch64 Linux, this test attempts to pop a thread plan when
+# we only have the base plan remaining. Skip it until we can figure out
+# the bug this is exposing 
(https://github.com/llvm/llvm-project/issues/76057).
+@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 def test_OneTargetOneDebugger(self):
 self.do_test(True, True)
 
@@ -50,11 +54,6 @@ def test_OneTargetTwoDebuggers(self):
 self.do_test(True, False)
 
 def do_test(self, one_target, one_debugger):
-# Here to debug flakiness on Arm, remove later!
-log_cmd_result = lldb.SBCommandReturnObject()
-interp = self.dbg.GetCommandInterpreter()
-interp.HandleCommand("log enable lldb step", log_cmd_result)
-
 # Make sure that if we have one target, and we run, then
 # change the binary and rerun, the binary (and any .o files
 # if using dwarf in .o file debugging) get removed from the



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


[Lldb-commits] [lldb] Add a test for evicting unreachable modules from the global module cache (PR #74894)

2023-12-20 Thread David Spickett via lldb-commits

DavidSpickett wrote:

The problem will require a more involved fix I think, I've written up the 
details in https://github.com/llvm/llvm-project/issues/76057.

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


[Lldb-commits] [lldb] 7767c58 - [lldb][DWARF] Search for symbols in all external modules (#75927)

2023-12-20 Thread via lldb-commits

Author: David Spickett
Date: 2023-12-20T14:48:01Z
New Revision: 7767c5856d85cd1acf2efc32f77fdf07f00f9ff4

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

LOG: [lldb][DWARF] Search for symbols in all external modules (#75927)

The way this code was updated in
dd9587795811ba21e6ca6ad52b4531e17e6babd6 meant that if the first module
did not have the symbol, the iteration stopped as returning true means
stop. So only if every module had the symbol would we find it, in the
last module.

Invert the condition to break when we find the first instance, which is
what the previous code did.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 334876620249fc..3e08f2550081f2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -175,7 +175,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const 
SymbolContext &sc,
 *sc.comp_unit, results.GetSearchedSymbolFiles(), [&](Module &module) {
   module.FindTypes(query, results);
   pcm_type_sp = results.GetTypeMap().FirstType();
-  return !pcm_type_sp;
+  return (bool)pcm_type_sp;
 });
   }
 



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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-20 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-20 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Didn't want to leave this broken over the holiday break so I've merged it as 
obvious.

I would still like to add a test so if @adrian-prantl or anyone else can tell 
me how to write one, I'll do that as a follow up. Need some clues as I've not 
used modules before.

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


[Lldb-commits] [clang-tools-extra] [clang] [llvm] [mlir] [lldb] [compiler-rt] [lld] [flang] [libcxx] [builtins][arm64] Implement __init_cpu_features_resolver on Apple platforms (PR #75636)

2023-12-20 Thread Pavel Iliin via lldb-commits


@@ -0,0 +1,69 @@
+#include 
+#if TARGET_OS_OSX || TARGET_OS_IPHONE
+#include 
+#include 
+
+static bool isKnownAndSupported(const char *name) {
+  int32_t val = 0;
+  size_t size = sizeof(val);
+  if (sysctlbyname(name, &val, &size, NULL, 0))
+return false;
+  return val;
+}
+
+void __init_cpu_features_resolver(void) {
+  // On Darwin platforms, this may be called concurrently by multiple threads
+  // because the resolvers that use it are called lazily at runtime (unlike on
+  // ELF platforms, where IFuncs are resolved serially at load time).  This
+  // function's effect on __aarch64_cpu_features should be idempotent, but even
+  // so we need dispatch_once to resolve the race condition.  Dispatch is
+  // available through libSystem, which we need anyway for the sysctl, so this
+  // does not add a new dependency.
+
+  static dispatch_once_t onceToken = 0;
+  dispatch_once(&onceToken, ^{
+// 
https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics
+static struct {
+  const char *sysctl_name;
+  enum CPUFeatures feature;
+} features[] = {

ilinpv wrote:

> Any word on when FMV might come out of beta?

There's no specific deadline right now, possibly within a year or half - we 
want to collect and address all feedback on FMV from partners and compilers 
communities.


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


[Lldb-commits] [flang] [lld] [libcxx] [clang] [lldb] [mlir] [llvm] [compiler-rt] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-20 Thread Jon Roelofs via lldb-commits

jroelofs wrote:

@petrhosek I don't have a Fucshia sysroot to build this against, so I think it 
would help me a lot if you could grab the preprocessed version of the 
`cpu_model.c` before all these changes and stick it in a github gist... I feel 
a little bad for dragging this out in-tree.

> These #if __has_include(...) conditionals would evaluate to false on Fuchsia 
> since we don't have those headers, but they have been moved in the refactored 
> version.

In that case, if I'm reading it correctly, all of the `#if 
defined(__Fuchsia__)` support for both initializing the LSE atomics detection 
bool, and FMV in `cpu_model.c` are dead code, and we can drop those entries in 
the new `aarch64.c`.



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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Remove 2nd "error: " substring in output to developer (PR #72150)

2023-12-20 Thread Pete Lawrence via lldb-commits

PortalPete wrote:

My apologies.
I renamed the branch and apparently that's GitHub's cue to close all the PRs 
coming from that branch.

In this case, it's probably for the best because we decided to break this up 
into 2-3 PRs.

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


[Lldb-commits] [lldb] [lldb] In-progress — All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-20 Thread Pete Lawrence via lldb-commits

PortalPete wrote:

My apologies.
I renamed the branch and apparently that's GitHub's cue to close all the PRs 
coming from that branch.

I'll recreate the PR but please feel free to ask questions and make suggestions 
here in the meantime. I'll post the replacement PR when it's up.

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


[Lldb-commits] [lldb] [lldb] Add actionable feedback when overwriting a command fails (PR #76030)

2023-12-20 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] Add a test for evicting unreachable modules from the global module cache (PR #74894)

2023-12-20 Thread via lldb-commits

jimingham wrote:

This can happen if you don't succeed in shutting down the private state thread 
as part of exiting, so that it is still trying to operate on a process that has 
been finalized.

Not sure why the shutdown ordering seems wrong in the Linux case, however.

Jim


> On Dec 15, 2023, at 1:39 AM, David Spickett ***@***.***> wrote:
> 
> 
> Though the original assert was: m_plans.size() > 1 && "Can't pop the base 
> thread plan"
> 
> Not that there was exactly 1 plan on the stack. So current_plan might be the 
> single step plan as expected, then when we go to pop that off the stack, but 
> the stack has been emptied/destroyed already.
> 
> —
> Reply to this email directly, view it on GitHub 
> , or 
> unsubscribe 
> .
> You are receiving this because you modified the open/close state.
> 



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


[Lldb-commits] [lldb] [lldb] Remove redundant severity substring within a diagnostic message. (PR #76111)

2023-12-20 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete created 
https://github.com/llvm/llvm-project/pull/76111

For example, the following message has the severity string "error: " twice.
> "error: :3:1: error: cannot find 'bogus' in scope

This method already appends the severity string in the beginning, but with this 
fix, it also removes a secondary instance, if applicable.

Note that this change only removes the *first* redundant substring. I 
considered putting the removal logic in a loop, but I decided that if something 
is generating more than one redundant severity substring, then that's a problem 
the message's source should probably fix.

rdar://114203423

>From dde9d02277fac978201fbd4cb0afc07bc6781185 Mon Sep 17 00:00:00 2001
From: Pete Lawrence 
Date: Tue, 19 Dec 2023 19:25:36 -1000
Subject: [PATCH] [lldb] Remove redundant severity substring within a
 diagnostic message.

For example, the following message has the severity string "error: " twice.
> "error: :3:1: error: cannot find 'bogus' in scope

This method already appends the severity string in the beginning, but with this 
fix, it also removes a secondary instance, if applicable.

Note that this change only removes the *first* redundant substring. I 
considered putting the removal logic in a loop, but I decided that if something 
is generating more than one redundant severity substring, then that's a problem 
the message's source should probably fix.

rdar://114203423
---
 lldb/source/Expression/DiagnosticManager.cpp| 13 +++--
 .../TestModulesCompileError.py  |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Expression/DiagnosticManager.cpp 
b/lldb/source/Expression/DiagnosticManager.cpp
index 08977066e3330a..d9452328e5a27f 100644
--- a/lldb/source/Expression/DiagnosticManager.cpp
+++ b/lldb/source/Expression/DiagnosticManager.cpp
@@ -48,8 +48,17 @@ std::string DiagnosticManager::GetString(char separator) {
   std::string ret;
 
   for (const auto &diagnostic : Diagnostics()) {
-ret.append(StringForSeverity(diagnostic->GetSeverity()));
-ret.append(std::string(diagnostic->GetMessage()));
+std::string message(diagnostic->GetMessage());
+std::string searchable_message(diagnostic->GetMessage().lower());
+std::string severity(StringForSeverity(diagnostic->GetSeverity()));
+
+// Erase the (first) reduntant severity string in the message.
+size_t position = searchable_message.find(severity);
+if (position != std::string::npos)
+  message.erase(position, severity.length());
+
+ret.append(severity);
+ret.append(message);
 ret.push_back(separator);
   }
 
diff --git 
a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py 
b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
index 36e302be2525b5..620b6e44fc852a 100644
--- a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
+++ b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
@@ -21,7 +21,7 @@ def test(self):
 "expr @import LLDBTestModule",
 error=True,
 substrs=[
-"module.h:4:1: error: use of undeclared identifier 
'syntax_error_for_lldb_to_find'",
+"module.h:4:1: use of undeclared identifier 
'syntax_error_for_lldb_to_find'",
 "syntax_error_for_lldb_to_find // comment that tests source 
printing",
 "could not build module 'LLDBTestModule'",
 ],

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


[Lldb-commits] [lldb] [lldb] Remove redundant severity substring within a diagnostic message. (PR #76111)

2023-12-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pete Lawrence (PortalPete)


Changes

For example, the following message has the severity string "error: " twice.
> "error: :3:1: error: cannot find 'bogus' in scope

This method already appends the severity string in the beginning, but with this 
fix, it also removes a secondary instance, if applicable.

Note that this change only removes the *first* redundant substring. I 
considered putting the removal logic in a loop, but I decided that if something 
is generating more than one redundant severity substring, then that's a problem 
the message's source should probably fix.

rdar://114203423

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


2 Files Affected:

- (modified) lldb/source/Expression/DiagnosticManager.cpp (+11-2) 
- (modified) 
lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py (+1-1) 


``diff
diff --git a/lldb/source/Expression/DiagnosticManager.cpp 
b/lldb/source/Expression/DiagnosticManager.cpp
index 08977066e3330a..d9452328e5a27f 100644
--- a/lldb/source/Expression/DiagnosticManager.cpp
+++ b/lldb/source/Expression/DiagnosticManager.cpp
@@ -48,8 +48,17 @@ std::string DiagnosticManager::GetString(char separator) {
   std::string ret;
 
   for (const auto &diagnostic : Diagnostics()) {
-ret.append(StringForSeverity(diagnostic->GetSeverity()));
-ret.append(std::string(diagnostic->GetMessage()));
+std::string message(diagnostic->GetMessage());
+std::string searchable_message(diagnostic->GetMessage().lower());
+std::string severity(StringForSeverity(diagnostic->GetSeverity()));
+
+// Erase the (first) reduntant severity string in the message.
+size_t position = searchable_message.find(severity);
+if (position != std::string::npos)
+  message.erase(position, severity.length());
+
+ret.append(severity);
+ret.append(message);
 ret.push_back(separator);
   }
 
diff --git 
a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py 
b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
index 36e302be2525b5..620b6e44fc852a 100644
--- a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
+++ b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
@@ -21,7 +21,7 @@ def test(self):
 "expr @import LLDBTestModule",
 error=True,
 substrs=[
-"module.h:4:1: error: use of undeclared identifier 
'syntax_error_for_lldb_to_find'",
+"module.h:4:1: use of undeclared identifier 
'syntax_error_for_lldb_to_find'",
 "syntax_error_for_lldb_to_find // comment that tests source 
printing",
 "could not build module 'LLDBTestModule'",
 ],

``




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


[Lldb-commits] [lldb] [lldb] Remove redundant severity substring within a diagnostic message. (PR #76111)

2023-12-20 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete updated 
https://github.com/llvm/llvm-project/pull/76111

>From b87fd5cef3463e463589a3fbce2bbd6cb08566dd Mon Sep 17 00:00:00 2001
From: Pete Lawrence 
Date: Tue, 19 Dec 2023 19:25:36 -1000
Subject: [PATCH] [lldb] Remove redundant severity substring within a
 diagnostic message.

For example, the following message has the severity string "error: " twice.
> "error: :3:1: error: cannot find 'bogus' in scope

This method already appends the severity string in the beginning, but with this 
fix, it also removes a secondary instance, if applicable.

Note that this change only removes the *first* redundant substring. I 
considered putting the removal logic in a loop, but I decided that if something 
is generating more than one redundant severity substring, then that's a problem 
the message's source should probably fix.

rdar://114203423
---
 lldb/source/Expression/DiagnosticManager.cpp| 13 +++--
 .../TestModulesCompileError.py  |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Expression/DiagnosticManager.cpp 
b/lldb/source/Expression/DiagnosticManager.cpp
index 08977066e3330a..49cd47ba8f05b2 100644
--- a/lldb/source/Expression/DiagnosticManager.cpp
+++ b/lldb/source/Expression/DiagnosticManager.cpp
@@ -48,8 +48,17 @@ std::string DiagnosticManager::GetString(char separator) {
   std::string ret;
 
   for (const auto &diagnostic : Diagnostics()) {
-ret.append(StringForSeverity(diagnostic->GetSeverity()));
-ret.append(std::string(diagnostic->GetMessage()));
+std::string message(diagnostic->GetMessage());
+std::string searchable_message(diagnostic->GetMessage().lower());
+std::string severity(StringForSeverity(diagnostic->GetSeverity()));
+
+// Erase the (first) redundant severity string in the message.
+size_t position = searchable_message.find(severity);
+if (position != std::string::npos)
+  message.erase(position, severity.length());
+
+ret.append(severity);
+ret.append(message);
 ret.push_back(separator);
   }
 
diff --git 
a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py 
b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
index 36e302be2525b5..620b6e44fc852a 100644
--- a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
+++ b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
@@ -21,7 +21,7 @@ def test(self):
 "expr @import LLDBTestModule",
 error=True,
 substrs=[
-"module.h:4:1: error: use of undeclared identifier 
'syntax_error_for_lldb_to_find'",
+"module.h:4:1: use of undeclared identifier 
'syntax_error_for_lldb_to_find'",
 "syntax_error_for_lldb_to_find // comment that tests source 
printing",
 "could not build module 'LLDBTestModule'",
 ],

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


[Lldb-commits] [lldb] [lldb] enchance colorize process for image lookup command (PR #76112)

2023-12-20 Thread José Lira Junior via lldb-commits

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

Follow-up to #69422.

This commit builds upon the previous contribution that introduced symbol 
colorization in the image lookup command when using regex. In response to 
feedback from reviewers, this follow-up refines the colorization mechanism 
based on their recommendations.

Changes:
- Refactors symbol colorization logic to incorporate feedback from the previous 
commit.
- Extends colorization to functions in addition to symbols for a more 
comprehensive visual representation.

Co-authored-by: Talha Tahir 

From b2d254fabcaacb849ba48e342c62abf7ecd9779a Mon Sep 17 00:00:00 2001
From: taalhaataahir0102 <23100...@lums.edu.pk>
Date: Wed, 13 Dec 2023 15:12:29 +0500
Subject: [PATCH 1/4] Using struct for transfering pattern information

---
 lldb/include/lldb/Core/Address.h |  4 +-
 lldb/include/lldb/Symbol/Symbol.h|  3 +-
 lldb/include/lldb/Symbol/SymbolContext.h |  5 +-
 lldb/include/lldb/Utility/Stream.h   | 10 +++-
 lldb/source/Commands/CommandObjectTarget.cpp | 35 
 lldb/source/Core/Address.cpp | 59 ++--
 lldb/source/Symbol/Symbol.cpp| 14 +++--
 lldb/source/Symbol/SymbolContext.cpp | 22 +---
 lldb/source/Utility/Stream.cpp   | 10 ++--
 9 files changed, 110 insertions(+), 52 deletions(-)

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index 725b5d9f91d3d5..c5a47321c774e7 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -13,6 +13,7 @@
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-types.h"
+#include "lldb/Utility/Stream.h"
 
 #include "llvm/ADT/StringRef.h"
 
@@ -255,7 +256,8 @@ class Address {
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
 uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
-llvm::StringRef pattern = "") const;
+std::optional pattern_info = std::nullopt) const;
+
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index e6c0b495bcf28c..96ba7ba282a01c 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -16,6 +16,7 @@
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/JSON.h"
+#include "lldb/Utility/Stream.h"
 
 namespace lldb_private {
 
@@ -175,7 +176,7 @@ class Symbol : public SymbolContextScope {
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info = std::nullopt) 
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 26f3bac09a9626..529dc9630840b7 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -17,6 +17,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {
@@ -157,7 +158,7 @@ class SymbolContext {
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
bool show_function_arguments, bool show_function_name,
-   llvm::StringRef pattern = "") const;
+   std::optional pattern_info = std::nullopt) 
const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -224,7 +225,7 @@ class SymbolContext {
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info = std::nullopt) 
const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 20c55ac4597ae6..accbdb3b3fed35 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -23,6 +23,12 @@
 
 namespace lldb_private {
 
+struct Information {
+llvm::StringRef pattern;
+llvm::StringRef prefix;
+llvm::StringRef suffix;
+};
+
 /// \class Stream Stream.h "lldb/Utility/Stream.h"
 /// A stream class that can stream formatted output to a file.
 class Stream {
@@ -261,9 +267,7 @@ class Stream {
   /// environment-dependent.
 
   void PutCStringColorHighlighted(llvm::StringRef text,
-  llvm::StringRef patt

[Lldb-commits] [lldb] [lldb] enhance colorize process for image lookup command (PR #76112)

2023-12-20 Thread José Lira Junior via lldb-commits

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


[Lldb-commits] [lldb] [lldb] enhance colorize process for image lookup command (PR #76112)

2023-12-20 Thread via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: José Lira Junior (junior-jl)


Changes

Follow-up to #69422.

This commit builds upon the previous contribution that introduced symbol 
colorization in the image lookup command when using regex. In response to 
feedback from reviewers, this follow-up refines the colorization mechanism 
based on their recommendations.

Changes:
- Refactors symbol colorization logic to incorporate feedback from the previous 
commit.
- Extends colorization to functions in addition to symbols for a more 
comprehensive visual representation.

Co-authored-by: Talha Tahir 

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


9 Files Affected:

- (modified) lldb/include/lldb/Core/Address.h (+3-1) 
- (modified) lldb/include/lldb/Symbol/Symbol.h (+2-1) 
- (modified) lldb/include/lldb/Symbol/SymbolContext.h (+3-2) 
- (modified) lldb/include/lldb/Utility/Stream.h (+11-3) 
- (modified) lldb/source/Commands/CommandObjectTarget.cpp (+24-14) 
- (modified) lldb/source/Core/Address.cpp (+9-9) 
- (modified) lldb/source/Symbol/Symbol.cpp (+3-5) 
- (modified) lldb/source/Symbol/SymbolContext.cpp (+7-7) 
- (modified) lldb/source/Utility/Stream.cpp (+4-6) 


``diff
diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index 725b5d9f91d3d5..c5a47321c774e7 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -13,6 +13,7 @@
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-types.h"
+#include "lldb/Utility/Stream.h"
 
 #include "llvm/ADT/StringRef.h"
 
@@ -255,7 +256,8 @@ class Address {
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
 uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
-llvm::StringRef pattern = "") const;
+std::optional pattern_info = std::nullopt) const;
+
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index e6c0b495bcf28c..96ba7ba282a01c 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -16,6 +16,7 @@
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/JSON.h"
+#include "lldb/Utility/Stream.h"
 
 namespace lldb_private {
 
@@ -175,7 +176,7 @@ class Symbol : public SymbolContextScope {
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info = std::nullopt) 
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 26f3bac09a9626..529dc9630840b7 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -17,6 +17,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {
@@ -157,7 +158,7 @@ class SymbolContext {
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
bool show_function_arguments, bool show_function_name,
-   llvm::StringRef pattern = "") const;
+   std::optional pattern_info = std::nullopt) 
const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -224,7 +225,7 @@ class SymbolContext {
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info = std::nullopt) 
const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 20c55ac4597ae6..7aed0a831631bd 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -23,6 +23,16 @@
 
 namespace lldb_private {
 
+struct Information {
+llvm::StringRef pattern;
+llvm::StringRef prefix;
+llvm::StringRef suffix;
+
+// Constructor
+Information(llvm::StringRef p, llvm::StringRef pre, llvm::StringRef suf)
+: pattern(p), prefix(pre), suffix(suf) {}
+};
+
 /// \class Stream Stream.h "lldb/Utility/Stream.h"
 /// A stream class that can stream formatted output to a file.
 class Stream {
@@ -261,9 +271,7 @@ class Stream {
   /// environment-dependent.
 
   void PutCStringColorHighlighted(llvm::StringRef text,
-   

[Lldb-commits] [lldb] [lldb] enhance colorize process for image lookup command (PR #76112)

2023-12-20 Thread via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 912506b75d8a508353a701c230e73ca45a253161 
648ec67f79e91ad4baaec40df3f07bf60fe5f8a7 -- lldb/include/lldb/Core/Address.h 
lldb/include/lldb/Symbol/Symbol.h lldb/include/lldb/Symbol/SymbolContext.h 
lldb/include/lldb/Utility/Stream.h lldb/source/Commands/CommandObjectTarget.cpp 
lldb/source/Core/Address.cpp lldb/source/Symbol/Symbol.cpp 
lldb/source/Symbol/SymbolContext.cpp lldb/source/Utility/Stream.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index c5a47321c7..80c43bbe00 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -9,11 +9,11 @@
 #ifndef LLDB_CORE_ADDRESS_H
 #define LLDB_CORE_ADDRESS_H
 
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-types.h"
-#include "lldb/Utility/Stream.h"
 
 #include "llvm/ADT/StringRef.h"
 
@@ -257,7 +257,6 @@ public:
 DumpStyle fallback_style = DumpStyleInvalid,
 uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
 std::optional pattern_info = std::nullopt) const;
-
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index 96ba7ba282..f5ba14be75 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -13,10 +13,10 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/JSON.h"
-#include "lldb/Utility/Stream.h"
 
 namespace lldb_private {
 
@@ -175,8 +175,9 @@ public:
 
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
-  void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  std::optional pattern_info = std::nullopt) 
const;
+  void
+  GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
+ std::optional pattern_info = std::nullopt) 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 529dc96308..74be06e742 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -154,11 +154,12 @@ public:
   ///
   /// \return
   /// \b true if some text was dumped, \b false otherwise.
-  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,
-   std::optional pattern_info = std::nullopt) 
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,
+  std::optional pattern_info = std::nullopt) 
const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -224,8 +225,9 @@ public:
   /// 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,
-  std::optional pattern_info = std::nullopt) 
const;
+  void
+  GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
+ std::optional pattern_info = std::nullopt) const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 7aed0a8316..00c9d15b19 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -24,13 +24,13 @@
 namespace lldb_private {
 
 struct Information {
-llvm::StringRef pattern;
-llvm::StringRef prefix;
-llvm::StringRef suffix;
-
-// Constructor
-Information(llvm::StringRef p, llvm::StringRef pre, llvm::StringRef suf)
-: pattern(p), prefix(pre), suffix(suf) {}
+  llvm::StringRef pattern;
+  llvm::StringRef prefix;
+  llvm::StringRef suffix;
+
+  // Constructor
+  Information(llvm::StringRef p, llvm::StringRef pre, llvm::StringRef suf)
+  : pattern(p), prefix(pre), suffix(suf) {}
 };
 
 /// \class Stream Stream.h "lldb/Utility/Stream.h"
@@ -270,8 +270,9 @@ public:
   //

[Lldb-commits] [lldb] [lldb] enhance colorize process for image lookup command (PR #76112)

2023-12-20 Thread José Lira Junior via lldb-commits

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

From b2d254fabcaacb849ba48e342c62abf7ecd9779a Mon Sep 17 00:00:00 2001
From: taalhaataahir0102 <23100...@lums.edu.pk>
Date: Wed, 13 Dec 2023 15:12:29 +0500
Subject: [PATCH 1/5] Using struct for transfering pattern information

---
 lldb/include/lldb/Core/Address.h |  4 +-
 lldb/include/lldb/Symbol/Symbol.h|  3 +-
 lldb/include/lldb/Symbol/SymbolContext.h |  5 +-
 lldb/include/lldb/Utility/Stream.h   | 10 +++-
 lldb/source/Commands/CommandObjectTarget.cpp | 35 
 lldb/source/Core/Address.cpp | 59 ++--
 lldb/source/Symbol/Symbol.cpp| 14 +++--
 lldb/source/Symbol/SymbolContext.cpp | 22 +---
 lldb/source/Utility/Stream.cpp   | 10 ++--
 9 files changed, 110 insertions(+), 52 deletions(-)

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index 725b5d9f91d3d5..c5a47321c774e7 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -13,6 +13,7 @@
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-types.h"
+#include "lldb/Utility/Stream.h"
 
 #include "llvm/ADT/StringRef.h"
 
@@ -255,7 +256,8 @@ class Address {
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
 uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
-llvm::StringRef pattern = "") const;
+std::optional pattern_info = std::nullopt) const;
+
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index e6c0b495bcf28c..96ba7ba282a01c 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -16,6 +16,7 @@
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/JSON.h"
+#include "lldb/Utility/Stream.h"
 
 namespace lldb_private {
 
@@ -175,7 +176,7 @@ class Symbol : public SymbolContextScope {
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info = std::nullopt) 
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 26f3bac09a9626..529dc9630840b7 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -17,6 +17,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {
@@ -157,7 +158,7 @@ class SymbolContext {
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
bool show_function_arguments, bool show_function_name,
-   llvm::StringRef pattern = "") const;
+   std::optional pattern_info = std::nullopt) 
const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -224,7 +225,7 @@ class SymbolContext {
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info = std::nullopt) 
const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 20c55ac4597ae6..accbdb3b3fed35 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -23,6 +23,12 @@
 
 namespace lldb_private {
 
+struct Information {
+llvm::StringRef pattern;
+llvm::StringRef prefix;
+llvm::StringRef suffix;
+};
+
 /// \class Stream Stream.h "lldb/Utility/Stream.h"
 /// A stream class that can stream formatted output to a file.
 class Stream {
@@ -261,9 +267,7 @@ class Stream {
   /// environment-dependent.
 
   void PutCStringColorHighlighted(llvm::StringRef text,
-  llvm::StringRef pattern = "",
-  llvm::StringRef prefix = "",
-  llvm::StringRef suffix = "");
+  std::optional pattern_info = 
std::nullopt);
 
   /// Output and End of Line character to the stream.
   size_t EOL();
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index bc8bc51356c8ca..96c7b2f5930cd1 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Comma

[Lldb-commits] [lldb] [lldb] enhance colorize process for image lookup command (PR #76112)

2023-12-20 Thread José Lira Junior via lldb-commits

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

From b2d254fabcaacb849ba48e342c62abf7ecd9779a Mon Sep 17 00:00:00 2001
From: taalhaataahir0102 <23100...@lums.edu.pk>
Date: Wed, 13 Dec 2023 15:12:29 +0500
Subject: [PATCH 1/6] Using struct for transfering pattern information

---
 lldb/include/lldb/Core/Address.h |  4 +-
 lldb/include/lldb/Symbol/Symbol.h|  3 +-
 lldb/include/lldb/Symbol/SymbolContext.h |  5 +-
 lldb/include/lldb/Utility/Stream.h   | 10 +++-
 lldb/source/Commands/CommandObjectTarget.cpp | 35 
 lldb/source/Core/Address.cpp | 59 ++--
 lldb/source/Symbol/Symbol.cpp| 14 +++--
 lldb/source/Symbol/SymbolContext.cpp | 22 +---
 lldb/source/Utility/Stream.cpp   | 10 ++--
 9 files changed, 110 insertions(+), 52 deletions(-)

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index 725b5d9f91d3d5..c5a47321c774e7 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -13,6 +13,7 @@
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-types.h"
+#include "lldb/Utility/Stream.h"
 
 #include "llvm/ADT/StringRef.h"
 
@@ -255,7 +256,8 @@ class Address {
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
 uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
-llvm::StringRef pattern = "") const;
+std::optional pattern_info = std::nullopt) const;
+
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index e6c0b495bcf28c..96ba7ba282a01c 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -16,6 +16,7 @@
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/JSON.h"
+#include "lldb/Utility/Stream.h"
 
 namespace lldb_private {
 
@@ -175,7 +176,7 @@ class Symbol : public SymbolContextScope {
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info = std::nullopt) 
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 26f3bac09a9626..529dc9630840b7 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -17,6 +17,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {
@@ -157,7 +158,7 @@ class SymbolContext {
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
bool show_function_arguments, bool show_function_name,
-   llvm::StringRef pattern = "") const;
+   std::optional pattern_info = std::nullopt) 
const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -224,7 +225,7 @@ class SymbolContext {
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info = std::nullopt) 
const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 20c55ac4597ae6..accbdb3b3fed35 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -23,6 +23,12 @@
 
 namespace lldb_private {
 
+struct Information {
+llvm::StringRef pattern;
+llvm::StringRef prefix;
+llvm::StringRef suffix;
+};
+
 /// \class Stream Stream.h "lldb/Utility/Stream.h"
 /// A stream class that can stream formatted output to a file.
 class Stream {
@@ -261,9 +267,7 @@ class Stream {
   /// environment-dependent.
 
   void PutCStringColorHighlighted(llvm::StringRef text,
-  llvm::StringRef pattern = "",
-  llvm::StringRef prefix = "",
-  llvm::StringRef suffix = "");
+  std::optional pattern_info = 
std::nullopt);
 
   /// Output and End of Line character to the stream.
   size_t EOL();
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index bc8bc51356c8ca..96c7b2f5930cd1 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Comma

[Lldb-commits] [lldb] [lldb] enhance colorize process for image lookup command (PR #76112)

2023-12-20 Thread via lldb-commits
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


taalhaataahir0102 wrote:

Hi! @DavidSpickett, made the above changes.
1. struct has been introduced inside stream.h and all the information is being 
passed using optional struct (`std::optional pattern_info`) and 
all the member variables inside the struct are `llvm::StringRef`. Were not able 
to solve the issue for `llvm::regex`
2. For function search, it was similar to symbol search as it also passes all 
the information to the same dumping functions. 
3. For test cases, Right now all the test cases are for -s flag (symbol search) 
i..e, 11 in total. Should we split the current test cases like 4 for symbol 
search, 4 for function search (-F flag) and 3 for symbol-or-function search (-n 
flag) or we should add more test cases for each flag?

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