[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> That was just a symptom, but what we want is users not having to specify 
> process launch -w at all. We want our users to simply do run and that things 
> just work.

We have:
* process launch -w does not carry the working dir to subsequent launches.
  * Please open an issue for that.
  * Maybe it can be fixed with the setting, but you don't need to deal with 
that.
* Your users want to use `run` as they would normally, I think I would too.
  * Adding a setting is a reasonable approach for this part.
  * It's kinda like `git -C` but for all targets launched by lldb.

You will have to decide whether `process launch -w` or the setting wins, I 
would say `process launch -w` wins and if `-w` is not passed then the setting 
is used.

> launch-working-dir sounds like working-dir to me.

Although one might think that `working-dir` actually changes the working 
directory of a running target if you change it at runtime.  We already have a 
few settings that actually only apply on first launch but aren't named as such.

So let's leave the `launch` bit in and document that changing it at runtime 
will not change the process' working dir, to be extra clear.

> Should this be target.process not target?

On second thought, if this is on target then the launch workdir dir should be 
too:
```
target.run-args -- A list containing all the arguments to be passed to the 
executable when it is run. Note that this does NOT include the argv[0] which is 
in target.arg0.
```
...so ignore advice from me on a Wednesday I guess :)

Also you could reference how this setting interacts with the other ways to pass 
arguments like `lldb program -- arg1 arg2`, whether it's additive or one wins. 
For a working dir, one has to win of course.

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> Internally we use bazel in a way in which

Even if this way of using it (I have no experience with Bazel myself) is 
unusual, I think the pitch for the setting is ok anyway.

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits


@@ -201,6 +201,10 @@ let Definition = "target" in {
   def DebugUtilityExpression: Property<"debug-utility-expression", "Boolean">,
 DefaultFalse,
 Desc<"Enable debugging of LLDB-internal utility expressions.">;
+  def LaunchWorkingDir: Property<"launch-working-dir", "String">,
+DefaultStringValue<"">,
+Desc<"A default value for the working directory to use when launching 
processes. "
+ "It's not used when empty.">;

DavidSpickett wrote:

Here we should say how it interacts with commands that can set the working dir, 
and that changing this at runtime does not change the running process' working 
dir.

"This setting is only used when the target is launched. If you change this 
setting, the new value will only apply to subsequent launches."

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits


@@ -206,3 +207,70 @@ def test_environment_with_special_char(self):
 self.assertEqual(value, evil_var)
 process.Continue()
 self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+
+def test_target_launch_working_dir_prop(self):
+"""Test that the setting `target.launch-working-dir` is correctly used 
when launching a process."""
+d = {"CXX_SOURCES": "print_cwd.cpp"}
+self.build(dictionary=d)
+self.setTearDownCleanup(d)
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe)
+
+mywd = "my_working_dir"
+out_file_name = "my_working_dir_test.out"
+
+my_working_dir_path = self.getBuildArtifact(mywd)
+lldbutil.mkdir_p(my_working_dir_path)
+out_file_path = os.path.join(my_working_dir_path, out_file_name)
+another_working_dir_path = Path(
+os.path.join(my_working_dir_path, "..")
+).resolve()
+
+# Check that we correctly override the working dir

DavidSpickett wrote:

Please rewrite this so it's obvious what "correct" means. Like:
```
# If -w is passed to process launch, that value will be used instead of the 
setting.
```

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits


@@ -206,3 +207,70 @@ def test_environment_with_special_char(self):
 self.assertEqual(value, evil_var)
 process.Continue()
 self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+
+def test_target_launch_working_dir_prop(self):
+"""Test that the setting `target.launch-working-dir` is correctly used 
when launching a process."""
+d = {"CXX_SOURCES": "print_cwd.cpp"}
+self.build(dictionary=d)
+self.setTearDownCleanup(d)
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe)
+
+mywd = "my_working_dir"
+out_file_name = "my_working_dir_test.out"
+
+my_working_dir_path = self.getBuildArtifact(mywd)
+lldbutil.mkdir_p(my_working_dir_path)
+out_file_path = os.path.join(my_working_dir_path, out_file_name)
+another_working_dir_path = Path(
+os.path.join(my_working_dir_path, "..")
+).resolve()
+
+# Check that we correctly override the working dir
+launch_command = f"process launch -w {my_working_dir_path} -o 
{out_file_path}"
+
+self.expect(
+launch_command,
+patterns=["Process .* launched: .*a.out"],
+)
+
+out = lldbutil.read_file_on_target(self, out_file_path)
+self.assertIn(f"stdout: {my_working_dir_path}", out)
+
+# Check that we can unset the setting
+self.runCmd(f"settings set target.launch-working-dir ''")
+launch_command = f"process launch -o {out_file_path}"
+
+self.expect(
+launch_command,
+patterns=["Process .* launched: .*a.out"],
+)
+
+out = lldbutil.read_file_on_target(self, out_file_path)
+self.assertNotIn(f"stdout: {another_working_dir_path}", out)
+
+# Check that we correctly set the working dir
+self.runCmd(
+f"settings set target.launch-working-dir 
{another_working_dir_path}"
+)
+launch_command = f"process launch -o {out_file_path}"
+
+self.expect(
+launch_command,
+patterns=["Process .* launched: .*a.out"],
+)
+
+out = lldbutil.read_file_on_target(self, out_file_path)
+self.assertIn(f"stdout: {another_working_dir_path}", out)
+
+# Check that we can unset the setting

DavidSpickett wrote:

and here.

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits


@@ -4428,6 +4428,15 @@ void TargetProperties::SetDisableSTDIO(bool b) {
   const uint32_t idx = ePropertyDisableSTDIO;
   SetPropertyAtIndex(idx, b);
 }
+std::optional
+TargetProperties::GetLaunchWorkingDirectory() const {

DavidSpickett wrote:

If it's not used when empty should this just return llvm::StringRef?

I get the logical purity of using optional, but if we're defining some value of 
it as the "null" value anyway we don't have to use optional.

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits


@@ -201,6 +201,13 @@ class CommandObjectProcessLaunch : public 
CommandObjectProcessLaunchOrAttach {
 if (target->GetDisableSTDIO())
   m_options.launch_info.GetFlags().Set(eLaunchFlagDisableSTDIO);
 
+if (!m_options.launch_info.GetWorkingDirectory()) {

DavidSpickett wrote:

I think this means `process launch -w` already wins, which is good.

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits


@@ -206,3 +207,70 @@ def test_environment_with_special_char(self):
 self.assertEqual(value, evil_var)
 process.Continue()
 self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+
+def test_target_launch_working_dir_prop(self):
+"""Test that the setting `target.launch-working-dir` is correctly used 
when launching a process."""
+d = {"CXX_SOURCES": "print_cwd.cpp"}
+self.build(dictionary=d)
+self.setTearDownCleanup(d)
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe)
+
+mywd = "my_working_dir"
+out_file_name = "my_working_dir_test.out"
+
+my_working_dir_path = self.getBuildArtifact(mywd)
+lldbutil.mkdir_p(my_working_dir_path)
+out_file_path = os.path.join(my_working_dir_path, out_file_name)
+another_working_dir_path = Path(
+os.path.join(my_working_dir_path, "..")
+).resolve()
+
+# Check that we correctly override the working dir
+launch_command = f"process launch -w {my_working_dir_path} -o 
{out_file_path}"
+
+self.expect(
+launch_command,
+patterns=["Process .* launched: .*a.out"],
+)
+
+out = lldbutil.read_file_on_target(self, out_file_path)
+self.assertIn(f"stdout: {my_working_dir_path}", out)
+
+# Check that we can unset the setting
+self.runCmd(f"settings set target.launch-working-dir ''")
+launch_command = f"process launch -o {out_file_path}"
+
+self.expect(
+launch_command,
+patterns=["Process .* launched: .*a.out"],
+)
+
+out = lldbutil.read_file_on_target(self, out_file_path)
+self.assertNotIn(f"stdout: {another_working_dir_path}", out)
+
+# Check that we correctly set the working dir

DavidSpickett wrote:

Same here, state what you expect to happen.

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett commented:

I think you already did what I asked for in my comment just now, just docs and 
comments to update.

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Also please add a release note to the LLDB section in the llvm release notes 
doc. These sort of settings people don't know they could use, until they 
realise they exist.

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


[Lldb-commits] [lldb] [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) (PR #114346)

2024-10-31 Thread David Spickett via lldb-commits


@@ -47,6 +47,10 @@ static llvm::Expected *g_fcxx_modules_workaround 
[[maybe_unused]];
 
 // Include python for non windows machines
 #include 
+
+// Provide a meaningful diagnostic error if someone tries to compile this file
+// with a version of Python we don't support.
+static_assert(PY_VERSION_HEX >= 0x0300, "LLDB requires Python 3.0");

DavidSpickett wrote:

"at least Python 3.0"

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


[Lldb-commits] [lldb] [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) (PR #114346)

2024-10-31 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett commented:

Pavel's request so he can approve but looks fine to me. The static assert is a 
nice addition.

I see the set home change had to be reverted but I assume you're sorting all 
that out yourself.

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


[Lldb-commits] [lldb] [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) (PR #114346)

2024-10-31 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][test] Skip one inline stepping test for arm-ubuntu. (PR #114295)

2024-10-31 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] 7557972 - [lldb][test] Fix formatting in TestInlineStepping.py

2024-10-31 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2024-10-31T09:08:00Z
New Revision: 7557972884106e6bdaf00eabe1a8cafec861a7fe

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

LOG: [lldb][test] Fix formatting in TestInlineStepping.py

Fixes a218f0f354e9df2ce689686be503f3d85fea44f9

Added: 


Modified: 
lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py 
b/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py
index 1118758cc88fbc..4e2d908e63b81c 100644
--- a/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py
+++ b/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py
@@ -1,6 +1,5 @@
 """Test stepping over and into inlined functions."""
 
-
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -14,8 +13,7 @@ class TestInlineStepping(TestBase):
 compiler="icc",
 bugnumber="# Not really a bug.  ICC combines two inlined functions.",
 )
-
-@skipIf(oslist=["linux"], archs=["arm"]) # Fails for 32 bit arm
+@skipIf(oslist=["linux"], archs=["arm"])  # Fails for 32 bit arm
 def test_with_python_api(self):
 """Test stepping over and into inlined functions."""
 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 a fuzzer for the DWARF Expression Evaluator (PR #114286)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Zequan Wu via lldb-commits


@@ -1810,7 +1813,27 @@ 
SymbolFileNativePDB::ParseVariablesForCompileUnit(CompileUnit &comp_unit,
   VariableList &variables) {
   PdbSymUid sym_uid(comp_unit.GetID());
   lldbassert(sym_uid.kind() == PdbSymUidKind::Compiland);
-  return 0;
+  for (const uint32_t gid : m_index->globals().getGlobalsTable()) {
+PdbGlobalSymId global{gid, false};
+CVSymbol sym = m_index->ReadSymbolRecord(global);
+// TODO: Handle S_CONSTANT which might be a record type (e.g.
+// std::strong_ordering::equal). Currently
+// lldb_private::npdb::MakeConstantLocationExpression doesn't handle this
+// case and will crash if we do create global variables from it.

ZequanWu wrote:

Just what I did: not handling the S_CONSTANT case prevents the call to 
`lldb_private::npdb::MakeConstantLocationExpression` with a record type, hence 
not crash for now. 

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


[Lldb-commits] [lldb] Fix pointer to reference type (PR #113596)

2024-10-31 Thread via lldb-commits

jimingham wrote:

First off, it is not the case that the "ValueObject Path Expression" operators 
- part of what we're starting to call the DIL (Data Inspection Language) - are 
supposed to exactly mirror C++ semantics.  Since they reflect all the ways that 
a synthetic child provider might present its children, and since this part of 
lldb is independent of language - it gets used for C/ObjC/C++/Swift/Rust etc 
values, not just C++ - I don't think this would a feasible or particularly 
useful requirement.

So  "be the same as C++ semantics" is not a sufficient justification to change 
how the path expressions get interpreted in lldb.  The better motivation is 
"what is a useful and consistent syntax for static poking at data objects".  
The question "where does this reference live" isn't a particularly useful 
question to ask in C++ code, but it does seem like a useful question to ask 
when poking around in data.  And since we're generally treating `&` to mean 
"what is the location of this object in memory" in the DIL, then interpreting 
the & in this case the way it was before the patch seems more natural.

I agree with Pavel, we should take a step back and actually define what `&` and 
`*` will mean in the DIL, and then implement that.

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


[Lldb-commits] [lldb] [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) (PR #114346)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Extend FindTypes to optionally search by mangled type name (PR #113007)

2024-10-31 Thread Augusto Noronha via lldb-commits

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


[Lldb-commits] [lldb] 88591aa - [lldb] Remove lldb-repro utility

2024-10-31 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-31T10:39:48-07:00
New Revision: 88591aa0ca7e4d99da353d49f91ea63e43fb55e0

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

LOG: [lldb] Remove lldb-repro utility

Remove lldb-repro which was used to run the test suite against a
reproducer. The corresponding functionality has been removed from LLDB
so there's no need for the tool anymore.

Added: 


Modified: 
lldb/test/API/lit.cfg.py
lldb/test/Shell/Driver/LocalLLDBInit.test
lldb/test/Shell/Driver/TestCore.test
lldb/test/Shell/Driver/TestError.test
lldb/test/Shell/Driver/TestFile.test
lldb/test/Shell/Driver/TestHelp.test
lldb/test/Shell/Driver/TestPositionalArgs.test
lldb/test/Shell/Driver/TestRepl.test
lldb/test/Shell/Process/TestEnvironment.test
lldb/test/Shell/Quit/TestQuitExitCode-30.test
lldb/test/Shell/Quit/TestQuitExitCode30.test
lldb/test/Shell/Quit/TestQuitExitCodeHexA.test
lldb/test/Shell/Register/x86-64-read.test
lldb/test/Shell/Register/x86-64-ymm-read.test
lldb/test/Shell/Register/x86-multithread-write.test
lldb/test/Shell/ScriptInterpreter/Lua/bindings.test
lldb/test/Shell/ScriptInterpreter/Lua/convenience_variables.test
lldb/test/Shell/ScriptInterpreter/Lua/io.test
lldb/test/Shell/ScriptInterpreter/Lua/lua-python.test
lldb/test/Shell/ScriptInterpreter/Lua/print.test
lldb/test/Shell/ScriptInterpreter/Lua/quit.test
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/lit.local.cfg
lldb/test/Shell/ScriptInterpreter/Python/fail_breakpoint_oneline.test
lldb/test/Shell/ScriptInterpreter/Python/sb_address_exception.test
lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint.test
lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint_lua.test
lldb/test/Shell/SymbolFile/DWARF/x86/debug_loc.s
lldb/test/Shell/helper/toolchain.py
lldb/test/Shell/lit.cfg.py
lldb/utils/CMakeLists.txt

Removed: 
lldb/test/Shell/Subprocess/lit.local.cfg
lldb/test/Shell/SymbolFile/NativePDB/lit.local.cfg
lldb/test/Shell/SymbolFile/PDB/lit.local.cfg
lldb/utils/lldb-repro/CMakeLists.txt
lldb/utils/lldb-repro/lldb-repro.py



diff  --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 6481ae8b663c8c..c8e4a4c461f123 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -268,12 +268,6 @@ def delete_module_cache(path):
 if is_configured("lldb_framework_dir"):
 dotest_cmd += ["--framework", config.lldb_framework_dir]
 
-if (
-"lldb-repro-capture" in config.available_features
-or "lldb-repro-replay" in config.available_features
-):
-dotest_cmd += ["--skip-category=lldb-dap", "--skip-category=std-module"]
-
 if "lldb-simulator-ios" in config.available_features:
 dotest_cmd += ["--apple-sdk", "iphonesimulator", "--platform-name", 
"ios-simulator"]
 elif "lldb-simulator-watchos" in config.available_features:

diff  --git a/lldb/test/Shell/Driver/LocalLLDBInit.test 
b/lldb/test/Shell/Driver/LocalLLDBInit.test
index e1b66a09984445..5db545e7ec5610 100644
--- a/lldb/test/Shell/Driver/LocalLLDBInit.test
+++ b/lldb/test/Shell/Driver/LocalLLDBInit.test
@@ -1,5 +1,4 @@
 # REQUIRES: python
-# UNSUPPORTED: lldb-repro
 #
 # RUN: mkdir -p %t.root
 # RUN: mkdir -p %t.home

diff  --git a/lldb/test/Shell/Driver/TestCore.test 
b/lldb/test/Shell/Driver/TestCore.test
index 2472617235124b..cca8171da63126 100644
--- a/lldb/test/Shell/Driver/TestCore.test
+++ b/lldb/test/Shell/Driver/TestCore.test
@@ -1,4 +1,2 @@
-# UNSUPPORTED: lldb-repro
-#
 # RUN: not %lldb -c /bogus/path 2>&1 | FileCheck %s
 # CHECK: error: file specified in --core (-c) option doesn't exist

diff  --git a/lldb/test/Shell/Driver/TestError.test 
b/lldb/test/Shell/Driver/TestError.test
index 141c3ddf0f5f31..3d34a72b14aba5 100644
--- a/lldb/test/Shell/Driver/TestError.test
+++ b/lldb/test/Shell/Driver/TestError.test
@@ -1,3 +1,2 @@
-UNSUPPORTED: lldb-repro
 RUN: not %lldb --arch 2>&1 | FileCheck %s
 CHECK: error: argument to '--arch' is missing

diff  --git a/lldb/test/Shell/Driver/TestFile.test 
b/lldb/test/Shell/Driver/TestFile.test
index 776baf8ba0c5e6..0e80594aeb1b52 100644
--- a/lldb/test/Shell/Driver/TestFile.test
+++ b/lldb/test/Shell/Driver/TestFile.test
@@ -1,4 +1,2 @@
-# UNSUPPORTED: lldb-repro
-#
 # RUN: not %lldb -f /bogus/path 2>&1 | FileCheck %s
 # CHECK: error: file specified in --file (-f) option doesn't exist

diff  --git a/lldb/test/Shell/Driver/TestHelp.test 
b/lldb/test/Shell/Driver/TestHelp.test
index 2521b31a618836..703000b6452e96 100644
--- a/lldb/test/Shell/Driver/TestHelp.test
+++ b/lldb/test/Shell/Driver/TestHelp.test
@@ -1,5 +1,3 @@
-UNSUPPORTED: lldb-repro
-
 RUN: %lldb --help | FileCheck %s
 RUN: cat %S/../../../docs/man/lldb.rst | FileCheck %s
 

diff  --g

[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Zequan Wu via lldb-commits

https://github.com/ZequanWu updated 
https://github.com/llvm/llvm-project/pull/114303

>From 215c36a380946a0c8cab63605bd0a9da13e642cd Mon Sep 17 00:00:00 2001
From: Zequan Wu 
Date: Tue, 29 Oct 2024 13:19:50 -0700
Subject: [PATCH 1/2] [lldb][NativePDB] Parse global variables.

---
 .../NativePDB/SymbolFileNativePDB.cpp | 39 +++
 .../NativePDB/SymbolFileNativePDB.h   |  1 +
 .../SymbolFile/NativePDB/ast-methods.cpp  |  5 ++-
 .../SymbolFile/NativePDB/global-ctor-dtor.cpp | 11 +++---
 .../Shell/SymbolFile/PDB/ast-restore.test |  9 +
 5 files changed, 43 insertions(+), 22 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 7fded6a31a3af5..3536599693cb46 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -365,18 +365,20 @@ void SymbolFileNativePDB::InitializeObject() {
 }
 
 uint32_t SymbolFileNativePDB::CalculateNumCompileUnits() {
+  if (m_cu_count)
+return *m_cu_count;
   const DbiModuleList &modules = m_index->dbi().modules();
-  uint32_t count = modules.getModuleCount();
-  if (count == 0)
-return count;
+  m_cu_count = modules.getModuleCount();
+  if (*m_cu_count == 0)
+return 0;
 
   // The linker can inject an additional "dummy" compilation unit into the
   // PDB. Ignore this special compile unit for our purposes, if it is there.
   // It is always the last one.
-  DbiModuleDescriptor last = modules.getModuleDescriptor(count - 1);
+  DbiModuleDescriptor last = modules.getModuleDescriptor(*m_cu_count - 1);
   if (last.getModuleName() == "* Linker *")
---count;
-  return count;
+--*m_cu_count;
+  return *m_cu_count;
 }
 
 Block &SymbolFileNativePDB::CreateBlock(PdbCompilandSymId block_id) {
@@ -888,7 +890,8 @@ VariableSP 
SymbolFileNativePDB::CreateGlobalVariable(PdbGlobalSymId var_id) {
 
   CompUnitSP comp_unit;
   std::optional modi = m_index->GetModuleIndexForVa(addr);
-  if (!modi) {
+  // Some globals has modi points to the linker module, ignore them.
+  if (!modi || modi >= CalculateNumCompileUnits()) {
 return nullptr;
   }
 
@@ -1810,7 +1813,27 @@ 
SymbolFileNativePDB::ParseVariablesForCompileUnit(CompileUnit &comp_unit,
   VariableList &variables) {
   PdbSymUid sym_uid(comp_unit.GetID());
   lldbassert(sym_uid.kind() == PdbSymUidKind::Compiland);
-  return 0;
+  for (const uint32_t gid : m_index->globals().getGlobalsTable()) {
+PdbGlobalSymId global{gid, false};
+CVSymbol sym = m_index->ReadSymbolRecord(global);
+// TODO: Handle S_CONSTANT which might be a record type (e.g.
+// std::strong_ordering::equal). Currently
+// lldb_private::npdb::MakeConstantLocationExpression doesn't handle this
+// case and will crash if we do create global variables from it.
+switch (sym.kind()) {
+case SymbolKind::S_GDATA32:
+case SymbolKind::S_LDATA32:
+case SymbolKind::S_GTHREAD32:
+case SymbolKind::S_LTHREAD32: {
+  if (VariableSP var = GetOrCreateGlobalVariable(global))
+variables.AddVariable(var);
+  break;
+}
+default:
+  break;
+}
+  }
+  return variables.GetSize();
 }
 
 VariableSP SymbolFileNativePDB::CreateLocalVariable(PdbCompilandSymId scope_id,
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 669c44aa131edc..6e384b2b17873f 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -265,6 +265,7 @@ class SymbolFileNativePDB : public SymbolFileCommon {
   // UID for anonymous union and anonymous struct as they don't have entities 
in
   // pdb debug info.
   lldb::user_id_t anonymous_id = LLDB_INVALID_UID - 1;
+  std::optional m_cu_count = 0;
 
   std::unique_ptr m_file_up;
   std::unique_ptr m_index;
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
index f2be33aae8163b..ff6e0ddb20f9eb 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
@@ -44,8 +44,7 @@ int main(int argc, char **argv) {
 // AST: |   |-ParmVarDecl {{.*}} 'char'
 // AST: |   `-ParmVarDecl {{.*}} 'int'
 
-// SYMBOL:  int main(int argc, char **argv);
-// SYMBOL-NEXT: struct Struct {
+// SYMBOL:  struct Struct {
 // SYMBOL-NEXT: void simple_method();
 // SYMBOL-NEXT: static void static_method();
 // SYMBOL-NEXT: virtual void virtual_method();
@@ -53,3 +52,5 @@ int main(int argc, char **argv) {
 // SYMBOL-NEXT: int overloaded_method(char);
 // SYMBOL-NEXT: int overloaded_method(char, int, ...);
 // SYMBOL-NEXT: };
+// SYMBOL-NEXT: Struct s;
+// SYMBOL-NEXT: int main(int argc, char **

[Lldb-commits] [lldb] [lldb] Add a fuzzer for the DWARF Expression Evaluator (PR #114286)

2024-10-31 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)

2024-10-31 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova updated 
https://github.com/llvm/llvm-project/pull/91404

>From c4ee8ba1f6eff974614c9a98e660d22a1691bdb4 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Thu, 9 May 2024 11:08:29 -0700
Subject: [PATCH] [lldb][breakpoint] Grey out disabled breakpoints

This commit adds colour settings to the list of breakpoints in order to
grey out breakpoints that have been disabled.
---
 lldb/include/lldb/API/SBStream.h  |  5 +++
 lldb/include/lldb/Core/Debugger.h |  4 +++
 lldb/include/lldb/Utility/Stream.h|  8 +
 lldb/source/API/SBStream.cpp  | 10 ++
 lldb/source/Breakpoint/Breakpoint.cpp | 11 +++
 lldb/source/Core/CoreProperties.td| 10 ++
 lldb/source/Core/Debugger.cpp | 12 +++
 lldb/source/Utility/Stream.cpp|  8 +
 .../API/terminal/TestDisabledBreakpoints.py   | 32 +++
 9 files changed, 100 insertions(+)
 create mode 100644 lldb/test/API/terminal/TestDisabledBreakpoints.py

diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h
index d230da6123fb36..66a56322a9f958 100644
--- a/lldb/include/lldb/API/SBStream.h
+++ b/lldb/include/lldb/API/SBStream.h
@@ -12,6 +12,7 @@
 #include 
 
 #include "lldb/API/SBDefines.h"
+#include "llvm/ADT/StringRef.h"
 
 namespace lldb_private {
 class ScriptInterpreter;
@@ -47,6 +48,10 @@ class LLDB_API SBStream {
 
   void Print(const char *str);
 
+  bool HasColor();
+
+  void FormatAnsiTerminalCodes(llvm::StringRef format);
+
   void RedirectToFile(const char *path, bool append);
 
   void RedirectToFile(lldb::SBFile file);
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 1d5f2fcc20626c..4f04335b42bbc7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -308,6 +308,10 @@ class Debugger : public 
std::enable_shared_from_this,
 
   llvm::StringRef GetShowProgressAnsiSuffix() const;
 
+  llvm::StringRef GetDisabledBreakpointAnsiPrefix() const;
+
+  llvm::StringRef GetDisabledBreakpointAnsiSuffix() const;
+
   bool GetUseAutosuggestion() const;
 
   llvm::StringRef GetAutosuggestionAnsiPrefix() const;
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 37bcdc99241715..1ab590202cd694 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -309,6 +309,12 @@ class Stream {
   /// The current indentation level.
   unsigned GetIndentLevel() const;
 
+  /// Whether or not the stream is using color.
+  ///
+  /// \return
+  /// The color setting of the stream.
+  bool HasColor();
+
   /// Indent the current line in the stream.
   ///
   /// Indent the current line using the current indentation level and print an
@@ -366,6 +372,8 @@ class Stream {
   /// The optional C string format that can be overridden.
   void QuotedCString(const char *cstr, const char *format = "\"%s\"");
 
+  void FormatAnsiTerminalCodes(llvm::StringRef format);
+
   /// Set the address size in bytes.
   ///
   /// \param[in] addr_size
diff --git a/lldb/source/API/SBStream.cpp b/lldb/source/API/SBStream.cpp
index fc8f09a7bb9ae5..bc0f3356d4753c 100644
--- a/lldb/source/API/SBStream.cpp
+++ b/lldb/source/API/SBStream.cpp
@@ -11,6 +11,7 @@
 #include "lldb/API/SBFile.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/StreamFile.h"
+#include "lldb/Utility/AnsiTerminal.h"
 #include "lldb/Utility/Instrumentation.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Status.h"
@@ -77,6 +78,15 @@ void SBStream::Printf(const char *format, ...) {
   va_end(args);
 }
 
+bool SBStream::HasColor() {
+  return m_opaque_up->AsRawOstream().colors_enabled();
+}
+
+void SBStream::FormatAnsiTerminalCodes(llvm::StringRef format) {
+  if (HasColor())
+Printf("%s", ansi::FormatAnsiTerminalCodes(format).c_str());
+}
+
 void SBStream::RedirectToFile(const char *path, bool append) {
   LLDB_INSTRUMENT_VA(this, path, append);
 
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 54ebafc3f65b5c..550671bfbee9d9 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -15,6 +15,7 @@
 #include "lldb/Breakpoint/BreakpointResolver.h"
 #include "lldb/Breakpoint/BreakpointResolverFileLine.h"
 #include "lldb/Core/Address.h"
+#include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/SearchFilter.h"
@@ -26,6 +27,7 @@
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/AnsiTerminal.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Stream.h"
@@ -838,6 +840,11 @@ void Breakpoint::GetDescription(Stream *s, 
lldb::DescriptionLevel level,
 bool show_locations) {
   assert(s != null

[Lldb-commits] [lldb] 42fae38 - [lldb] Add a fuzzer for the DWARF Expression Evaluator (#114286)

2024-10-31 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-31T10:27:41-07:00
New Revision: 42fae38e6ad1433ac0ff1a648dfdcd3fdb981093

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

LOG: [lldb] Add a fuzzer for the DWARF Expression Evaluator (#114286)

This adds a fuzzer for the DWARF expression evaluator. It does pretty
much the same thing as what we do in the corresponding unit test but
with data generated by libfuzzer.

Added: 
lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/CMakeLists.txt

lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/lldb-dwarf-expression-fuzzer.cpp

Modified: 
lldb/tools/lldb-fuzzer/CMakeLists.txt

Removed: 




diff  --git a/lldb/tools/lldb-fuzzer/CMakeLists.txt 
b/lldb/tools/lldb-fuzzer/CMakeLists.txt
index 4c081a9de53e2d..e384ca18583981 100644
--- a/lldb/tools/lldb-fuzzer/CMakeLists.txt
+++ b/lldb/tools/lldb-fuzzer/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(lldb-commandinterpreter-fuzzer)
+add_subdirectory(lldb-dwarf-expression-fuzzer)
 add_subdirectory(lldb-expression-fuzzer)
 add_subdirectory(lldb-target-fuzzer)
 add_subdirectory(utils)

diff  --git 
a/lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/CMakeLists.txt 
b/lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/CMakeLists.txt
new file mode 100644
index 00..464696fc051d66
--- /dev/null
+++ b/lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/CMakeLists.txt
@@ -0,0 +1,33 @@
+set(LLVM_LINK_COMPONENTS
+  Support
+  )
+
+add_llvm_fuzzer(lldb-dwarf-expression-fuzzer
+  EXCLUDE_FROM_ALL
+  lldb-dwarf-expression-fuzzer.cpp
+  )
+
+if(TARGET lldb-dwarf-expression-fuzzer)
+  target_include_directories(lldb-dwarf-expression-fuzzer PRIVATE ..)
+  target_include_directories(lldb-dwarf-expression-fuzzer PRIVATE 
${LLDB_SOURCE_ROOT})
+  target_link_libraries(lldb-dwarf-expression-fuzzer
+PRIVATE
+lldbCore
+lldbPluginExpressionParserClang
+lldbPluginPlatformLinux
+lldbPluginTypeSystemClang
+lldbFuzzerUtils
+)
+
+  add_custom_command(TARGET lldb-dwarf-expression-fuzzer PRE_BUILD
+COMMAND ${CMAKE_COMMAND} -E make_directory 
${CMAKE_BINARY_DIR}/fuzzer-artifacts/dwarf-expression-artifacts
+)
+
+  add_custom_target(fuzz-lldb-dwarf-expression
+COMMENT "Running the LLDB DWARF expression evaluator fuzzer..."
+WORKING_DIRECTORY 
${CMAKE_BINARY_DIR}/fuzzer-artifacts/dwarf-expression-artifacts
+COMMAND $ 
-artifact_prefix=dwarf-expression-
+USES_TERMINAL
+)
+  set_target_properties(fuzz-lldb-dwarf-expression PROPERTIES FOLDER 
"LLDB/Fuzzer")
+endif()

diff  --git 
a/lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/lldb-dwarf-expression-fuzzer.cpp
 
b/lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/lldb-dwarf-expression-fuzzer.cpp
new file mode 100644
index 00..86c3709b3a8297
--- /dev/null
+++ 
b/lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/lldb-dwarf-expression-fuzzer.cpp
@@ -0,0 +1,83 @@
+//===-- lldb-target-fuzzer.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "utils/TempFile.h"
+
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::plugin::dwarf;
+using namespace lldb_fuzzer;
+
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
+  FileSystem::Initialize();
+  HostInfo::Initialize();
+  platform_linux::PlatformLinux::Initialize();
+  return 0;
+}
+
+static void Evaluate(llvm::ArrayRef expr,
+ lldb::ModuleSP module_sp = {}, DWARFUnit *unit = nullptr,
+ ExecutionContext *exe_ctx = nullptr) {
+  DataExtractor extractor(expr.data(), expr.size(), lldb::eByteOrderLittle,
+  /*addr_size*/ 4);
+
+  llvm::Expected result =
+  DWARFExpression::Evaluate(exe_ctx, /*reg_ctx*/ nullptr, module_sp,
+extractor, unit, lldb::eRegisterKindLLDB,
+/*initial_value_ptr*/ nullptr,
+/*object_address_ptr*/ nullptr);
+
+  if (!result)
+llvm::consumeError(result.takeError());
+}
+
+class MockTarget : public Target {
+public:
+  MockTarget(Debugger &debugger, const ArchSpec &target_arch,
+ const lldb::PlatformSP &platform_sp, llvm::ArrayRef data)
+  : Target

[Lldb-commits] [lldb] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (PR #114455)

2024-10-31 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Lit allows you to set environment variables for all tests in a directory using 
a `lit.local.cfg` file. Do this for the PDB and NativePDB tests.

---

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


40 Files Affected:

- (modified) lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp (+1-2) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp (+2-2) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/blocks.s (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/class_layout.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/function-types-builtins.cpp 
(+1-1) 
- (modified) 
lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/function-types-classes.cpp 
(+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/global-classes.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/globals-bss.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/globals-fundamental.cpp 
(+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/icf.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp 
(+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp (+1-1) 
- (added) lldb/test/Shell/SymbolFile/NativePDB/lit.local.cfg (+1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/load-pdb.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/local-variables-registers.s 
(+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp (+2-2) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/lookup-by-address.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/lookup-by-types.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/nested-blocks-same-address.s 
(+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/nested-types.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/s_constant.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/tag-types.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/NativePDB/typedefs.cpp (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/PDB/ast-restore.test (+2-2) 
- (modified) lldb/test/Shell/SymbolFile/PDB/compilands.test (+1-1) 
- (modified) lldb/test/Shell/SymbolFile/PDB/function-level-linking.test (+1-1) 
- (added) lldb/test/Shell/SymbolFile/PDB/lit.local.cfg (+1) 
- (modified) lldb/test/Shell/SymbolFile/PDB/variables-locations.test (+1-1) 


``diff
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
index b8154168aff3d1..c0ae6e73f36d8b 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
@@ -3,5 +3,5 @@
 
 // RUN: %build --compiler=msvc --nodefaultlib -o %t.exe -- %S/ast-functions.cpp
 
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
 // RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck 
%S/ast-functions.cpp
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
index 7eb7a2cbe7d9a4..d1cac393bbed9e 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
@@ -4,8 +4,7 @@
 // RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
 // RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe 
-pdb:%t.pdb
 
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
-// RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s
+// RUN: %lldb -f %t.exe -s %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s
 
 static int static_fn() {
   return 42;
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
index f2be33aae8163b..91bd5bb810c8e3 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp

[Lldb-commits] [lldb] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (PR #114455)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/114455

Lit allows you to set environment variables for all tests in a directory using 
a `lit.local.cfg` file. Do this for the PDB and NativePDB tests.

>From 3788c30d90499dd9c109b258cae38eb2cb1996a3 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 31 Oct 2024 12:48:12 -0700
Subject: [PATCH] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level

Lit allows you to set environment variables for all tests in a directory
using a `lit.local.cfg` file. Do this for the PDB and NativePDB tests.
---
 lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp   | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp| 3 +--
 lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp  | 4 ++--
 lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/blocks.s | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/class_layout.cpp | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp  | 2 +-
 .../Shell/SymbolFile/NativePDB/function-types-builtins.cpp| 2 +-
 .../SymbolFile/NativePDB/function-types-calling-conv.cpp  | 2 +-
 .../Shell/SymbolFile/NativePDB/function-types-classes.cpp | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/global-classes.cpp   | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/globals-bss.cpp  | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/globals-fundamental.cpp  | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/icf.cpp  | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp  | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/lit.local.cfg| 1 +
 lldb/test/Shell/SymbolFile/NativePDB/load-pdb.cpp | 2 +-
 .../Shell/SymbolFile/NativePDB/local-variables-registers.s| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp  | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp   | 4 ++--
 lldb/test/Shell/SymbolFile/NativePDB/lookup-by-address.cpp| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/lookup-by-types.cpp  | 2 +-
 .../Shell/SymbolFile/NativePDB/nested-blocks-same-address.s   | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/nested-types.cpp | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/s_constant.cpp   | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp  | 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/tag-types.cpp| 2 +-
 lldb/test/Shell/SymbolFile/NativePDB/typedefs.cpp | 2 +-
 lldb/test/Shell/SymbolFile/PDB/ast-restore.test   | 4 ++--
 lldb/test/Shell/SymbolFile/PDB/compilands.test| 2 +-
 lldb/test/Shell/SymbolFile/PDB/function-level-linking.test| 2 +-
 lldb/test/Shell/SymbolFile/PDB/lit.local.cfg  | 1 +
 lldb/test/Shell/SymbolFile/PDB/variables-locations.test   | 2 +-
 40 files changed, 43 insertions(+), 42 deletions(-)
 create mode 100644 lldb/test/Shell/SymbolFile/NativePDB/lit.local.cfg
 create mode 100644 lldb/test/Shell/SymbolFile/PDB/lit.local.cfg

diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
index b8154168aff3d1..c0ae6e73f36d8b 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
@@ -3,5 +3,5 @@
 
 // RUN: %build --compiler=msvc --nodefaultlib -o %t.exe -- %S/ast-functions.cpp
 
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
 // RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck 
%S/ast-functions.cpp
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
index 7eb7a2cbe7d9a4..d1cac393bbed9e 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
@@ -4,8 +4,7 @@
 // RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
 // RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe 
-pdb:%t.pdb
 
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
-// RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s
+// RUN: %lldb -f %t.exe -s %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s
 
 static int static_fn() {
   return 42;
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp 
b/lldb/test/Shell/Sym

[Lldb-commits] [lldb] [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) (PR #114346)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/114346

>From 2d4b486202194166471ccafd97ff63c399b2e822 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Wed, 30 Oct 2024 20:34:04 -0700
Subject: [PATCH 1/2] [lldb] Use PY_VERSION_HEX to simplify conditional
 compilation (NFC)

Use PY_VERSION_HEX to simplify conditional compilation depending on the
Python version.

This also adds a static_assert to lldb-python to error out with a
meaningful diagnostic when you try building LLDB with an older Python
version in preparation for [1].

[1] 
https://discourse.llvm.org/t/rfc-lets-document-and-enforce-a-minimum-python-version-for-lldb/82731/15
---
 .../Python/PythonDataObjects.cpp| 12 ++--
 .../Python/ScriptInterpreterPython.cpp  | 17 -
 .../ScriptInterpreter/Python/lldb-python.h  |  4 
 .../Python/PythonDataObjectsTests.cpp   |  2 +-
 4 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index 90ccd1055199a0..a0f8cf954f8040 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -71,12 +71,12 @@ Expected 
python::As(Expected &&obj) {
 }
 
 static bool python_is_finalizing() {
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 13) || (PY_MAJOR_VERSION > 3)
+#if PY_VERSION_HEX >= 0x030d
   return Py_IsFinalizing();
-#elif PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 7
-  return _Py_Finalizing != nullptr;
-#else
+#elif PY_VERSION_HEX >= 0x0307
   return _Py_IsFinalizing();
+#else
+  return _Py_Finalizing != nullptr;
 #endif
 }
 
@@ -810,7 +810,7 @@ bool PythonCallable::Check(PyObject *py_obj) {
   return PyCallable_Check(py_obj);
 }
 
-#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 3
+#if PY_VERSION_HEX >= 0x0303
 static const char get_arg_info_script[] = R"(
 from inspect import signature, Parameter, ismethod
 from collections import namedtuple
@@ -839,7 +839,7 @@ Expected 
PythonCallable::GetArgInfo() const {
   if (!IsValid())
 return nullDeref();
 
-#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 3
+#if PY_VERSION_HEX >= 0x0303
 
   // no need to synchronize access to this global, we already have the GIL
   static PythonScript get_arg_info(get_arg_info_script);
diff --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 7c2b6517468ff4..ef3c53ca5698db 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -71,8 +71,7 @@ extern "C" PyObject *PyInit__lldb(void);
 #define LLDB_USE_PYTHON_SET_INTERRUPT 0
 #else
 // PyErr_SetInterrupt was introduced in 3.2.
-#define LLDB_USE_PYTHON_SET_INTERRUPT  
\
-  (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 2) || (PY_MAJOR_VERSION > 3)
+#define LLDB_USE_PYTHON_SET_INTERRUPT PY_VERSION_HEX >= 0x0302
 #endif
 
 static ScriptInterpreterPythonImpl *GetPythonInterpreter(Debugger &debugger) {
@@ -92,7 +91,7 @@ namespace {
 struct InitializePythonRAII {
 public:
   InitializePythonRAII() {
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8) || (PY_MAJOR_VERSION > 3)
+#if PY_VERSION_HEX >= 0x0308
 PyConfig config;
 PyConfig_InitPythonConfig(&config);
 #endif
@@ -109,7 +108,7 @@ struct InitializePythonRAII {
   return spec.GetPath();
 }();
 if (!g_python_home.empty()) {
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8) || (PY_MAJOR_VERSION > 3)
+#if PY_VERSION_HEX >= 0x0308
   PyConfig_SetBytesString(&config, &config.home, g_python_home.c_str());
 #else
   size_t size = 0;
@@ -143,7 +142,7 @@ struct InitializePythonRAII {
   PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
 }
 
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8) || (PY_MAJOR_VERSION > 3)
+#if PY_VERSION_HEX >= 0x0308
 config.install_signal_handlers = 0;
 Py_InitializeFromConfig(&config);
 PyConfig_Clear(&config);
@@ -152,7 +151,7 @@ struct InitializePythonRAII {
 // Python < 3.2 and Python >= 3.2 reversed the ordering requirements for
 // calling `Py_Initialize` and `PyEval_InitThreads`.  < 3.2 requires that you
 // call `PyEval_InitThreads` first, and >= 3.2 requires that you call it last.
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 2)
+#if PY_VERSION_HEX >= 0x0302
 Py_InitializeEx(0);
 InitializeThreadsPrivate();
 #else
@@ -182,7 +181,7 @@ struct InitializePythonRAII {
 // would always return `true` and `PyGILState_Ensure/Release` flow would be
 // executed instead of unlocking GIL with `PyEval_SaveThread`. When
 // an another thread calls `PyGILState_Ensure` it would get stuck in deadlock.
-#if (PY_MAJOR_

[Lldb-commits] [lldb] 9ce0a61 - [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) (#114346)

2024-10-31 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-31T08:46:35-07:00
New Revision: 9ce0a61bdbf13d4d0f2e13e1bb6e7a4bb9d01858

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

LOG: [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) 
(#114346)

Use PY_VERSION_HEX to simplify conditional compilation depending on the
Python version.

This also adds a static_assert to lldb-python to error out with a
meaningful diagnostic when you try building LLDB with an older Python
version in preparation for [1].

[1]
https://discourse.llvm.org/t/rfc-lets-document-and-enforce-a-minimum-python-version-for-lldb/82731/15

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index 90ccd1055199a0..a0f8cf954f8040 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -71,12 +71,12 @@ Expected 
python::As(Expected &&obj) {
 }
 
 static bool python_is_finalizing() {
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 13) || (PY_MAJOR_VERSION > 3)
+#if PY_VERSION_HEX >= 0x030d
   return Py_IsFinalizing();
-#elif PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 7
-  return _Py_Finalizing != nullptr;
-#else
+#elif PY_VERSION_HEX >= 0x0307
   return _Py_IsFinalizing();
+#else
+  return _Py_Finalizing != nullptr;
 #endif
 }
 
@@ -810,7 +810,7 @@ bool PythonCallable::Check(PyObject *py_obj) {
   return PyCallable_Check(py_obj);
 }
 
-#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 3
+#if PY_VERSION_HEX >= 0x0303
 static const char get_arg_info_script[] = R"(
 from inspect import signature, Parameter, ismethod
 from collections import namedtuple
@@ -839,7 +839,7 @@ Expected 
PythonCallable::GetArgInfo() const {
   if (!IsValid())
 return nullDeref();
 
-#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 3
+#if PY_VERSION_HEX >= 0x0303
 
   // no need to synchronize access to this global, we already have the GIL
   static PythonScript get_arg_info(get_arg_info_script);

diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 7c2b6517468ff4..ef3c53ca5698db 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -71,8 +71,7 @@ extern "C" PyObject *PyInit__lldb(void);
 #define LLDB_USE_PYTHON_SET_INTERRUPT 0
 #else
 // PyErr_SetInterrupt was introduced in 3.2.
-#define LLDB_USE_PYTHON_SET_INTERRUPT  
\
-  (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 2) || (PY_MAJOR_VERSION > 3)
+#define LLDB_USE_PYTHON_SET_INTERRUPT PY_VERSION_HEX >= 0x0302
 #endif
 
 static ScriptInterpreterPythonImpl *GetPythonInterpreter(Debugger &debugger) {
@@ -92,7 +91,7 @@ namespace {
 struct InitializePythonRAII {
 public:
   InitializePythonRAII() {
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8) || (PY_MAJOR_VERSION > 3)
+#if PY_VERSION_HEX >= 0x0308
 PyConfig config;
 PyConfig_InitPythonConfig(&config);
 #endif
@@ -109,7 +108,7 @@ struct InitializePythonRAII {
   return spec.GetPath();
 }();
 if (!g_python_home.empty()) {
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8) || (PY_MAJOR_VERSION > 3)
+#if PY_VERSION_HEX >= 0x0308
   PyConfig_SetBytesString(&config, &config.home, g_python_home.c_str());
 #else
   size_t size = 0;
@@ -143,7 +142,7 @@ struct InitializePythonRAII {
   PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
 }
 
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8) || (PY_MAJOR_VERSION > 3)
+#if PY_VERSION_HEX >= 0x0308
 config.install_signal_handlers = 0;
 Py_InitializeFromConfig(&config);
 PyConfig_Clear(&config);
@@ -152,7 +151,7 @@ struct InitializePythonRAII {
 // Python < 3.2 and Python >= 3.2 reversed the ordering requirements for
 // calling `Py_Initialize` and `PyEval_InitThreads`.  < 3.2 requires that you
 // call `PyEval_InitThreads` first, and >= 3.2 requires that you call it last.
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 2)
+#if PY_VERSION_HEX >= 0x0302
 Py_InitializeEx(0);
 InitializeThreadsPrivate();
 #else
@@ -182,7 +181,7 @@ struct InitializePythonRAII {
 // would always return `true` and `PyGILState_Ensure/Release` flow woul

[Lldb-commits] [lldb] d6b9028 - [lldb] Extend FindTypes to optionally search by mangled type name (#113007)

2024-10-31 Thread via lldb-commits

Author: Augusto Noronha
Date: 2024-10-31T09:45:58-07:00
New Revision: d6b90282578f607dc18e23197d9494ebbb899437

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

LOG: [lldb] Extend FindTypes to optionally search by mangled type name (#113007)

Swift types have mangled type names. This adds functionality to look up
those types through the FindTypes API by searching for the mangled type
name instead of the regular name.

Added: 
lldb/test/Shell/SymbolFile/DWARF/debug-types-mangled-name.ll

Modified: 
lldb/include/lldb/Symbol/Type.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/tools/lldb-test/lldb-test.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 03d9f927997476..91188fe6ea4830 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -84,6 +84,9 @@ FLAGS_ENUM(TypeQueryOptions){
 /// matching type is found. When false, the type query should find all
 /// matching types.
 e_find_one = (1u << 4),
+// If set, treat TypeQuery::m_name as a mangled name that should be
+// searched.
+e_search_by_mangled_name = (1u << 5),
 };
 LLDB_MARK_AS_BITMASK_ENUM(TypeQueryOptions)
 
@@ -300,6 +303,19 @@ class TypeQuery {
   m_options &= ~e_find_one;
   }
 
+  /// Returns true if the type query is supposed to treat the name to be
+  /// searched as a mangled name.
+  bool GetSearchByMangledName() const {
+return (m_options & e_search_by_mangled_name) != 0;
+  }
+
+  void SetSearchByMangledName(bool b) {
+if (b)
+  m_options |= e_search_by_mangled_name;
+else
+  m_options &= ~e_search_by_mangled_name;
+  }
+
   /// Access the internal compiler context array.
   ///
   /// Clients can use this to populate the context manually.

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index d83740f8e2113b..4c9f1d8505f6e6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -199,9 +199,9 @@ DWARFDIE::LookupDeepestBlock(lldb::addr_t address) const {
   return result;
 }
 
-const char *DWARFDIE::GetMangledName() const {
+const char *DWARFDIE::GetMangledName(bool substitute_name_allowed) const {
   if (IsValid())
-return m_die->GetMangledName(m_cu);
+return m_die->GetMangledName(m_cu, substitute_name_allowed);
   else
 return nullptr;
 }

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
index e1318953a384cd..077b78eb26d0c3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
@@ -28,7 +28,7 @@ class DWARFDIE : public DWARFBaseDIE {
   // Accessors
 
   // Accessing information about a DIE
-  const char *GetMangledName() const;
+  const char *GetMangledName(bool substitute_name_allowed = true) const;
 
   const char *GetPubname() const;
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index f23f8cc3d781d0..f39189b6cead42 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2758,6 +2758,20 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, 
TypeResults &results) {
 return true; // Keep iterating over index types, language mismatch.
 }
 
+// Since mangled names are unique, we only need to check if the names are
+// the same.
+if (query.GetSearchByMangledName()) {
+  if (die.GetMangledName(/*substitute_name_allowed=*/false) !=
+  query.GetTypeBasename().GetStringRef())
+return true; // Keep iterating over index types, mangled name mismatch.
+  if (Type *matching_type = ResolveType(die, true, true)) {
+results.InsertUnique(matching_type->shared_from_this());
+return !results.Done(query); // Keep iterating if we aren't done.
+  }
+  return true; // Keep iterating over index types, weren't able to resolve
+   // this type
+}
+
 // Check the context matches
 std::vector die_context;
 if (query.GetModuleSearch())

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/debug-types-mangled-name.ll 
b/lldb/test/Shell/SymbolFile/DWARF/debug-types-mangled-name.ll
new file mode 100644
index 00..06dd817fc0f392
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/debug-types-mangled-name.ll
@@ -0,0 +1,63 @@
+; Test finding types by CompilerContext.
+; REQUIRES: aarch64
+; RUN: llc %s -filetype=obj -o %t.o
+; RUN: lldb-test 

[Lldb-commits] [lldb] [lldb][test] Fix `LibCxxInternalsRecognizerTestCase` on clang <= 17 (PR #114122)

2024-10-31 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] [lldb][test] Skip one inline stepping test for arm-ubuntu. (PR #114295)

2024-10-31 Thread via lldb-commits

jimingham wrote:

Thanks for the analysis.  The other bit that lldb looks at (which is what I 
added with the patch this change is the result of) is the DW_AT_call_{file, 
line} info in the debug_info part of the DWARF for that function.  Before we 
ignored that information when setting breakpoints.  What do those look like?

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


[Lldb-commits] [lldb] [lldb] Add a link to LLDB's Discord channel on the website (PR #114289)

2024-10-31 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

Unfortunately older videos are regularly being removed. We should probably 
remove the links and add https://developer.apple.com/videos/play/wwdc2024/10198 
instead.

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


[Lldb-commits] [lldb] 2aed0d9 - [lldb][test] Fix `LibCxxInternalsRecognizerTestCase` on clang <= 17 (#114122)

2024-10-31 Thread via lldb-commits

Author: Adrian Vogelsgesang
Date: 2024-10-31T09:01:46-07:00
New Revision: 2aed0d9cd3fc8f3c600d59b8b10d10a4466e50c6

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

LOG: [lldb][test] Fix `LibCxxInternalsRecognizerTestCase` on clang <= 17 
(#114122)

We had to disable the tests for libc++ <= 15 because the `std::ranges`
functions were not available, yet.

Also, on libc++17 there was still an additional `__fn` struct withing
`ranges::__sort`. The test expectation was updated to use a regular
expression, so we can match both the old and the new name.

See
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake-matrix/912/execution/node/107/log/

Added: 


Modified: 

lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py
 
b/lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py
index ad48208f21e502..5cc43f3cd9910c 100644
--- 
a/lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py
+++ 
b/lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py
@@ -3,11 +3,13 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+import re
 
 class LibCxxInternalsRecognizerTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
 @add_test_categories(["libc++"])
+@skipIf(compiler="clang", compiler_version=["<", "16.0"])
 def test_frame_recognizer(self):
 """Test that implementation details of libc++ are hidden"""
 self.build()
@@ -21,7 +23,7 @@ def test_frame_recognizer(self):
 # We never hide the frame of the entry-point into the standard 
library, even
 # if the name starts with `__` which usually indicates an internal 
function.
 "ranges_sort_less(int, int)": [
-"ranges::__sort::operator()",
+re.compile("ranges::__sort::(__fn::)?operator\(\)"),
 "test_algorithms",
 ],
 # `ranges::views::transform` internally uses `std::invoke`, and 
that
@@ -57,9 +59,14 @@ def test_frame_recognizer(self):
 ):
 frame_id = frame_id + 1
 # Expect the correct parent frame
-self.assertIn(
-expected_parent, 
thread.GetFrameAtIndex(frame_id).GetFunctionName()
-)
+func_name = thread.GetFrameAtIndex(frame_id).GetFunctionName()
+if isinstance(expected_parent, re.Pattern):
+self.assertTrue(
+expected_parent.search(func_name) is not None,
+f"'{expected_parent}' not found in '{func_name}'"
+)
+else:
+self.assertIn(expected_parent, func_name)
 frame_id = frame_id + 1
 process.Continue()
 



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


[Lldb-commits] [lldb] [lldb][test] Fix `LibCxxInternalsRecognizerTestCase` on clang <= 17 (PR #114122)

2024-10-31 Thread Felipe de Azevedo Piovezan via lldb-commits

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

Awesome, thank you!

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


[Lldb-commits] [lldb] [lldb][test] Fix `LibCxxInternalsRecognizerTestCase` on clang <= 17 (PR #114122)

2024-10-31 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

@vogelsgesang since I don't know if our timezones align, I am going to take the 
liberty to click the merge button here to see if we can get the bots green 
again! 

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> process launch -w does not carry the working dir to subsequent launches.
> * Please open an issue for that.

Actually this is not a bug. `process launch` and `run` are two separate (at 
least from the user perpsective) ways to run a program.

I think if you should just add to this help text:
```
   -w  ( --working-dir  )
Set the current working directory to  when running the 
inferior.
```
To note that it only applies to that launch and that anyone who wants a sticky 
setting, should use the setting you're adding here.

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


[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)

2024-10-31 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang updated 
https://github.com/llvm/llvm-project/pull/113787

>From af45bc2e24623d7225d24a4680a28630d67d636e Mon Sep 17 00:00:00 2001
From: Adrian Vogelsgesang 
Date: Sat, 26 Oct 2024 14:34:31 +
Subject: [PATCH 1/4] [lldb-dap] Support column breakpoints

This commit adds support for column breakpoints to lldb-dap.

To do so, support for `breakpointLocations` was added. To find all
available breakpoint positions, we iterate over the line table.

The `setBreakpoints` request already forwarded the column correctly to
`SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap`
did not keep track of multiple breakpoints in the same line. To do so,
the `SourceBreakpointMap` is now indexed by line+column instead of by
line only.

See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a
high-level introduction to column breakpoints.
---
 .../test/tools/lldb-dap/dap_server.py |  30 ++-
 .../API/tools/lldb-dap/breakpoint/Makefile|   2 +-
 .../breakpoint/TestDAP_breakpointLocations.py |  74 +++
 .../breakpoint/TestDAP_setBreakpoints.py  | 172 +--
 lldb/tools/lldb-dap/DAP.h |   2 +-
 lldb/tools/lldb-dap/lldb-dap.cpp  | 197 +-
 .../llvm/DebugInfo/DWARF/DWARFDebugLine.h |   2 +-
 7 files changed, 393 insertions(+), 86 deletions(-)
 create mode 100644 
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 63748a71f1122d..659408c709a249 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -612,6 +612,22 @@ def request_attach(
 command_dict = {"command": "attach", "type": "request", "arguments": 
args_dict}
 return self.send_recv(command_dict)
 
+def request_breakpointLocations(self, file_path, line, end_line=None, 
column=None, end_column=None):
+(dir, base) = os.path.split(file_path)
+source_dict = {"name": base, "path": file_path}
+args_dict = {}
+args_dict["source"] = source_dict
+if line is not None:
+   args_dict["line"] = line
+if end_line is not None:
+args_dict["endLine"] = end_line
+if column is not None:
+args_dict["column"] = column
+if end_column is not None:
+args_dict["endColumn"] = end_column
+command_dict = {"command": "breakpointLocations", "type": "request", 
"arguments": args_dict}
+return self.send_recv(command_dict)
+
 def request_configurationDone(self):
 command_dict = {
 "command": "configurationDone",
@@ -912,18 +928,14 @@ def request_setBreakpoints(self, file_path, line_array, 
data=None):
 breakpoint_data = data[i]
 bp = {"line": line}
 if breakpoint_data is not None:
-if "condition" in breakpoint_data and 
breakpoint_data["condition"]:
+if breakpoint_data.get("condition"):
 bp["condition"] = breakpoint_data["condition"]
-if (
-"hitCondition" in breakpoint_data
-and breakpoint_data["hitCondition"]
-):
+if breakpoint_data.get("hitCondition"):
 bp["hitCondition"] = breakpoint_data["hitCondition"]
-if (
-"logMessage" in breakpoint_data
-and breakpoint_data["logMessage"]
-):
+if breakpoint_data.get("logMessage"):
 bp["logMessage"] = breakpoint_data["logMessage"]
+if breakpoint_data.get("column"):
+bp["column"] = breakpoint_data["column"]
 breakpoints.append(bp)
 args_dict["breakpoints"] = breakpoints
 
diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile 
b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile
index 7634f513e85233..06438b3e6e3139 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile
@@ -16,4 +16,4 @@ main-copy.cpp: main.cpp
 # The following shared library will be used to test breakpoints under dynamic 
loading
 libother:  other-copy.c
"$(MAKE)" -f $(MAKEFILE_RULES) \
-   DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other 
+   DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other
diff --git 
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
new file mode 100644
index 00..d84ce843e3fba8
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_b

[Lldb-commits] [lldb] 3bc58fc - [lldb][test] Fix FileActionTest.cpp for Windows (#112657)

2024-10-31 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2024-10-31T14:37:32+05:00
New Revision: 3bc58fc7f79a9b0cbf931573cb257344bfeaca1e

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

LOG: [lldb][test] Fix FileActionTest.cpp for Windows (#112657)

Disable part of the test failing on windows. as O_NOCTTY and
O_RDONLY dont have same behavior on windows vs linux.

Added: 


Modified: 
lldb/unittests/Host/FileActionTest.cpp

Removed: 




diff  --git a/lldb/unittests/Host/FileActionTest.cpp 
b/lldb/unittests/Host/FileActionTest.cpp
index 56227cd587e5bb..ac067c4d3349b8 100644
--- a/lldb/unittests/Host/FileActionTest.cpp
+++ b/lldb/unittests/Host/FileActionTest.cpp
@@ -34,7 +34,9 @@ TEST(FileActionTest, OpenReadWrite) {
 TEST(FileActionTest, OpenReadOnly) {
   FileAction Action;
   Action.Open(49, FileSpec("/tmp_1"), /*read*/ true, /*write*/ false);
+#ifndef _WIN32
   EXPECT_TRUE(Action.GetActionArgument() & (O_NOCTTY | O_RDONLY));
+#endif
   EXPECT_FALSE(Action.GetActionArgument() & O_WRONLY);
 }
 



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


[Lldb-commits] [lldb] Fix pointer to reference type (PR #113596)

2024-10-31 Thread Pavel Labath via lldb-commits

labath wrote:

I can believe that this behavior is undesirable. Like I said, I totally 
understand *why* you did this. It's the *how* I have a problem with. I don't 
believe the we've sufficiently considered the bigger picture. Why does 
`AddressOf` handle references transparently and `Dereference` does not? Are 
there any other methods that need to be changed to make the ValueObject 
interface consistent? Is this even the right level (we're about six layers away 
from VSCode) to implement this behavior?

If you think about it even the implementation of the patch is a bit strange -- 
this is the first "address of" operation that's implemented in terms of 
"dereferencing" (and if we changed "dereference" to be transparent, this 
implementation would break).

Please don't take this personally. I can certainly see how you could have 
though you're making an obvious bugfix here. But, in light of what I've just 
said, I think this needs more discussion (and I think this ought to be reverted 
until that is done). @jimingham, as the own^Wmaintainter of the ValueObject 
library, what do you think?

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


[Lldb-commits] [lldb] [LLDB] Finish implementing support for DW_FORM_data16 (PR #113508)

2024-10-31 Thread Pavel Labath via lldb-commits

labath wrote:

> I think the code itself seems fine, especially if Pavel's suggestion shows 
> that the test works.

I actually did check that `129440743495415807670381713415221633377` is 
`0x61616161616161616161616161616161` (and it seems that the dwarf parser is 
robust enough to ignore the extra ``s at the end). But this is not a test 
for the handling of malformed dwarf..

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


[Lldb-commits] [lldb] [lldb][test] Fix `LibCxxInternalsRecognizerTestCase` on clang <= 17 (PR #114122)

2024-10-31 Thread Michael Buch via lldb-commits

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

LGTM thx!

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


[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)

2024-10-31 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang updated 
https://github.com/llvm/llvm-project/pull/113787

>From af45bc2e24623d7225d24a4680a28630d67d636e Mon Sep 17 00:00:00 2001
From: Adrian Vogelsgesang 
Date: Sat, 26 Oct 2024 14:34:31 +
Subject: [PATCH 1/5] [lldb-dap] Support column breakpoints

This commit adds support for column breakpoints to lldb-dap.

To do so, support for `breakpointLocations` was added. To find all
available breakpoint positions, we iterate over the line table.

The `setBreakpoints` request already forwarded the column correctly to
`SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap`
did not keep track of multiple breakpoints in the same line. To do so,
the `SourceBreakpointMap` is now indexed by line+column instead of by
line only.

See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a
high-level introduction to column breakpoints.
---
 .../test/tools/lldb-dap/dap_server.py |  30 ++-
 .../API/tools/lldb-dap/breakpoint/Makefile|   2 +-
 .../breakpoint/TestDAP_breakpointLocations.py |  74 +++
 .../breakpoint/TestDAP_setBreakpoints.py  | 172 +--
 lldb/tools/lldb-dap/DAP.h |   2 +-
 lldb/tools/lldb-dap/lldb-dap.cpp  | 197 +-
 .../llvm/DebugInfo/DWARF/DWARFDebugLine.h |   2 +-
 7 files changed, 393 insertions(+), 86 deletions(-)
 create mode 100644 
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 63748a71f1122d..659408c709a249 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -612,6 +612,22 @@ def request_attach(
 command_dict = {"command": "attach", "type": "request", "arguments": 
args_dict}
 return self.send_recv(command_dict)
 
+def request_breakpointLocations(self, file_path, line, end_line=None, 
column=None, end_column=None):
+(dir, base) = os.path.split(file_path)
+source_dict = {"name": base, "path": file_path}
+args_dict = {}
+args_dict["source"] = source_dict
+if line is not None:
+   args_dict["line"] = line
+if end_line is not None:
+args_dict["endLine"] = end_line
+if column is not None:
+args_dict["column"] = column
+if end_column is not None:
+args_dict["endColumn"] = end_column
+command_dict = {"command": "breakpointLocations", "type": "request", 
"arguments": args_dict}
+return self.send_recv(command_dict)
+
 def request_configurationDone(self):
 command_dict = {
 "command": "configurationDone",
@@ -912,18 +928,14 @@ def request_setBreakpoints(self, file_path, line_array, 
data=None):
 breakpoint_data = data[i]
 bp = {"line": line}
 if breakpoint_data is not None:
-if "condition" in breakpoint_data and 
breakpoint_data["condition"]:
+if breakpoint_data.get("condition"):
 bp["condition"] = breakpoint_data["condition"]
-if (
-"hitCondition" in breakpoint_data
-and breakpoint_data["hitCondition"]
-):
+if breakpoint_data.get("hitCondition"):
 bp["hitCondition"] = breakpoint_data["hitCondition"]
-if (
-"logMessage" in breakpoint_data
-and breakpoint_data["logMessage"]
-):
+if breakpoint_data.get("logMessage"):
 bp["logMessage"] = breakpoint_data["logMessage"]
+if breakpoint_data.get("column"):
+bp["column"] = breakpoint_data["column"]
 breakpoints.append(bp)
 args_dict["breakpoints"] = breakpoints
 
diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile 
b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile
index 7634f513e85233..06438b3e6e3139 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile
@@ -16,4 +16,4 @@ main-copy.cpp: main.cpp
 # The following shared library will be used to test breakpoints under dynamic 
loading
 libother:  other-copy.c
"$(MAKE)" -f $(MAKEFILE_RULES) \
-   DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other 
+   DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other
diff --git 
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py
new file mode 100644
index 00..d84ce843e3fba8
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_b

[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Pavel Labath via lldb-commits


@@ -1810,7 +1813,27 @@ 
SymbolFileNativePDB::ParseVariablesForCompileUnit(CompileUnit &comp_unit,
   VariableList &variables) {
   PdbSymUid sym_uid(comp_unit.GetID());
   lldbassert(sym_uid.kind() == PdbSymUidKind::Compiland);
-  return 0;
+  for (const uint32_t gid : m_index->globals().getGlobalsTable()) {
+PdbGlobalSymId global{gid, false};
+CVSymbol sym = m_index->ReadSymbolRecord(global);
+// TODO: Handle S_CONSTANT which might be a record type (e.g.
+// std::strong_ordering::equal). Currently
+// lldb_private::npdb::MakeConstantLocationExpression doesn't handle this
+// case and will crash if we do create global variables from it.

labath wrote:

Is there some simple fix which would make it not crash at least?

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


[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Pavel Labath via lldb-commits


@@ -365,18 +365,20 @@ void SymbolFileNativePDB::InitializeObject() {
 }
 
 uint32_t SymbolFileNativePDB::CalculateNumCompileUnits() {
+  if (m_cu_count)
+return *m_cu_count;

labath wrote:

`CalculateNumCompileUnits` is wrapped by `GetNumCompileUnits`, which makes sure 
the computation happens only once. I think you can delete this variable and 
just call `GetNumCompileUnits` everywhere.

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


[Lldb-commits] [lldb] [lldb] Set return status to Failed when Python command raises uncaught exception (PR #113996)

2024-10-31 Thread Pavel Labath via lldb-commits


@@ -642,6 +649,16 @@ bool 
lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommandObject(
   pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger)), PythonString(args),
 SWIGBridge::ToSWIGWrapper(exe_ctx_ref_sp), cmd_retobj_arg.obj());
 
+  if (PyErr_Occurred()) {
+py_err_cleaner.~PyErr_Cleaner();

labath wrote:

I'm pretty sure this is undefined behavior (you calling the destructor does not 
stop the compiler from calling it again).

I think that a proper fix for this would be to change 
`PythonCallable::operator()` to return `Expected` (and convert 
the python exception to llvm::error, etc). A lot of the PythonDataObject 
methods were converted to do that (see comment at the top of the header), but 
it looks like this is not one of them.

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


[Lldb-commits] [lldb] [lldb][test] Skip libc++ tests if it is linked statically (PR #113935)

2024-10-31 Thread Michael Buch via lldb-commits

Michael137 wrote:

Agree with Pavel.

> When libcxx is linked with a program as an archive of static libraries,
functions that aren't used in the program are omitted.

This really isn't the problem. The tests *want* those symbols to not be present 
and make sure that we can find those in the `std` Clang module. So I'm pretty 
sure the issue isn't about what symbols get stripped from the library

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread Pavel Labath via lldb-commits

labath wrote:

> Friendly ping, otherwise I'll merge it in a couple of days

[One week](https://llvm.org/docs/CodeReview.html#lgtm-how-a-patch-is-accepted) 
is the *minimum time for a ping* (you pinged after six days). It's not the 
*maximum time for a review* (there isn't one).

(Practically speaking, if you feel your reviews are going slower than usual, it 
could be because a lot of the devs were at the conference last week. I'm still 
catching up with the backlog.)

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


[Lldb-commits] [lldb] [lldb][test] Skip libc++ tests if it is linked statically (PR #113935)

2024-10-31 Thread Pavel Labath via lldb-commits

labath wrote:

> Agree with Pavel.

I'm not sure you do :P

> 
> > When libcxx is linked with a program as an archive of static libraries,
> > functions that aren't used in the program are omitted.
> 
> This really isn't the problem. The tests _want_ those symbols to not be 
> present and make sure that we can find those in the `std` Clang module. So 
> I'm pretty sure the issue isn't about what symbols get stripped from the 
> library

There are different kinds of symbols going around here. The symbol you don't 
want to be in the binary is `std::vector::at()` (because it can be generated 
from the c++ module and stuff). However, the implementation of `at()` will call 
(on the failure path) __libcxx_throw_out_of_range (or something, I forgot it's 
name), which is a non-template function defined only in some libc++ source (not 
header) file. The libc++ module will not contain a definition of that. And if 
the program never calls it, the symbol won't be extracted from the archive. I 
think the fix is to make sure this function is present (by depending on it in 
some way), without pulling in std::vector and friends.

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


[Lldb-commits] [lldb] Fix pointer to reference type (PR #113596)

2024-10-31 Thread Pavel Labath via lldb-commits

labath wrote:

Regarding the vector summary example, it looks like that there's still a lot of 
room for improvement there. This is what I get before this patch:
```
(lldb) v v vp vr vpr &v &vp &vr &vpr
(std::vector) v = size=2 {
  [0] = 0
  [1] = 0
}
(std::vector *) vp = 0x7fffd7b0 size=2
(std::vector &) vr = size=2: {
  [0] = 0
  [1] = 0
}
(std::vector *&) vpr = size=1: {
  &vpr = 0x7fffd7b0 size=2
}
(std::vector *) &v = 0x7fffd7b0 size=2
(std::vector **) &vp = 0x7fffd7a0 size=1
(std::vector &*) &vr = 0x7fffd790 size=1
(std::vector *&*) &vpr = 0x7fffd788 size=1
```

And this comes after it:
```
(lldb) v v vp vr vpr &v &vp &vr &vpr
(std::vector) v = size=2 {
  [0] = 0
  [1] = 0
}
(std::vector *) vp = 0x7fffd7b0 size=2
(std::vector &) vr = size=2: {
  [0] = 0
  [1] = 0
}
(std::vector *&) vpr = size=1: {
  &vpr = 0x7fffd7b0 size=2
}
(std::vector *) &v = 0x7fffd7b0 size=2
(std::vector **) &vp = 0x7fffd7a0 size=1
(std::vector *) &&vr = 0x7fffd7b0 size=2
(std::vector **) &&vpr = 0x7fffd7a0 size=1
```

The output for `&vr` changes (for the better, I guess), but `vpr`, `&vp` and 
`&vpr` are still extremely dubios, so if you want to tackle this issue 
seriously, then we also need to discuss what should the data formatters/summary 
providers do when faced with nested pointers and references.

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


[Lldb-commits] [lldb] [lldb] Set return status to Failed when Python command raises uncaught exception (PR #113996)

2024-10-31 Thread Pavel Labath via lldb-commits


@@ -592,6 +592,8 @@ void 
*lldb_private::python::LLDBSWIGPython_CastPyObjectToSBExecutionContext(PyOb
   return sb_ptr;
 }
 
+#include "lldb/Interpreter/CommandReturnObject.h"

labath wrote:

Can we put this some place more reasonable (next to the other includes in 
`python.swig` ?)

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


[Lldb-commits] [lldb] [lldb] Create dependent modules in parallel (PR #114507)

2024-10-31 Thread via lldb-commits

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 d1b311d7d2258531decaea9556d2e96ce2433817 
9a269fa83cea529f704c9eba339eac9987032155 --extensions cpp -- 
lldb/source/Target/Target.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index ef5d38fc79..ad38e6138c 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1631,7 +1631,7 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
   std::lock_guard guard(dependent_files_mutex);
   for (; i < dependent_files.GetSize(); i++)
 task_group.async(GetDependentModules,
-dependent_files.GetFileSpecAtIndex(i));
+ dependent_files.GetFileSpecAtIndex(i));
 }
 task_group.wait();
   }

``




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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread Walter Erquinigo via lldb-commits


@@ -4428,6 +4428,15 @@ void TargetProperties::SetDisableSTDIO(bool b) {
   const uint32_t idx = ePropertyDisableSTDIO;
   SetPropertyAtIndex(idx, b);
 }
+std::optional
+TargetProperties::GetLaunchWorkingDirectory() const {

walter-erquinigo wrote:

Yeah, that makes sense, also because of consistency with the rest of the code

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


[Lldb-commits] [lldb] [lldb] Create dependent modules in parallel (PR #114507)

2024-10-31 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Create dependent modules in parallel in Target::SetExecutableModule. This 
change was inspired by #110646 which takes the same approach when 
attaching. Jason suggested we could use the same approach when you create a 
target in LLDB.

I used Slack for benchmarking, which loads 902 images.

```
Benchmark 1: ./bin/lldb /Applications/Slack.app/Contents/MacOS/Slack
  Time (mean ± σ):  1.225 s ±  0.003 s[User: 3.977 s, System: 1.521 s]
  Range (min … max):1.220 s …  1.229 s10 runs

Benchmark 2: ./bin/lldb /Applications/Slack.app/Contents/MacOS/Slack
  Time (mean ± σ):  3.253 s ±  0.037 s[User: 3.013 s, System: 0.248 s]
  Range (min … max):3.211 s …  3.310 s10 runs
```

We see about a 2x speedup, which matches what Jason saw for the attach 
scenario. I also ran this under TSan to confirm this doesn't introduce any 
races or deadlocks.

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


1 Files Affected:

- (modified) lldb/source/Target/Target.cpp (+28-5) 


``diff
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 199efae8a728cc..ef5d38fc796b08 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -68,6 +68,7 @@
 
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/Support/ThreadPool.h"
 
 #include 
 #include 
@@ -1575,7 +1576,6 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
m_arch.GetSpec().GetTriple().getTriple());
 }
 
-FileSpecList dependent_files;
 ObjectFile *executable_objfile = executable_sp->GetObjectFile();
 bool load_dependents = true;
 switch (load_dependent_files) {
@@ -1591,10 +1591,14 @@ void Target::SetExecutableModule(ModuleSP 
&executable_sp,
 }
 
 if (executable_objfile && load_dependents) {
+  // FileSpecList is not thread safe and needs to be synchronized.
+  FileSpecList dependent_files;
+  std::mutex dependent_files_mutex;
+
+  // ModuleList is thread safe.
   ModuleList added_modules;
-  executable_objfile->GetDependentModules(dependent_files);
-  for (uint32_t i = 0; i < dependent_files.GetSize(); i++) {
-FileSpec dependent_file_spec(dependent_files.GetFileSpecAtIndex(i));
+
+  auto GetDependentModules = [&](FileSpec dependent_file_spec) {
 FileSpec platform_dependent_file_spec;
 if (m_platform_sp)
   m_platform_sp->GetFileWithUUID(dependent_file_spec, nullptr,
@@ -1608,9 +1612,28 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
 if (image_module_sp) {
   added_modules.AppendIfNeeded(image_module_sp, false);
   ObjectFile *objfile = image_module_sp->GetObjectFile();
-  if (objfile)
+  if (objfile) {
+std::lock_guard guard(dependent_files_mutex);
 objfile->GetDependentModules(dependent_files);
+  }
+}
+  };
+
+  executable_objfile->GetDependentModules(dependent_files);
+
+  llvm::ThreadPoolTaskGroup task_group(Debugger::GetThreadPool());
+  for (uint32_t i = 0; i < dependent_files.GetSize(); i++) {
+// Process all currently known dependencies in parallel in the 
innermost
+// loop. This may create newly discovered dependencies to be appended 
to
+// dependent_files. We'll deal with these files during the next
+// iteration of the outermost loop.
+{
+  std::lock_guard guard(dependent_files_mutex);
+  for (; i < dependent_files.GetSize(); i++)
+task_group.async(GetDependentModules,
+dependent_files.GetFileSpecAtIndex(i));
 }
+task_group.wait();
   }
   ModulesDidLoad(added_modules);
 }

``




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


[Lldb-commits] [lldb] [lldb] Create dependent modules in parallel (PR #114507)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/114507

Create dependent modules in parallel in Target::SetExecutableModule. This 
change was inspired by #110646 which takes the same approach when attaching. 
Jason suggested we could use the same approach when you create a target in LLDB.

I used Slack for benchmarking, which loads 902 images.

```
Benchmark 1: ./bin/lldb /Applications/Slack.app/Contents/MacOS/Slack
  Time (mean ± σ):  1.225 s ±  0.003 s[User: 3.977 s, System: 1.521 s]
  Range (min … max):1.220 s …  1.229 s10 runs

Benchmark 2: ./bin/lldb /Applications/Slack.app/Contents/MacOS/Slack
  Time (mean ± σ):  3.253 s ±  0.037 s[User: 3.013 s, System: 0.248 s]
  Range (min … max):3.211 s …  3.310 s10 runs
```

We see about a 2x speedup, which matches what Jason saw for the attach 
scenario. I also ran this under TSan to confirm this doesn't introduce any 
races or deadlocks.

>From 9a269fa83cea529f704c9eba339eac9987032155 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 31 Oct 2024 21:42:38 -0700
Subject: [PATCH] [lldb] Create dependent modules in parallel
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Create dependent modules in parallel in Target::SetExecutableModule.
This change was inspired by #110646 which takes the same approach when
attaching. Jason suggested we could use the same approach when you
create a target in LLDB.

I used Slack for benchmarking, which loads 902 images.

  Benchmark 1: ./bin/lldb /Applications/Slack.app/Contents/MacOS/Slack
Time (mean ± σ):  1.225 s ±  0.003 s[User: 3.977 s, System: 1.521 s]
Range (min … max):1.220 s …  1.229 s10 runs

  Benchmark 2: ./bin/lldb /Applications/Slack.app/Contents/MacOS/Slack
Time (mean ± σ):  3.253 s ±  0.037 s[User: 3.013 s, System: 0.248 s]
Range (min … max):3.211 s …  3.310 s10 runs

We see about a 2x speedup, which matches what Jason saw for the attach
scenario. I also ran this under TSan to confirm this doesn't introduce
any races or deadlocks.
---
 lldb/source/Target/Target.cpp | 33 -
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 199efae8a728cc..ef5d38fc796b08 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -68,6 +68,7 @@
 
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/Support/ThreadPool.h"
 
 #include 
 #include 
@@ -1575,7 +1576,6 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
m_arch.GetSpec().GetTriple().getTriple());
 }
 
-FileSpecList dependent_files;
 ObjectFile *executable_objfile = executable_sp->GetObjectFile();
 bool load_dependents = true;
 switch (load_dependent_files) {
@@ -1591,10 +1591,14 @@ void Target::SetExecutableModule(ModuleSP 
&executable_sp,
 }
 
 if (executable_objfile && load_dependents) {
+  // FileSpecList is not thread safe and needs to be synchronized.
+  FileSpecList dependent_files;
+  std::mutex dependent_files_mutex;
+
+  // ModuleList is thread safe.
   ModuleList added_modules;
-  executable_objfile->GetDependentModules(dependent_files);
-  for (uint32_t i = 0; i < dependent_files.GetSize(); i++) {
-FileSpec dependent_file_spec(dependent_files.GetFileSpecAtIndex(i));
+
+  auto GetDependentModules = [&](FileSpec dependent_file_spec) {
 FileSpec platform_dependent_file_spec;
 if (m_platform_sp)
   m_platform_sp->GetFileWithUUID(dependent_file_spec, nullptr,
@@ -1608,9 +1612,28 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
 if (image_module_sp) {
   added_modules.AppendIfNeeded(image_module_sp, false);
   ObjectFile *objfile = image_module_sp->GetObjectFile();
-  if (objfile)
+  if (objfile) {
+std::lock_guard guard(dependent_files_mutex);
 objfile->GetDependentModules(dependent_files);
+  }
+}
+  };
+
+  executable_objfile->GetDependentModules(dependent_files);
+
+  llvm::ThreadPoolTaskGroup task_group(Debugger::GetThreadPool());
+  for (uint32_t i = 0; i < dependent_files.GetSize(); i++) {
+// Process all currently known dependencies in parallel in the 
innermost
+// loop. This may create newly discovered dependencies to be appended 
to
+// dependent_files. We'll deal with these files during the next
+// iteration of the outermost loop.
+{
+  std::lock_guard guard(dependent_files_mutex);
+  for (; i < dependent_files.GetSize(); i++)
+task_group.async(GetDependentModules,
+dependent_files.GetFileSpecAtIndex(i));
 }
+task_group.wait();
   }
   ModulesDidLoad(added_modules);
 }

_

[Lldb-commits] [lldb] [lldb] Create dependent modules in parallel (PR #114507)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

CC @DmT021

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


[Lldb-commits] [lldb] [lldb] Create dependent modules in parallel (PR #114507)

2024-10-31 Thread Jason Molenda via lldb-commits

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

It took me a minute to understand how you were handling the locking of the 
dependent file list while iterating across it, but now I see it.  You grab the 
lock at the beginning of the outer loop, then enqueue all of the 
not-yet-processed dependent binaries into asynchronous threads.  They are all 
creating the Modules and then blocking to acquire the lock, to add their 
entries to the dependent files list.  The inner loop finishes distributing 
things to the thread pool, releases its lock, and waits for all the 
just-started async jobs to complete.  Then we are back in the outer loop which 
reads the size of the dependent file list.

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


[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Jonas Devlieghere via lldb-commits


@@ -265,6 +265,7 @@ class SymbolFileNativePDB : public SymbolFileCommon {
   // UID for anonymous union and anonymous struct as they don't have entities 
in
   // pdb debug info.
   lldb::user_id_t anonymous_id = LLDB_INVALID_UID - 1;
+  std::optional m_cu_count = 0;

JDevlieghere wrote:

Unrelated? 

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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-31 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

Sorry, I thought it had been 1 week already. I'll be mindful of that next time. 
And yeah, it's natural that the conference slowed things down.

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


[Lldb-commits] [lldb] [lldb] Improve command status when dwim-print has no result (PR #114478)

2024-10-31 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


1 Files Affected:

- (modified) lldb/source/Commands/CommandObjectDWIMPrint.cpp (+1-1) 


``diff
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index f5aa6a287b6f46..76bed100dc7291 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -231,7 +231,7 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
 if (valobj_sp->GetError().GetError() != UserExpression::kNoResult)
   dump_val_object(*valobj_sp);
 else
-  result.SetStatus(eReturnStatusSuccessFinishResult);
+  result.SetStatus(eReturnStatusSuccessFinishNoResult);
 
 if (suppress_result)
   if (auto result_var_sp =

``




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


[Lldb-commits] [lldb] [lldb] Implement a formatter bytecode interpreter in C++ (PR #114333)

2024-10-31 Thread Jonas Devlieghere via lldb-commits


@@ -1537,6 +1538,154 @@ static void LoadScriptingResourceForModule(const 
ModuleSP &module_sp,
   feedback_stream.GetData());
 }
 
+static void ForEachFormatterInModule(
+Module &module, SectionType section_type,
+std::function fn) {
+  auto *sections = module.GetSectionList();
+  if (!sections)
+return;
+
+  auto section_sp = sections->FindSectionByType(section_type, true);
+  if (!section_sp)
+return;
+
+  TypeCategoryImplSP category;
+  DataVisualization::Categories::GetCategory(ConstString("default"), category);
+
+  // The type summary record is serialized as follows.
+  //
+  // Each record contains, in order:
+  //   * Version number of the record format
+  //   * The remaining size of the record
+  //   * The size of the type identifier
+  //   * The type identifier, either a type name, or a regex
+  //   * The size of the entry
+  //   * The entry
+  //
+  // Integers are encoded using ULEB.
+  //
+  // Strings are encoded with first a length (ULEB), then the string contents,
+  // and lastly a null terminator. The length includes the null.
+
+  DataExtractor lldb_extractor;
+  auto section_size = section_sp->GetSectionData(lldb_extractor);
+  llvm::DataExtractor section = lldb_extractor.GetAsLLVM();
+  bool le = section.isLittleEndian();
+  uint8_t addr_size = section.getAddressSize();
+  llvm::DataExtractor::Cursor cursor(0);
+  while (cursor && cursor.tell() < section_size) {
+uint64_t version = section.getULEB128(cursor);
+uint64_t record_size = section.getULEB128(cursor);
+if (version == 1) {
+  llvm::DataExtractor record(section.getData().drop_front(cursor.tell()),
+ le, addr_size);
+  llvm::DataExtractor::Cursor cursor(0);
+  uint64_t type_size = record.getULEB128(cursor);
+  llvm::StringRef type_name = record.getBytes(cursor, type_size);
+  llvm::Error error = cursor.takeError();
+  if (!error)
+fn(llvm::DataExtractor(record.getData().drop_front(cursor.tell()), le,
+   addr_size), type_name);
+  else
+LLDB_LOG_ERROR(GetLog(LLDBLog::DataFormatters), std::move(error),

JDevlieghere wrote:

```suggestion
LLDB_LOG_ERROR(GetLog(LLDBLog::Target), std::move(error),
```

I was going to suggest switching this to target, but this code does really 
belong to the data formatters. Maybe that's a better place for this code to 
live. 

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


[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Zequan Wu via lldb-commits

https://github.com/ZequanWu updated 
https://github.com/llvm/llvm-project/pull/114303

>From 215c36a380946a0c8cab63605bd0a9da13e642cd Mon Sep 17 00:00:00 2001
From: Zequan Wu 
Date: Tue, 29 Oct 2024 13:19:50 -0700
Subject: [PATCH 1/3] [lldb][NativePDB] Parse global variables.

---
 .../NativePDB/SymbolFileNativePDB.cpp | 39 +++
 .../NativePDB/SymbolFileNativePDB.h   |  1 +
 .../SymbolFile/NativePDB/ast-methods.cpp  |  5 ++-
 .../SymbolFile/NativePDB/global-ctor-dtor.cpp | 11 +++---
 .../Shell/SymbolFile/PDB/ast-restore.test |  9 +
 5 files changed, 43 insertions(+), 22 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 7fded6a31a3af5..3536599693cb46 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -365,18 +365,20 @@ void SymbolFileNativePDB::InitializeObject() {
 }
 
 uint32_t SymbolFileNativePDB::CalculateNumCompileUnits() {
+  if (m_cu_count)
+return *m_cu_count;
   const DbiModuleList &modules = m_index->dbi().modules();
-  uint32_t count = modules.getModuleCount();
-  if (count == 0)
-return count;
+  m_cu_count = modules.getModuleCount();
+  if (*m_cu_count == 0)
+return 0;
 
   // The linker can inject an additional "dummy" compilation unit into the
   // PDB. Ignore this special compile unit for our purposes, if it is there.
   // It is always the last one.
-  DbiModuleDescriptor last = modules.getModuleDescriptor(count - 1);
+  DbiModuleDescriptor last = modules.getModuleDescriptor(*m_cu_count - 1);
   if (last.getModuleName() == "* Linker *")
---count;
-  return count;
+--*m_cu_count;
+  return *m_cu_count;
 }
 
 Block &SymbolFileNativePDB::CreateBlock(PdbCompilandSymId block_id) {
@@ -888,7 +890,8 @@ VariableSP 
SymbolFileNativePDB::CreateGlobalVariable(PdbGlobalSymId var_id) {
 
   CompUnitSP comp_unit;
   std::optional modi = m_index->GetModuleIndexForVa(addr);
-  if (!modi) {
+  // Some globals has modi points to the linker module, ignore them.
+  if (!modi || modi >= CalculateNumCompileUnits()) {
 return nullptr;
   }
 
@@ -1810,7 +1813,27 @@ 
SymbolFileNativePDB::ParseVariablesForCompileUnit(CompileUnit &comp_unit,
   VariableList &variables) {
   PdbSymUid sym_uid(comp_unit.GetID());
   lldbassert(sym_uid.kind() == PdbSymUidKind::Compiland);
-  return 0;
+  for (const uint32_t gid : m_index->globals().getGlobalsTable()) {
+PdbGlobalSymId global{gid, false};
+CVSymbol sym = m_index->ReadSymbolRecord(global);
+// TODO: Handle S_CONSTANT which might be a record type (e.g.
+// std::strong_ordering::equal). Currently
+// lldb_private::npdb::MakeConstantLocationExpression doesn't handle this
+// case and will crash if we do create global variables from it.
+switch (sym.kind()) {
+case SymbolKind::S_GDATA32:
+case SymbolKind::S_LDATA32:
+case SymbolKind::S_GTHREAD32:
+case SymbolKind::S_LTHREAD32: {
+  if (VariableSP var = GetOrCreateGlobalVariable(global))
+variables.AddVariable(var);
+  break;
+}
+default:
+  break;
+}
+  }
+  return variables.GetSize();
 }
 
 VariableSP SymbolFileNativePDB::CreateLocalVariable(PdbCompilandSymId scope_id,
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 669c44aa131edc..6e384b2b17873f 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -265,6 +265,7 @@ class SymbolFileNativePDB : public SymbolFileCommon {
   // UID for anonymous union and anonymous struct as they don't have entities 
in
   // pdb debug info.
   lldb::user_id_t anonymous_id = LLDB_INVALID_UID - 1;
+  std::optional m_cu_count = 0;
 
   std::unique_ptr m_file_up;
   std::unique_ptr m_index;
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
index f2be33aae8163b..ff6e0ddb20f9eb 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
@@ -44,8 +44,7 @@ int main(int argc, char **argv) {
 // AST: |   |-ParmVarDecl {{.*}} 'char'
 // AST: |   `-ParmVarDecl {{.*}} 'int'
 
-// SYMBOL:  int main(int argc, char **argv);
-// SYMBOL-NEXT: struct Struct {
+// SYMBOL:  struct Struct {
 // SYMBOL-NEXT: void simple_method();
 // SYMBOL-NEXT: static void static_method();
 // SYMBOL-NEXT: virtual void virtual_method();
@@ -53,3 +52,5 @@ int main(int argc, char **argv) {
 // SYMBOL-NEXT: int overloaded_method(char);
 // SYMBOL-NEXT: int overloaded_method(char, int, ...);
 // SYMBOL-NEXT: };
+// SYMBOL-NEXT: Struct s;
+// SYMBOL-NEXT: int main(int argc, char **

[Lldb-commits] [lldb] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (PR #114455)

2024-10-31 Thread Zequan Wu via lldb-commits

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

Thanks, this makes testing nativepdb/pdb much easier. 

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


[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

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

LGTM. Thanks!

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


[Lldb-commits] [lldb] [lldb] Improve command status when dwim-print has no result (PR #114478)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Improve command status when dwim-print has no result (PR #114478)

2024-10-31 Thread Dave Lee via lldb-commits

https://github.com/kastiglione created 
https://github.com/llvm/llvm-project/pull/114478

None

>From 530e9db082ce2a3140045a1696c4e5c2f85a8f36 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 31 Oct 2024 15:26:21 -0700
Subject: [PATCH] [lldb] Improve command status when dwim-print has no result

---
 lldb/source/Commands/CommandObjectDWIMPrint.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index f5aa6a287b6f46..76bed100dc7291 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -231,7 +231,7 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
 if (valobj_sp->GetError().GetError() != UserExpression::kNoResult)
   dump_val_object(*valobj_sp);
 else
-  result.SetStatus(eReturnStatusSuccessFinishResult);
+  result.SetStatus(eReturnStatusSuccessFinishNoResult);
 
 if (suppress_result)
   if (auto result_var_sp =

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


[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Jonas Devlieghere via lldb-commits


@@ -888,7 +888,8 @@ VariableSP 
SymbolFileNativePDB::CreateGlobalVariable(PdbGlobalSymId var_id) {
 
   CompUnitSP comp_unit;
   std::optional modi = m_index->GetModuleIndexForVa(addr);
-  if (!modi) {
+  // Some globals has modi points to the linker module, ignore them.
+  if (!modi || modi >= GetNumCompileUnits()) {
 return nullptr;
   }

JDevlieghere wrote:

Nit: no braces. 

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


[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Jonas Devlieghere via lldb-commits


@@ -1810,7 +1813,27 @@ 
SymbolFileNativePDB::ParseVariablesForCompileUnit(CompileUnit &comp_unit,
   VariableList &variables) {
   PdbSymUid sym_uid(comp_unit.GetID());
   lldbassert(sym_uid.kind() == PdbSymUidKind::Compiland);
-  return 0;
+  for (const uint32_t gid : m_index->globals().getGlobalsTable()) {
+PdbGlobalSymId global{gid, false};
+CVSymbol sym = m_index->ReadSymbolRecord(global);
+// TODO: Handle S_CONSTANT which might be a record type (e.g.
+// std::strong_ordering::equal). Currently
+// lldb_private::npdb::MakeConstantLocationExpression doesn't handle this
+// case and will crash if we do create global variables from it.

JDevlieghere wrote:

Like Pavel I understood the comment as if we'd still crash. Maybe update the 
wording to make it explicit that that's the reason we don't handle it here. 

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


[Lldb-commits] [lldb] [lldb] Add a link to LLDB's Discord channel on the website (PR #114289)

2024-10-31 Thread David Spickett via lldb-commits

DavidSpickett wrote:

There was one somewhere in the text, but of course I can't find it so it was 
clearly of little use :)

Is now a good time to remind you @JDevlieghere that these two videos are no 
longer available on the Apple site. More than a decade old so it's not that 
surprising but maybe they have just moved instead?

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


[Lldb-commits] [lldb] [lldb][test] Skip one inline stepping test for arm-ubuntu. (PR #114295)

2024-10-31 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] a218f0f - [lldb][test] Skip one inline stepping test for arm-ubuntu. (#114295)

2024-10-31 Thread via lldb-commits

Author: jimingham
Date: 2024-10-31T09:06:42Z
New Revision: a218f0f354e9df2ce689686be503f3d85fea44f9

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

LOG: [lldb][test] Skip one inline stepping test for arm-ubuntu. (#114295)

The test is currently passing everywhere but this 32-bit arm ubuntu bot.
I don't have an easy way to debug this, so I'm skipping the test on that
platform till we get a chance to figure this out.

Added: 


Modified: 
lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py 
b/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py
index 3283918f852743..1118758cc88fbc 100644
--- a/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py
+++ b/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py
@@ -14,6 +14,8 @@ class TestInlineStepping(TestBase):
 compiler="icc",
 bugnumber="# Not really a bug.  ICC combines two inlined functions.",
 )
+
+@skipIf(oslist=["linux"], archs=["arm"]) # Fails for 32 bit arm
 def test_with_python_api(self):
 """Test stepping over and into inlined functions."""
 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][test] Skip one inline stepping test for arm-ubuntu. (PR #114295)

2024-10-31 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I looked into this. Not sure what the stepping logic goes by but I do see there 
is no line table entry for the function call we expect to stop at after the 
first stop.

I have cut the cpp down to:
```
  1 inline void inline_trivial_1 () __attribute__((always_inline));
  2 
  3 static int inline_value;
  4 
  5 void inline_trivial_1() {
  6 asm volatile ("nop"); // In inline_trivial_1.
  7 }
  8 
  9 int main (int argc, char **argv) {
 10 inline_value = 0;// Stop here and step over to set up stepping over.
 11 inline_trivial_1 (); // At inline_trivial_1 called from main.
 12 return 0;
 13 }
```
On Arm 32 bit this produces this code:
```
052c :
 52c:   e92d4800push{fp, lr}
 530:   e1a0b00dmov fp, sp
 534:   e24dd00csub sp, sp, #12
 538:   e3002000movwr2, #0
 53c:   e50b2004str r2, [fp, #-4]
 540:   e58d0004str r0, [sp, #4]
 544:   e58d1000str r1, [sp]
 548:   e300movwr0, #0
 54c:   e59f1014ldr r1, [pc, #20]   ; 568 
 550:   e08f1001add r1, pc, r1
 554:   e581str r0, [r1]
 558:   e320f000nop {0}
 55c:   e300movwr0, #0
 560:   e1a0d00bmov sp, fp
 564:   e8bd8800pop {fp, pc}
 568:   00010ae4.word   0x00010ae4
```
And the line table is (idk what's important but line numbers are my guess):
```
$ ./bin/llvm-dwarfdump --debug-line 
./lldb-test-build.noindex/functionalities/inline-stepping/TestInlineStepping.test_with_python_api_dwarf/a.out
<...>
AddressLine   Column File   ISA Discriminator OpIndex Flags
-- -- -- -- --- - --- -
0x052c  9  0  1   0 0   0  is_stmt
0x0548 10 18  1   0 0   0  is_stmt 
prologue_end
0x0558  6  5  1   0 0   0  is_stmt
0x055c 12  5  1   0 0   0  is_stmt
0x0560 12  5  1   0 0   0  
epilogue_begin
0x0568  0  5  1   0 0   0
0x056c  0  5  1   0 0   0  end_sequence
```
There's no entry for line 11. Though it does think the prologue ends at line 10 
column 18, when I think it should be more like column 5? Before the assignment.

Compiling the test with g++ I get:
```
AddressLine   Column File   ISA Discriminator OpIndex Flags
-- -- -- -- --- - --- -
0x04d8  9 34  1   0 0   0  is_stmt
0x04e2 10 18  1   0 0   0  is_stmt
0x04ea  6  5  1   0 0   0  is_stmt
0x04ec  7  1  1   0 0   0  is_stmt
0x04ee 12 12  1   0 0   0  is_stmt
0x04f0 13  1  1   0 0   0  is_stmt
0x0500 13  1  1   0 0   0  is_stmt 
end_sequence
```
lldb will still step right over line 11 if I give it the g++ binary.

gdb is able to step the g++ binary properly, but if I give it the clang 
compiled binary:
```
(gdb) run
Starting program: 
/home/david.spickett/build-llvm-arm/lldb-test-build.noindex/functionalities/inline-stepping/TestInlineStepping.test_with_python_api_dwarf/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, main (argc=1, argv=0xfffef3b4) at 
/home/david.spickett/llvm-project/lldb/test/API/functionalities/inline-stepping/calling.cpp:10
10  inline_value = 0;// Stop here and step over to set up stepping 
over.
(gdb) n

Program received signal SIGILL, Illegal instruction.
0x00401058 in ?? ()
```
Which isn't a great sign.

However, on AArch64 where this does work, the code is:
```
0714 :
 714:   d10043ffsub sp, sp, #0x10
 718:   2a0003e8mov w8, w0
 71c:   2a1f03e0mov w0, wzr
 720:   b9000fffstr wzr, [sp, #12]
 724:   b9000be8str w8, [sp, #8]
 728:   f90003e1str x1, [sp]
 72c:   b088adrpx8, 11000 <__cxa_finalize@GLIBC_2.17>
 730:   b900351fstr wzr, [x8, #52]
 734:   d503201fnop
 738:   910043ffadd sp, sp, #0x10
 73c:   d65f03c0ret
```
And the line table:
```
AddressLine   Column File   ISA Discriminator OpIndex Flags
-- -- -- -- --- - --- -
0x0714  9  0  1   0 0   0  is_stmt
0x072c 10 18  1   0 0   0  is_stmt 
prologue_end
0x0734  6  5  1   0 0   0  is_stmt
0x073

[Lldb-commits] [lldb] [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) (PR #114346)

2024-10-31 Thread Pavel Labath via lldb-commits

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

I wish python exposed the linux-style macro to construct an arbitrary version 
number (`#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 
255 : (c)))`) as figuring out what version does `0x030d` refer to is not 
completely trivial. Though I still think that's better than  `(PY_MAJOR_VERSION 
== 3 && PY_MINOR_VERSION >= 13) || (PY_MAJOR_VERSION > 3)`

If python starts going over 3.16, we may want to create our own macro like that.

The static assert is a nice touch.

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


[Lldb-commits] [lldb] cf3464b - [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (#114455)

2024-10-31 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-31T15:31:51-07:00
New Revision: cf3464bbb796d492bcd4e764ada945304e0c874f

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

LOG: [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (#114455)

Lit allows you to set environment variables for all tests in a directory
using a `lit.local.cfg` file. Do this for the PDB and NativePDB tests.

Added: 
lldb/test/Shell/SymbolFile/NativePDB/lit.local.cfg
lldb/test/Shell/SymbolFile/PDB/lit.local.cfg

Modified: 
lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp
lldb/test/Shell/SymbolFile/NativePDB/blocks.s
lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp
lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp
lldb/test/Shell/SymbolFile/NativePDB/class_layout.cpp
lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp
lldb/test/Shell/SymbolFile/NativePDB/function-types-builtins.cpp
lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp
lldb/test/Shell/SymbolFile/NativePDB/function-types-classes.cpp
lldb/test/Shell/SymbolFile/NativePDB/global-classes.cpp
lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp
lldb/test/Shell/SymbolFile/NativePDB/globals-bss.cpp
lldb/test/Shell/SymbolFile/NativePDB/globals-fundamental.cpp
lldb/test/Shell/SymbolFile/NativePDB/icf.cpp
lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp
lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test
lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
lldb/test/Shell/SymbolFile/NativePDB/load-pdb.cpp
lldb/test/Shell/SymbolFile/NativePDB/local-variables-registers.s
lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp
lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp
lldb/test/Shell/SymbolFile/NativePDB/lookup-by-address.cpp
lldb/test/Shell/SymbolFile/NativePDB/lookup-by-types.cpp
lldb/test/Shell/SymbolFile/NativePDB/nested-blocks-same-address.s
lldb/test/Shell/SymbolFile/NativePDB/nested-types.cpp
lldb/test/Shell/SymbolFile/NativePDB/s_constant.cpp
lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp
lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp
lldb/test/Shell/SymbolFile/NativePDB/tag-types.cpp
lldb/test/Shell/SymbolFile/NativePDB/typedefs.cpp
lldb/test/Shell/SymbolFile/PDB/ast-restore.test
lldb/test/Shell/SymbolFile/PDB/compilands.test
lldb/test/Shell/SymbolFile/PDB/function-level-linking.test
lldb/test/Shell/SymbolFile/PDB/variables-locations.test

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
index b8154168aff3d1..c0ae6e73f36d8b 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
@@ -3,5 +3,5 @@
 
 // RUN: %build --compiler=msvc --nodefaultlib -o %t.exe -- %S/ast-functions.cpp
 
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
 // RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck 
%S/ast-functions.cpp

diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
index 7eb7a2cbe7d9a4..d1cac393bbed9e 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
@@ -4,8 +4,7 @@
 // RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
 // RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe 
-pdb:%t.pdb
 
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
-// RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s
+// RUN: %lldb -f %t.exe -s %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s
 
 static int static_fn() {
   return 42;

diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
index f2be33aae8163b..91bd5bb810c8e3 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
@@ -3,10 +3,10 @@
 
 // RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -GR- -c /Fo%t.obj -- %s
 // RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe 
-pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
 // RUN: %p/Inputs/ast-methods.lldbinit 2>&1 | FileCheck %s 
--check-prefix=AST
 
-// RUN:

[Lldb-commits] [lldb] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (PR #114455)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Zequan Wu via lldb-commits


@@ -1810,7 +1813,27 @@ 
SymbolFileNativePDB::ParseVariablesForCompileUnit(CompileUnit &comp_unit,
   VariableList &variables) {
   PdbSymUid sym_uid(comp_unit.GetID());
   lldbassert(sym_uid.kind() == PdbSymUidKind::Compiland);
-  return 0;
+  for (const uint32_t gid : m_index->globals().getGlobalsTable()) {
+PdbGlobalSymId global{gid, false};
+CVSymbol sym = m_index->ReadSymbolRecord(global);
+// TODO: Handle S_CONSTANT which might be a record type (e.g.
+// std::strong_ordering::equal). Currently
+// lldb_private::npdb::MakeConstantLocationExpression doesn't handle this
+// case and will crash if we do create global variables from it.

ZequanWu wrote:

Updated wording.

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


[Lldb-commits] [lldb] [lldb] Disable automatically opening editor for TestSessionSave (PR #114469)

2024-10-31 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)


Changes



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


1 Files Affected:

- (modified) lldb/test/API/commands/session/save/TestSessionSave.py (+1) 


``diff
diff --git a/lldb/test/API/commands/session/save/TestSessionSave.py 
b/lldb/test/API/commands/session/save/TestSessionSave.py
index 0f064e60844fe2..e5913f8edfe8fc 100644
--- a/lldb/test/API/commands/session/save/TestSessionSave.py
+++ b/lldb/test/API/commands/session/save/TestSessionSave.py
@@ -103,6 +103,7 @@ def test_session_save_no_transcript_warning(self):
 
 # These commands won't be saved, so are arbitrary.
 commands = [
+"settings set interpreter.open-transcript-in-editor false",
 "p 1",
 "settings set interpreter.save-session-on-quit true",
 "fr v",

``




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


[Lldb-commits] [lldb] [lldb] Disable automatically opening editor for TestSessionSave (PR #114469)

2024-10-31 Thread Alex Langford via lldb-commits

https://github.com/bulbazord created 
https://github.com/llvm/llvm-project/pull/114469

None

>From 9a43932849dba04c11cbed2abcac41a3e64b4e06 Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Thu, 31 Oct 2024 14:40:59 -0700
Subject: [PATCH] [lldb] Disable automatically opening editor for
 TestSessionSave

---
 lldb/test/API/commands/session/save/TestSessionSave.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/test/API/commands/session/save/TestSessionSave.py 
b/lldb/test/API/commands/session/save/TestSessionSave.py
index 0f064e60844fe2..e5913f8edfe8fc 100644
--- a/lldb/test/API/commands/session/save/TestSessionSave.py
+++ b/lldb/test/API/commands/session/save/TestSessionSave.py
@@ -103,6 +103,7 @@ def test_session_save_no_transcript_warning(self):
 
 # These commands won't be saved, so are arbitrary.
 commands = [
+"settings set interpreter.open-transcript-in-editor false",
 "p 1",
 "settings set interpreter.save-session-on-quit true",
 "fr v",

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


[Lldb-commits] [lldb] [lldb] Disable automatically opening editor for TestSessionSave (PR #114469)

2024-10-31 Thread Med Ismail Bennani via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Improve command status when dwim-print has no result (PR #114478)

2024-10-31 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] Fix pointer to reference type (PR #113596)

2024-10-31 Thread via lldb-commits

jeffreytan81 wrote:

Technical these make sense. Please let me know how to revert a PR (or feel free 
to revert for me if I do not have permission). 

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


[Lldb-commits] [lldb] [lldb] Create dependent modules in parallel (PR #114507)

2024-10-31 Thread Dmitrii Galimzianov via lldb-commits


@@ -1608,9 +1612,28 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
 if (image_module_sp) {
   added_modules.AppendIfNeeded(image_module_sp, false);
   ObjectFile *objfile = image_module_sp->GetObjectFile();
-  if (objfile)
+  if (objfile) {
+std::lock_guard guard(dependent_files_mutex);
 objfile->GetDependentModules(dependent_files);

DmT021 wrote:

I wonder if this operation is heavy in any of the `ObjectFile` implementations. 
If it is we may want to lock the mutex only when an actual append to the 
dependent_files happens.

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


[Lldb-commits] [lldb] [lldb] Create dependent modules in parallel (PR #114507)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/114507

>From 9a269fa83cea529f704c9eba339eac9987032155 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 31 Oct 2024 21:42:38 -0700
Subject: [PATCH 1/2] [lldb] Create dependent modules in parallel
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Create dependent modules in parallel in Target::SetExecutableModule.
This change was inspired by #110646 which takes the same approach when
attaching. Jason suggested we could use the same approach when you
create a target in LLDB.

I used Slack for benchmarking, which loads 902 images.

  Benchmark 1: ./bin/lldb /Applications/Slack.app/Contents/MacOS/Slack
Time (mean ± σ):  1.225 s ±  0.003 s[User: 3.977 s, System: 1.521 s]
Range (min … max):1.220 s …  1.229 s10 runs

  Benchmark 2: ./bin/lldb /Applications/Slack.app/Contents/MacOS/Slack
Time (mean ± σ):  3.253 s ±  0.037 s[User: 3.013 s, System: 0.248 s]
Range (min … max):3.211 s …  3.310 s10 runs

We see about a 2x speedup, which matches what Jason saw for the attach
scenario. I also ran this under TSan to confirm this doesn't introduce
any races or deadlocks.
---
 lldb/source/Target/Target.cpp | 33 -
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 199efae8a728cc..ef5d38fc796b08 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -68,6 +68,7 @@
 
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/Support/ThreadPool.h"
 
 #include 
 #include 
@@ -1575,7 +1576,6 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
m_arch.GetSpec().GetTriple().getTriple());
 }
 
-FileSpecList dependent_files;
 ObjectFile *executable_objfile = executable_sp->GetObjectFile();
 bool load_dependents = true;
 switch (load_dependent_files) {
@@ -1591,10 +1591,14 @@ void Target::SetExecutableModule(ModuleSP 
&executable_sp,
 }
 
 if (executable_objfile && load_dependents) {
+  // FileSpecList is not thread safe and needs to be synchronized.
+  FileSpecList dependent_files;
+  std::mutex dependent_files_mutex;
+
+  // ModuleList is thread safe.
   ModuleList added_modules;
-  executable_objfile->GetDependentModules(dependent_files);
-  for (uint32_t i = 0; i < dependent_files.GetSize(); i++) {
-FileSpec dependent_file_spec(dependent_files.GetFileSpecAtIndex(i));
+
+  auto GetDependentModules = [&](FileSpec dependent_file_spec) {
 FileSpec platform_dependent_file_spec;
 if (m_platform_sp)
   m_platform_sp->GetFileWithUUID(dependent_file_spec, nullptr,
@@ -1608,9 +1612,28 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
 if (image_module_sp) {
   added_modules.AppendIfNeeded(image_module_sp, false);
   ObjectFile *objfile = image_module_sp->GetObjectFile();
-  if (objfile)
+  if (objfile) {
+std::lock_guard guard(dependent_files_mutex);
 objfile->GetDependentModules(dependent_files);
+  }
+}
+  };
+
+  executable_objfile->GetDependentModules(dependent_files);
+
+  llvm::ThreadPoolTaskGroup task_group(Debugger::GetThreadPool());
+  for (uint32_t i = 0; i < dependent_files.GetSize(); i++) {
+// Process all currently known dependencies in parallel in the 
innermost
+// loop. This may create newly discovered dependencies to be appended 
to
+// dependent_files. We'll deal with these files during the next
+// iteration of the outermost loop.
+{
+  std::lock_guard guard(dependent_files_mutex);
+  for (; i < dependent_files.GetSize(); i++)
+task_group.async(GetDependentModules,
+dependent_files.GetFileSpecAtIndex(i));
 }
+task_group.wait();
   }
   ModulesDidLoad(added_modules);
 }

>From 0bba5f799aadb4bd987e7aa29ca727562364b915 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 31 Oct 2024 21:54:26 -0700
Subject: [PATCH 2/2] Fix formatting

---
 lldb/source/Target/Target.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index ef5d38fc796b08..ad38e6138cf0c6 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1631,7 +1631,7 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
   std::lock_guard guard(dependent_files_mutex);
   for (; i < dependent_files.GetSize(); i++)
 task_group.async(GetDependentModules,
-dependent_files.GetFileSpecAtIndex(i));
+ dependent_files.GetFileSpecAtIndex(i));
 }
 task_group.wait();
   }


[Lldb-commits] [lldb] [lldb] Create dependent modules in parallel (PR #114507)

2024-10-31 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

Looks good to me, thanks for addressing this other bottleneck for launch 
startup.

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


[Lldb-commits] [lldb] [lldb] Implement a formatter bytecode interpreter in C++ (PR #114333)

2024-10-31 Thread Jonas Devlieghere via lldb-commits


@@ -1537,6 +1538,154 @@ static void LoadScriptingResourceForModule(const 
ModuleSP &module_sp,
   feedback_stream.GetData());
 }
 
+static void ForEachFormatterInModule(

JDevlieghere wrote:

Target seems like a weird place for this code to live. I understand that's 
where `LoadScriptingResourceForModule` currently resides, but that function is 
pretty basic. I think we've reached the threshold of having to move 
`LoadScriptingResourceForModule`, `LoadTypeSummariesForModule` and 
`LoadFormattersForModule` into a separate file. 

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


[Lldb-commits] [lldb] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (PR #114455)

2024-10-31 Thread Alex Langford via lldb-commits

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

This looks good to me. Probably want somebody more involved in windows to sign 
off though.

This might not be the right setting to ask this, but is there a plan to use one 
of the PDB parsers over the other? Would it make sense to add this as an option 
to lldb-test and the like instead of continuing to rely on an environment 
variable?

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


[Lldb-commits] [lldb] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (PR #114455)

2024-10-31 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

> This might not be the right setting to ask this, but is there a plan to use 
> one of the PDB parsers over the other? Would it make sense to add this as an 
> option to lldb-test and the like instead of continuing to rely on an 
> environment variable?

The goal is to have only the native PDB parser (i.e. the one that can run on 
any platform). I was [under the 
impression](https://github.com/llvm/llvm-project/pull/113647) that we were 
close to making that the reality but it seems like more work is needed. 
@ZequanWu has created [some](https://github.com/llvm/llvm-project/pull/113980) 
[changes](https://github.com/llvm/llvm-project/pull/114303) to help with that. 

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


[Lldb-commits] [lldb] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (PR #114455)

2024-10-31 Thread Omair Javaid via lldb-commits

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

Looks good to me 

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


[Lldb-commits] [lldb] [lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (PR #114455)

2024-10-31 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-ubuntu` 
running on `as-builder-9` while building `lldb` at step 16 
"test-check-lldb-api".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/195/builds/449


Here is the relevant piece of the build log for the reference

```
Step 16 (test-check-lldb-api) failure: Test just built components: 
check-lldb-api completed (failure)
...
PASS: lldb-api :: types/TestIntegerType.py (1199 of 1208)
PASS: lldb-api :: types/TestIntegerTypeExpr.py (1200 of 1208)
PASS: lldb-api :: types/TestRecursiveTypes.py (1201 of 1208)
PASS: lldb-api :: types/TestShortType.py (1202 of 1208)
PASS: lldb-api :: types/TestShortTypeExpr.py (1203 of 1208)
PASS: lldb-api :: types/TestLongTypes.py (1204 of 1208)
PASS: lldb-api :: types/TestLongTypesExpr.py (1205 of 1208)
PASS: lldb-api :: tools/lldb-server/TestNonStop.py (1206 of 1208)
PASS: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (1207 of 1208)
TIMEOUT: lldb-api :: tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py 
(1208 of 1208)
 TEST 'lldb-api :: 
tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py' FAILED 

Script:
--
/usr/bin/python3.12 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib
 --env 
LLVM_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include
 --env 
LLVM_TOOLS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin
 --libcxx-include-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1
 --libcxx-include-target-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1
 --libcxx-library-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu
 --arch aarch64 --build-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex
 --lldb-module-cache-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/lldb 
--compiler 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang 
--dsymutil 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/dsymutil
 --make /usr/bin/make --llvm-tools-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin 
--lldb-obj-root 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb 
--lldb-libs-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib 
--platform-url connect://jetson-agx-2198.lab.llvm.org:1234 
--platform-working-dir /home/ubuntu/lldb-tests --sysroot 
/mnt/fs/jetson-agx-ubuntu --env ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name 
remote-linux 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/tools/lldb-server/attach-wait
 -p TestGdbRemoteAttachWait.py
--
Exit Code: -9
Timeout: Reached timeout of 600 seconds

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision 
cf3464bbb796d492bcd4e764ada945304e0c874f)
  clang revision cf3464bbb796d492bcd4e764ada945304e0c874f
  llvm revision cf3464bbb796d492bcd4e764ada945304e0c874f

--
Command Output (stderr):
--
WARNING:root:Custom libc++ is not supported for remote runs: ignoring --libcxx 
arguments
UNSUPPORTED: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_attach_with_vAttachWait_debugserver 
(TestGdbRemoteAttachWait.TestGdbRemoteAttachWait.test_attach_with_vAttachWait_debugserver)
 (test case does not fall in any category of interest for this run) 
PASS: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_attach_with_vAttachWait_llgs 
(TestGdbRemoteAttachWait.TestGdbRemoteAttachWait.test_attach_with_vAttachWait_llgs)
UNSUPPORTED: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_launch_after_attach_with_vAttachOrWait_debugserver 
(TestGdbRemoteAttachWait.TestGdbRemoteAttachWait.test_launch_after_attach_with_vAttachOrWait_debugserver)
 (test case does not fall in any category of interest for this run) 

--



Timed Out Tests (1):
  lldb-api :: tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py


Testing Time: 965.86s

Total Discovered Tests: 1208
  Unsupported  : 427 (35.35%)
  Passed   : 763 (63.16%)
  Expectedly Failed:  17 (1.41%)
  Timed Out:   1 (0.08%)
FAI

[Lldb-commits] [lldb] [lldb][NativePDB] Parse global variables. (PR #114303)

2024-10-31 Thread Reid Kleckner via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Improve command status when dwim-print has no result (PR #114478)

2024-10-31 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Improve command status when dwim-print has no result (PR #114478)

2024-10-31 Thread Dave Lee via lldb-commits

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