[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes

In particular, this allows `bt -u`.


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


2 Files Affected:

- (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+1-2) 
- (modified) 
lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py 
(+5) 


``diff
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index f2712af0a08a73..2cdf5e6da6fd13 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,8 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",
- "thread backtrace -c %1") &&
+bt_regex_cmd_up->AddRegexCommand("^(-.*)$", "thread backtrace %1") &&
 bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
 bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());
diff --git 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
index d1cb8214d658ff..978bf2066e43b0 100644
--- 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
+++ 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
@@ -46,6 +46,11 @@ def test_backtrace(self):
 "thread backtrace", matching=False, 
patterns=["frame.*std::__.*::__function"]
 )
 # Unfiltered.
+self.expect(
+"bt -u",
+ordered=True,
+patterns=["frame.*foo", "frame.*std::__[^:]*::__function", 
"frame.*main"],
+)
 self.expect(
 "thread backtrace -u",
 ordered=True,

``




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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread Dave Lee via lldb-commits

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

In particular, this allows `bt -u`.


>From bc771d2c7dc223c353fbfca9dbe491e08311950b Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 14 Nov 2024 09:03:33 -0800
Subject: [PATCH] [lldb] Support any flag to _regexp-bt

In particular, this allows `bt -u`.
---
 lldb/source/Interpreter/CommandInterpreter.cpp   | 3 +--
 .../cpp/std-function-recognizer/TestStdFunctionRecognizer.py | 5 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index f2712af0a08a73..2cdf5e6da6fd13 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,8 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",
- "thread backtrace -c %1") &&
+bt_regex_cmd_up->AddRegexCommand("^(-.*)$", "thread backtrace %1") &&
 bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
 bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());
diff --git 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
index d1cb8214d658ff..978bf2066e43b0 100644
--- 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
+++ 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
@@ -46,6 +46,11 @@ def test_backtrace(self):
 "thread backtrace", matching=False, 
patterns=["frame.*std::__.*::__function"]
 )
 # Unfiltered.
+self.expect(
+"bt -u",
+ordered=True,
+patterns=["frame.*foo", "frame.*std::__[^:]*::__function", 
"frame.*main"],
+)
 self.expect(
 "thread backtrace -u",
 ordered=True,

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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 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 c9719ad5cd7e0fa65b52333f28aa62c05052d989 
bc771d2c7dc223c353fbfca9dbe491e08311950b --extensions cpp -- 
lldb/source/Interpreter/CommandInterpreter.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index 2cdf5e6da6..2ff8d7a019 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -852,8 +852,10 @@ void CommandInterpreter::LoadCommandDictionary() {
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
 bt_regex_cmd_up->AddRegexCommand("^(-.*)$", "thread backtrace %1") &&
-bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
-bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
+bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$",
+ "thread backtrace all") &&
+bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$",
+ "thread backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());
   m_command_dict[std::string(command_sp->GetCommandName())] = command_sp;
 }

``




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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add timed callbacks to the MainLoop class (PR #112895)

2024-11-14 Thread Pavel Labath via lldb-commits

labath wrote:

(Closed by mistake, I'm still waiting on #115197 though)

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Robert O'Callahan via lldb-commits

rocallahan wrote:

In any case I am OOO and mostly offline until Nov 26.

Rob


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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread Dave Lee via lldb-commits

https://github.com/kastiglione updated 
https://github.com/llvm/llvm-project/pull/116260

>From bc771d2c7dc223c353fbfca9dbe491e08311950b Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 14 Nov 2024 09:03:33 -0800
Subject: [PATCH 1/2] [lldb] Support any flag to _regexp-bt

In particular, this allows `bt -u`.
---
 lldb/source/Interpreter/CommandInterpreter.cpp   | 3 +--
 .../cpp/std-function-recognizer/TestStdFunctionRecognizer.py | 5 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index f2712af0a08a73..2cdf5e6da6fd13 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,8 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",
- "thread backtrace -c %1") &&
+bt_regex_cmd_up->AddRegexCommand("^(-.*)$", "thread backtrace %1") &&
 bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
 bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());
diff --git 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
index d1cb8214d658ff..978bf2066e43b0 100644
--- 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
+++ 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
@@ -46,6 +46,11 @@ def test_backtrace(self):
 "thread backtrace", matching=False, 
patterns=["frame.*std::__.*::__function"]
 )
 # Unfiltered.
+self.expect(
+"bt -u",
+ordered=True,
+patterns=["frame.*foo", "frame.*std::__[^:]*::__function", 
"frame.*main"],
+)
 self.expect(
 "thread backtrace -u",
 ordered=True,

>From fe72e0df59676fbcd44964f8b3dccd675920d886 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 14 Nov 2024 09:26:14 -0800
Subject: [PATCH 2/2] Use -.+ instead of -.*

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

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index 2cdf5e6da6fd13..c1404539bb8e14 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,7 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^(-.*)$", "thread backtrace %1") &&
+bt_regex_cmd_up->AddRegexCommand("^(-.+)$", "thread backtrace %1") &&
 bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
 bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());

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


[Lldb-commits] [lldb] 593be02 - [lldb] Remove broken comments originally written as table headers (NFC) (#116089)

2024-11-14 Thread via lldb-commits

Author: Dave Lee
Date: 2024-11-14T09:28:27-08:00
New Revision: 593be023615a456ca6ee0ef9bedc21301d73b73c

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

LOG: [lldb] Remove broken comments originally written as table headers (NFC) 
(#116089)

Automatic formatting has removed the utility of these comments.

Added: 


Modified: 
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
lldb/source/Plugins/Process/Utility/RegisterInfos_arm.h

lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp

lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp 
b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
index 08c613c7b0d0c3..6aadf652da7813 100644
--- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
+++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
@@ -36,12 +36,6 @@ using namespace lldb;
 using namespace lldb_private;
 
 static const RegisterInfo g_register_infos[] = {
-//  NAME   ALT   SZ OFF ENCODING FORMAT  EH_FRAME
-//  DWARF   GENERIC PROCESS PLUGIN
-//  LLDB NATIVE
-//  == ===   == === =
-//  === === ===
-//  === ==
 {"r0",
  nullptr,
  4,

diff  --git a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp 
b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
index 1a0e44f1936b8d..d67591ffa109bc 100644
--- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
+++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
@@ -38,13 +38,6 @@ using namespace lldb_private;
 LLDB_PLUGIN_DEFINE(ABISysV_arm)
 
 static const RegisterInfo g_register_infos[] = {
-//  NAME   ALT   SZ OFF ENCODING FORMAT  EH_FRAME
-//  DWARF   GENERIC PROCESS PLUGIN
-//  LLDB NATIVEVALUE REGSINVALIDATE REGS
-//  == ===   == === =
-//  === === ===
-//  === == ==
-//  ===
 {"r0",
  nullptr,
  4,

diff  --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp 
b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
index d21ee8ac04a212..9c7312b975c4b6 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
@@ -78,12 +78,6 @@ enum dwarf_regnums {
 };
 
 static const RegisterInfo g_register_infos[] = {
-//  NAME  ALTSZ OFF ENCODINGFORMAT EH_FRAME
-//  DWARF   GENERIC PROCESS PLUGINS
-//  LLDB NATIVEVALUE REGS  INVALIDATE REGS
-//    ==  == === =  ===
-//  ==  =
-//  === == =
 {"r0",
  "zero",
  4,

diff  --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp 
b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
index 100d52bfd1c8ba..4cc37dd7acf09e 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
@@ -78,12 +78,6 @@ enum dwarf_regnums {
 };
 
 static const RegisterInfo g_register_infos_mips64[] = {
-//  NAME  ALTSZ OFF ENCODINGFORMAT EH_FRAME
-//  DWARF   GENERIC PROCESS PLUGIN
-//  LLDB NATIVE
-//    ==  == === =  == =
-//  =   =
-//  
 {"r0",
  "zero",
  8,

diff  --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
index c23e82a741a0ae..094b46bf861df7 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
@@ -184,13 +184,6 @@ enum {
sizeof(RegisterContextDarwin_arm::EXC))
 
 static RegisterInfo g_register_infos[] = {
-// General purpose registers
-//  NAMEALT SZ  OFFSET 

[Lldb-commits] [lldb] [lldb] Remove broken comments originally written as table headers (NFC) (PR #116089)

2024-11-14 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Make CompilerDecl::GetName (always) return template args (PR #116068)

2024-11-14 Thread Michael Buch via lldb-commits

https://github.com/Michael137 commented:

Very interesting find, I *think* this makes sense since the `FindTypes` query 
expects to find template parameters if we're looking up templates. And given 
this API is used specifically to perform these kinds of queries, this LGTM. But 
please confirm if my understanding is correct:

In the non-simple names case, when we stop at the breakpoint and start 
formatting the function arguments, LLDB creates a `CXXRecordDecl` with the name 
`bar` in the shared library TypeSystem because it only sees a 
`DW_TAG_structure_type "bar"` forward declaration without any template 
parameter children DIEs. Then when we call `FindCompleteType`, the `Decl`s 
`DeclarationName` would've been set to `bar`, so we construct a 
`TypeQuery`, it's able to match the `bar` definition using the index. When 
`FindTypes` resolves the definition DIE we get from the index, it triggers the 
creation of a `ClassTemplateSpecializationDecl` in the main module's TypeSystem 
and everything works out.

But in the non-simple names case we create a `ClassTemplateSpecializationDecl` 
in the shared library module (as opposed to a plain `CXXRecordDecl`), because 
the forward declaration with `-gsimple-template-names` has a template parameter 
DIE. But that declaration name is `bar`, because that's what DWARF told us the 
`DeclarationName` of this `ClassTemplateSpecializationDecl` was. But then 
`FindTypes` does know what to do. It finds the `bar` definition DIE from the 
index, but we actually end up *not* doing a `simple-template-names` lookup 
because 
[UpdateCompilerContextForSimpleTemplateNames](https://github.com/llvm/llvm-project/blob/593be023615a456ca6ee0ef9bedc21301d73b73c/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L2816)
 is only true if the query contained template parameters.

So I guess my question is, why is a `TypeQuery` by basename without template 
parameters not supported if we compiled with `-gsimple-template-names`? Despite 
us being able to find the definition DIE in the index? I guess the idea of 
`UpdateCompilerContextForSimpleTemplateNames` was to avoid doing a 
double-lookup if the first `FindTypes` failed for a template basename? (I 
vaguely remember this coming up on the original review)

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


[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)

2024-11-14 Thread via lldb-commits

jimingham wrote:

> Ok, tell me what you think of this proposal:
> 
> 1. Each thread plan has a virtual `GetDirection()` method returning 
> `RunDirection`. Existing plans other than `ThreadBasePlan` return 
> `eRunForward`.
> 2. There is a per-process `base direction` flag. 
> `ThreadBasePlan::GetDirection()` returns the value of that flag. Defaults to 
> `eRunForward`.
> 3. There is a new `SBProcess::ContinueInDirection(direction)` method. This 
> method updates the "process base direction" flag. For simplicity, for now, 
> _if the base direction changed_, pop all plans on all threads.
> 4. `SBProcess::Continue()` is unchanged, i.e. preserves the base direction.
> 5. When we resume execution:
>5a) If we choose to resume a single runnable thread whose current plan has 
> `StopOthers()` , just resume using that plan's direction.
>5b) Otherwise use the process base direction, and before resuming, pop 
> plans until all threads' current plans match that direction.
> 
> I think this is fairly simple while behaving much like what you suggest. It 
> doesn't require introducing a new kind of `ThreadPlan` which is good. I think 
> it can extend cleanly to support reverse-step etc.

In the long run, I really hope we can do without the restriction that before 
continuing we have to make sure the thread plan stacks of all "RunOthers" 
thread plans are homogeneous in direction.  

But I don't think you will be able to have heterogenous in direction stacks 
without having something to coordinate the direction switch - and IMO the best 
way to do that will require a new thread plan and its management.  

So as a first cut, the homogeneity restriction seems like an okay tradeoff to 
reduce implementation complexity.  

Note that the direction switching plan as I described would operate like a 
"base thread plan" - it would absorb all the unexplained events instead of 
passing them to the other direction plans above it.  So having the base thread 
plan in charge of the direction of the stack should naturally extend to the 
more complex situation where we have base-thread-like marker plans in the 
middle of the plan stack.  You'd get the direction from the youngest base 
thread derived plan on the stack, rather than the one in the first slot.  
There's already precedence for using intermediate base plans in RunThreadPlan 
where we use a stopper base thread plan to keep events from going to the rest 
of the plan stack when we find ourselves running an expression on the private 
state thread.

At the SB level, "ContinueInDirection" is fine - all the Execution Control 
API's actually restart the process.  But at the lldb_private layer I'm guessing 
we'll want a "SetDirection" and then the standard Continue.  The problem with 
ContinueInDirection is that it means I can't make a decision about the 
direction I want the process to go until I'm ready to actually continue the 
process.  It's been really handy to have the "Push a thread plan" gesture 
indicate what the next stage in execution control will do without having to 
immediately resume, and I think we'll want that for changing direction as well.


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


[Lldb-commits] [lldb] [lldb] Make CompilerDecl::GetName (always) return template args (PR #116068)

2024-11-14 Thread Michael Buch via lldb-commits


@@ -0,0 +1,61 @@
+"""Test that forward declaration of a c++ template gets resolved correctly."""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class ForwardDeclarationTestCase(TestBase):
+def do_test(self, dictionary=None):
+"""Display *bar_ptr when stopped on a function with forward 
declaration of struct bar."""
+self.build(dictionary=dictionary)
+exe = self.getBuildArtifact("a.out")
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+environment = self.registerSharedLibrariesWithTarget(target, ["foo"])
+
+# Break inside the foo function which takes a bar_ptr argument.
+lldbutil.run_break_set_by_symbol(self, "foo", num_expected_locations=1)
+
+process = target.LaunchSimple(
+None, environment, self.get_process_working_directory()
+)
+self.assertTrue(process, PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+self.expect(
+"thread list",
+STOPPED_DUE_TO_BREAKPOINT,
+substrs=["stopped", "stop reason = breakpoint"],
+)
+
+# The breakpoint should have a hit count of 1.
+lldbutil.check_breakpoint(self, bpno=1, expected_hit_count=1)
+
+self.expect_expr(
+"*bar_ptr",
+result_type="bar",
+result_children=[ValueCheck(value="47", name="a", type="int")],
+)
+
+def test(self):
+self.do_test()
+
+@no_debug_info_test
+@skipIfDarwin
+@skipIf(compiler=no_match("clang"))
+@skipIf(compiler_version=["<", "8.0"])
+@expectedFailureAll(oslist=["windows"])
+def test_debug_names(self):
+"""Test that we are able to find complete types when using DWARF v5
+accelerator tables"""
+self.do_test(dict(CFLAGS_EXTRAS="-gdwarf-5 -gpubnames"))
+
+@no_debug_info_test
+@skipIf(compiler=no_match("clang"))
+def test_simple_template_names(self):
+"""Test that we are able to find complete types when using DWARF v5
+accelerator tables"""

Michael137 wrote:

Comment seems incorrect

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


[Lldb-commits] [lldb] [lldb] Make CompilerDecl::GetName (always) return template args (PR #116068)

2024-11-14 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Make CompilerDecl::GetName (always) return template args (PR #116068)

2024-11-14 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

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

LGTM with the formatting fixed. 

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

I landed a fix with Pavel's suggestion, and rewrote the commit msg to reflect 
what the patch now does.

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Med Ismail Bennani via lldb-commits


@@ -6184,7 +6184,14 @@ Status Process::GetMemoryRegionInfo(lldb::addr_t 
load_addr,
 MemoryRegionInfo &range_info) {
   if (const lldb::ABISP &abi = GetABI())
 load_addr = abi->FixAnyAddress(load_addr);
-  return DoGetMemoryRegionInfo(load_addr, range_info);
+  Status error = DoGetMemoryRegionInfo(load_addr, range_info);
+  // Reject a region that does not contain the requested address.
+  if (error.Success() && (range_info.GetRange().GetRangeBase() < load_addr ||
+  range_info.GetRange().GetRangeEnd() <= load_addr))

medismailben wrote:

I believe in `range_info.GetRange().GetRangeBase() < load_addr` the sign should 
be inverted.

You could use directly the `Range::{Contains, ContainsEndInclusive}` instead ?

```suggestion
  if (error.Success() && !range_info.GetRange().ContainsEndInclusive(load_addr))
```

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben requested changes to this pull request.

@jasonmolenda I think there is a mistake in your range check.

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


[Lldb-commits] [lldb] [lldb] Make Doxygen commits consistent with the rest of LLDB (NFC) (PR #116269)

2024-11-14 Thread Jacob Lalonde via lldb-commits

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

LGTM @JDevlieghere!

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Jacob Lalonde via lldb-commits


@@ -179,55 +142,34 @@ Status MainLoopPosix::RunImpl::Poll() {
 read_fds.push_back(pfd);
   }
 
-  if (ppoll(read_fds.data(), read_fds.size(), nullptr, &sigmask) == -1 &&
+  if (ppoll(read_fds.data(), read_fds.size(),
+/*timeout=*/nullptr,
+/*sigmask=*/nullptr) == -1 &&
   errno != EINTR)
 return Status(errno, eErrorTypePOSIX);
 
   return Status();
 }
-#endif
 
-void MainLoopPosix::RunImpl::ProcessEvents() {
-#ifdef __ANDROID__
-  // Collect first all readable file descriptors into a separate vector and
-  // then iterate over it to invoke callbacks. Iterating directly over
-  // loop.m_read_fds is not possible because the callbacks can modify the
-  // container which could invalidate the iterator.
-  std::vector fds;
-  for (const auto &fd : loop.m_read_fds)
-if (FD_ISSET(fd.first, &read_fd_set))
-  fds.push_back(fd.first);
-
-  for (const auto &handle : fds) {
-#else
+void MainLoopPosix::RunImpl::ProcessReadEvents() {
   for (const auto &fd : read_fds) {
 if ((fd.revents & (POLLIN | POLLHUP)) == 0)
   continue;
 IOObject::WaitableHandle handle = fd.fd;
-#endif
 if (loop.m_terminate_request)
   return;
 
 loop.ProcessReadObject(handle);
   }
-
-  std::vector signals;
-  for (const auto &entry : loop.m_signals)
-if (g_signal_flags[entry.first] != 0)
-  signals.push_back(entry.first);
-
-  for (const auto &signal : signals) {
-if (loop.m_terminate_request)
-  return;
-g_signal_flags[signal] = 0;
-loop.ProcessSignal(signal);
-  }
 }
 #endif
 
 MainLoopPosix::MainLoopPosix() : m_triggering(false) {
   Status error = m_trigger_pipe.CreateNew(/*child_process_inherit=*/false);
   assert(error.Success());
+  assert(fcntl(m_trigger_pipe.GetWriteFileDescriptor(), F_SETFL,

Jlalond wrote:

I would add a comment that you're asserting setting the file descriptor and 
then reading it produces the same output

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Jacob Lalonde via lldb-commits


@@ -17,29 +17,53 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // Multiplexing is implemented using kqueue on systems that support it (BSD
-// variants including OSX). On linux we use ppoll, while android uses pselect
-// (ppoll is present but not implemented properly). On windows we use WSApoll
-// (which does not support signals).
+// variants including OSX). On linux we use ppoll.
 
 #if HAVE_SYS_EVENT_H
 #include 
-#elif defined(__ANDROID__)
-#include 
 #else
 #include 
 #endif
 
 using namespace lldb;
 using namespace lldb_private;
 
-static sig_atomic_t g_signal_flags[NSIG];
+namespace {
+struct GlobalSignalInfo {
+  sig_atomic_t pipe_fd = -1;
+  static_assert(sizeof(sig_atomic_t) >= sizeof(int),
+"Type too small for a file descriptor");
+  sig_atomic_t flag = 0;
+};
+} // namespace
+static GlobalSignalInfo g_signal_info[NSIG];
 
 static void SignalHandler(int signo, siginfo_t *info, void *) {
   assert(signo < NSIG);
-  g_signal_flags[signo] = 1;
+
+  // Set the flag before writing to the pipe!
+  g_signal_info[signo].flag = 1;
+
+  char c = '.';

Jlalond wrote:

nit, I would like a slightly more descriptive variable name, mostly the intent 
of `.`

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Jacob Lalonde via lldb-commits

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


[Lldb-commits] [lldb] c7605bf - [lldb] Fix cast-function-type-mismatch warning in Host.mm (NFC)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2024-11-14T11:12:58-08:00
New Revision: c7605bfd4eaf1b0fe46fa91bd0e3f7aa17585d89

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

LOG: [lldb] Fix cast-function-type-mismatch warning in Host.mm (NFC)

Fixes warning: cast from 'void (*)(xpc_object_t _Nonnull)' (aka 'void
(*)(NSObject * _Nonnull)') to 'xpc_finalizer_t' (aka
'void (*)(void * _Nullable)') converts to incompatible function type
[-Wcast-function-type-mismatch]

Added: 


Modified: 
lldb/source/Host/macosx/objcxx/Host.mm

Removed: 




diff  --git a/lldb/source/Host/macosx/objcxx/Host.mm 
b/lldb/source/Host/macosx/objcxx/Host.mm
index fe63cc16c64990..a99ffbc3a3faca 100644
--- a/lldb/source/Host/macosx/objcxx/Host.mm
+++ b/lldb/source/Host/macosx/objcxx/Host.mm
@@ -891,6 +891,10 @@ static short GetPosixspawnFlags(const ProcessLaunchInfo 
&launch_info) {
   return flags;
 }
 
+static void finalize_xpc(void *xpc_object) {
+  xpc_release((xpc_object_t)xpc_object);
+}
+
 static Status LaunchProcessXPC(const char *exe_path,
ProcessLaunchInfo &launch_info,
lldb::pid_t &pid) {
@@ -956,7 +960,7 @@ static Status LaunchProcessXPC(const char *exe_path,
 }
   });
 
-  xpc_connection_set_finalizer_f(conn, xpc_finalizer_t(xpc_release));
+  xpc_connection_set_finalizer_f(conn, finalize_xpc);
   xpc_connection_resume(conn);
   xpc_object_t message = xpc_dictionary_create(nil, nil, 0);
 



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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread via lldb-commits


@@ -851,8 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",

jimingham wrote:

`.` captures spaces, so this would mean:

_regex_bt -

would be rejected, but

_regex_bt -

would not but then would fail since `thread backtrace -` isn't valid.  That 
would be odd.  

Instead of .+ this should be  [[^:space:]]+

Other than that, LGTM.

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


[Lldb-commits] [lldb] [lldb] Make CompilerDecl::GetName (always) return template args (PR #116068)

2024-11-14 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Removing the debugger log callback, instead use the default behavior. (PR #78343)

2024-11-14 Thread John Harrison via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap.cpp to not use global DAP variable. (PR #116272)

2024-11-14 Thread John Harrison via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Make CompilerDecl::GetName (always) return template args (PR #116068)

2024-11-14 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb] Move SBLanguages.h out of API tree (PR #111929)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread Dave Lee via lldb-commits

https://github.com/kastiglione updated 
https://github.com/llvm/llvm-project/pull/116260

>From bc771d2c7dc223c353fbfca9dbe491e08311950b Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 14 Nov 2024 09:03:33 -0800
Subject: [PATCH 1/3] [lldb] Support any flag to _regexp-bt

In particular, this allows `bt -u`.
---
 lldb/source/Interpreter/CommandInterpreter.cpp   | 3 +--
 .../cpp/std-function-recognizer/TestStdFunctionRecognizer.py | 5 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index f2712af0a08a73..2cdf5e6da6fd13 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,8 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",
- "thread backtrace -c %1") &&
+bt_regex_cmd_up->AddRegexCommand("^(-.*)$", "thread backtrace %1") &&
 bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
 bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());
diff --git 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
index d1cb8214d658ff..978bf2066e43b0 100644
--- 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
+++ 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
@@ -46,6 +46,11 @@ def test_backtrace(self):
 "thread backtrace", matching=False, 
patterns=["frame.*std::__.*::__function"]
 )
 # Unfiltered.
+self.expect(
+"bt -u",
+ordered=True,
+patterns=["frame.*foo", "frame.*std::__[^:]*::__function", 
"frame.*main"],
+)
 self.expect(
 "thread backtrace -u",
 ordered=True,

>From fe72e0df59676fbcd44964f8b3dccd675920d886 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 14 Nov 2024 09:26:14 -0800
Subject: [PATCH 2/3] Use -.+ instead of -.*

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

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index 2cdf5e6da6fd13..c1404539bb8e14 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,7 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^(-.*)$", "thread backtrace %1") &&
+bt_regex_cmd_up->AddRegexCommand("^(-.+)$", "thread backtrace %1") &&
 bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
 bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());

>From b83d07056ecaf53a34c3da81ff3472d2c84cc09a Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 14 Nov 2024 10:24:12 -0800
Subject: [PATCH 3/3] Prevent matching of "- "

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

diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index c1404539bb8e14..764dcfd1903b19 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,7 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^(-.+)$", "thread backtrace %1") &&
+bt_regex_cmd_up->AddRegexCommand("^(-[^[:space:]].*)$", "thread 
backtrace %1") &&
 bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
 bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());

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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread Dave Lee via lldb-commits


@@ -851,8 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",

kastiglione wrote:

done

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


[Lldb-commits] [lldb] [lldb] Make Doxygen commits consistent with the rest of LLDB (NFC) (PR #116269)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

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

This fixes a warning that '\class' command should not be used in a comment 
attached to a non-class declaration. It also makes the Doxygen comments in 
SBSaveCoreOptions consistent with the rest of LLDB.

>From b1f29fa814a84fba315d3fac3a32553bfa30766a Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 14 Nov 2024 10:29:42 -0800
Subject: [PATCH] [lldb] Make Doxygen commits consistent with the rest of LLDB
 (NFC)

This fixes a warning that '\class' command should not be used in a
comment attached to a non-class declaration. It also makes the Doxygen
comments in SBSaveCoreOptions consistent with the rest of LLDB.
---
 lldb/include/lldb/API/SBSaveCoreOptions.h | 68 +++
 1 file changed, 44 insertions(+), 24 deletions(-)

diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index c076d3ce6f7575..74aa2fe5bd5f92 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -28,67 +28,87 @@ class LLDB_API SBSaveCoreOptions {
   /// Set the plugin name. Supplying null or empty string will reset
   /// the option.
   ///
-  /// \param plugin Name of the object file plugin.
+  /// \param plugin
+  ///   Name of the object file plugin.
   SBError SetPluginName(const char *plugin);
 
   /// Get the Core dump plugin name, if set.
   ///
-  /// \return The name of the plugin, or null if not set.
+  /// \return
+  ///   The name of the plugin, or null if not set.
   const char *GetPluginName() const;
 
   /// Set the Core dump style.
   ///
-  /// \param style The style of the core dump.
+  /// \param style
+  ///   The style of the core dump.
   void SetStyle(lldb::SaveCoreStyle style);
 
   /// Get the Core dump style, if set.
   ///
-  /// \return The core dump style, or undefined if not set.
+  /// \return
+  ///   The core dump style, or undefined if not set.
   lldb::SaveCoreStyle GetStyle() const;
 
   /// Set the output file path
   ///
-  /// \param output_file a
-  /// \class SBFileSpec object that describes the output file.
+  /// \param
+  ///   output_file a \class SBFileSpec object that describes the output file.
   void SetOutputFile(SBFileSpec output_file);
 
   /// Get the output file spec
   ///
-  /// \return The output file spec.
+  /// \return
+  ///   The output file spec.
   SBFileSpec GetOutputFile() const;
 
   /// Set the process to save, or unset if supplied with a default constructed
   /// process.
   ///
-  /// \param process The process to save.
-  /// \return Success if process was set, otherwise an error
-  /// \note This will clear all process specific options if a different process
-  /// is specified than the current set process, either explicitly from this
-  /// api, or implicitly from any function that requires a process.
+  /// \param process
+  ///   The process to save.
+  ///
+  /// \return
+  ///   Success if process was set, otherwise an error
+  ///
+  /// \note
+  ///   This will clear all process specific options if a different process
+  ///   is specified than the current set process, either explicitly from this
+  ///   api, or implicitly from any function that requires a process.
   SBError SetProcess(lldb::SBProcess process);
 
   /// Add a thread to save in the core file.
   ///
-  /// \param thread The thread to save.
-  /// \note This will set the process if it is not already set, or return
-  /// and error if the SBThread is not from the set process.
+  /// \param thread
+  ///   The thread to save.
+  ///
+  /// \note
+  ///   This will set the process if it is not already set, or return
+  ///   and error if the SBThread is not from the set process.
   SBError AddThread(lldb::SBThread thread);
 
   /// Remove a thread from the list of threads to save.
   ///
-  /// \param thread The thread to remove.
-  /// \return True if the thread was removed, false if it was not in the list.
+  /// \param thread
+  ///   The thread to remove.
+  ///
+  /// \return
+  ///   True if the thread was removed, false if it was not in the list.
   bool RemoveThread(lldb::SBThread thread);
 
   /// Add a memory region to save in the core file.
   ///
-  /// \param region The memory region to save.
-  /// \returns An empty SBError upon success, or an error if the region is
-  /// invalid.
-  /// \note Ranges that overlapped will be unioned into a single region, this
-  /// also supercedes stack minification. Specifying full regions and a
-  /// non-custom core style will include the specified regions and union them
-  /// with all style specific regions.
+  /// \param region
+  ///   The memory region to save.
+  ///
+  /// \returns
+  ///   An empty SBError upon success, or an error if the region is invalid.
+  ///
+  /// \note
+  ///   Ranges that overlapped will be unioned into a single region, this also
+  ///   supercedes stack minification. Specifying full regions and a no

[Lldb-commits] [lldb] [lldb] Make Doxygen commits consistent with the rest of LLDB (NFC) (PR #116269)

2024-11-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

This fixes a warning that '\class' command should not be used in a comment 
attached to a non-class declaration. It also makes the Doxygen comments in 
SBSaveCoreOptions consistent with the rest of LLDB.

rdar://139848370

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


1 Files Affected:

- (modified) lldb/include/lldb/API/SBSaveCoreOptions.h (+44-24) 


``diff
diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index c076d3ce6f7575..74aa2fe5bd5f92 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -28,67 +28,87 @@ class LLDB_API SBSaveCoreOptions {
   /// Set the plugin name. Supplying null or empty string will reset
   /// the option.
   ///
-  /// \param plugin Name of the object file plugin.
+  /// \param plugin
+  ///   Name of the object file plugin.
   SBError SetPluginName(const char *plugin);
 
   /// Get the Core dump plugin name, if set.
   ///
-  /// \return The name of the plugin, or null if not set.
+  /// \return
+  ///   The name of the plugin, or null if not set.
   const char *GetPluginName() const;
 
   /// Set the Core dump style.
   ///
-  /// \param style The style of the core dump.
+  /// \param style
+  ///   The style of the core dump.
   void SetStyle(lldb::SaveCoreStyle style);
 
   /// Get the Core dump style, if set.
   ///
-  /// \return The core dump style, or undefined if not set.
+  /// \return
+  ///   The core dump style, or undefined if not set.
   lldb::SaveCoreStyle GetStyle() const;
 
   /// Set the output file path
   ///
-  /// \param output_file a
-  /// \class SBFileSpec object that describes the output file.
+  /// \param
+  ///   output_file a \class SBFileSpec object that describes the output file.
   void SetOutputFile(SBFileSpec output_file);
 
   /// Get the output file spec
   ///
-  /// \return The output file spec.
+  /// \return
+  ///   The output file spec.
   SBFileSpec GetOutputFile() const;
 
   /// Set the process to save, or unset if supplied with a default constructed
   /// process.
   ///
-  /// \param process The process to save.
-  /// \return Success if process was set, otherwise an error
-  /// \note This will clear all process specific options if a different process
-  /// is specified than the current set process, either explicitly from this
-  /// api, or implicitly from any function that requires a process.
+  /// \param process
+  ///   The process to save.
+  ///
+  /// \return
+  ///   Success if process was set, otherwise an error
+  ///
+  /// \note
+  ///   This will clear all process specific options if a different process
+  ///   is specified than the current set process, either explicitly from this
+  ///   api, or implicitly from any function that requires a process.
   SBError SetProcess(lldb::SBProcess process);
 
   /// Add a thread to save in the core file.
   ///
-  /// \param thread The thread to save.
-  /// \note This will set the process if it is not already set, or return
-  /// and error if the SBThread is not from the set process.
+  /// \param thread
+  ///   The thread to save.
+  ///
+  /// \note
+  ///   This will set the process if it is not already set, or return
+  ///   and error if the SBThread is not from the set process.
   SBError AddThread(lldb::SBThread thread);
 
   /// Remove a thread from the list of threads to save.
   ///
-  /// \param thread The thread to remove.
-  /// \return True if the thread was removed, false if it was not in the list.
+  /// \param thread
+  ///   The thread to remove.
+  ///
+  /// \return
+  ///   True if the thread was removed, false if it was not in the list.
   bool RemoveThread(lldb::SBThread thread);
 
   /// Add a memory region to save in the core file.
   ///
-  /// \param region The memory region to save.
-  /// \returns An empty SBError upon success, or an error if the region is
-  /// invalid.
-  /// \note Ranges that overlapped will be unioned into a single region, this
-  /// also supercedes stack minification. Specifying full regions and a
-  /// non-custom core style will include the specified regions and union them
-  /// with all style specific regions.
+  /// \param region
+  ///   The memory region to save.
+  ///
+  /// \returns
+  ///   An empty SBError upon success, or an error if the region is invalid.
+  ///
+  /// \note
+  ///   Ranges that overlapped will be unioned into a single region, this also
+  ///   supercedes stack minification. Specifying full regions and a non-custom
+  ///   core style will include the specified regions and union them with all
+  ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
   /// Reset all options.

``




https://github.com/llvm/llvm-project/pull/116269
___
lldb-commits mailing list
l

[Lldb-commits] [lldb] [lldb] Make Doxygen commits consistent with the rest of LLDB (NFC) (PR #116269)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Jacob Lalonde via lldb-commits

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

I'm not expert, but everything looks rigorous and you've added a lot of 
comments.

I left a few nits and a singular question. I would encourage comments on some 
file descriptors for the less knowledgeable of us (namely me!)

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Jacob Lalonde via lldb-commits


@@ -384,6 +313,21 @@ void 
MainLoopPosix::ProcessReadObject(IOObject::WaitableHandle handle) {
 it->second(*this); // Do the work
 }
 
+void MainLoopPosix::ProcessSignals() {
+  std::vector signals;

Jlalond wrote:

(Uneducated question) Is int actually the correct type for signals, and not an 
unsigned value?

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Jacob Lalonde via lldb-commits


@@ -179,55 +142,34 @@ Status MainLoopPosix::RunImpl::Poll() {
 read_fds.push_back(pfd);
   }
 
-  if (ppoll(read_fds.data(), read_fds.size(), nullptr, &sigmask) == -1 &&
+  if (ppoll(read_fds.data(), read_fds.size(),
+/*timeout=*/nullptr,

Jlalond wrote:

Would a reasonable timeout make sense as a precaution? 

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


[Lldb-commits] [lldb] c923ac0 - [lldb] Make Doxygen commits consistent with the rest of LLDB (NFC) (#116269)

2024-11-14 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-11-14T11:12:11-08:00
New Revision: c923ac08f0e9905a5522e9f78118623583a3f845

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

LOG: [lldb] Make Doxygen commits consistent with the rest of LLDB (NFC) 
(#116269)

This fixes a warning that '\class' command should not be used in a
comment attached to a non-class declaration. It also makes the Doxygen
comments in SBSaveCoreOptions consistent with the rest of LLDB.

rdar://139848370

Added: 


Modified: 
lldb/include/lldb/API/SBSaveCoreOptions.h

Removed: 




diff  --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index c076d3ce6f7575..74aa2fe5bd5f92 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -28,67 +28,87 @@ class LLDB_API SBSaveCoreOptions {
   /// Set the plugin name. Supplying null or empty string will reset
   /// the option.
   ///
-  /// \param plugin Name of the object file plugin.
+  /// \param plugin
+  ///   Name of the object file plugin.
   SBError SetPluginName(const char *plugin);
 
   /// Get the Core dump plugin name, if set.
   ///
-  /// \return The name of the plugin, or null if not set.
+  /// \return
+  ///   The name of the plugin, or null if not set.
   const char *GetPluginName() const;
 
   /// Set the Core dump style.
   ///
-  /// \param style The style of the core dump.
+  /// \param style
+  ///   The style of the core dump.
   void SetStyle(lldb::SaveCoreStyle style);
 
   /// Get the Core dump style, if set.
   ///
-  /// \return The core dump style, or undefined if not set.
+  /// \return
+  ///   The core dump style, or undefined if not set.
   lldb::SaveCoreStyle GetStyle() const;
 
   /// Set the output file path
   ///
-  /// \param output_file a
-  /// \class SBFileSpec object that describes the output file.
+  /// \param
+  ///   output_file a \class SBFileSpec object that describes the output file.
   void SetOutputFile(SBFileSpec output_file);
 
   /// Get the output file spec
   ///
-  /// \return The output file spec.
+  /// \return
+  ///   The output file spec.
   SBFileSpec GetOutputFile() const;
 
   /// Set the process to save, or unset if supplied with a default constructed
   /// process.
   ///
-  /// \param process The process to save.
-  /// \return Success if process was set, otherwise an error
-  /// \note This will clear all process specific options if a 
diff erent process
-  /// is specified than the current set process, either explicitly from this
-  /// api, or implicitly from any function that requires a process.
+  /// \param process
+  ///   The process to save.
+  ///
+  /// \return
+  ///   Success if process was set, otherwise an error
+  ///
+  /// \note
+  ///   This will clear all process specific options if a 
diff erent process
+  ///   is specified than the current set process, either explicitly from this
+  ///   api, or implicitly from any function that requires a process.
   SBError SetProcess(lldb::SBProcess process);
 
   /// Add a thread to save in the core file.
   ///
-  /// \param thread The thread to save.
-  /// \note This will set the process if it is not already set, or return
-  /// and error if the SBThread is not from the set process.
+  /// \param thread
+  ///   The thread to save.
+  ///
+  /// \note
+  ///   This will set the process if it is not already set, or return
+  ///   and error if the SBThread is not from the set process.
   SBError AddThread(lldb::SBThread thread);
 
   /// Remove a thread from the list of threads to save.
   ///
-  /// \param thread The thread to remove.
-  /// \return True if the thread was removed, false if it was not in the list.
+  /// \param thread
+  ///   The thread to remove.
+  ///
+  /// \return
+  ///   True if the thread was removed, false if it was not in the list.
   bool RemoveThread(lldb::SBThread thread);
 
   /// Add a memory region to save in the core file.
   ///
-  /// \param region The memory region to save.
-  /// \returns An empty SBError upon success, or an error if the region is
-  /// invalid.
-  /// \note Ranges that overlapped will be unioned into a single region, this
-  /// also supercedes stack minification. Specifying full regions and a
-  /// non-custom core style will include the specified regions and union them
-  /// with all style specific regions.
+  /// \param region
+  ///   The memory region to save.
+  ///
+  /// \returns
+  ///   An empty SBError upon success, or an error if the region is invalid.
+  ///
+  /// \note
+  ///   Ranges that overlapped will be unioned into a single region, this also
+  ///   supercedes stack minification. Specifying full regions and a non-custom
+  ///   core style will include the specified regions 

[Lldb-commits] [lldb] [lldb] Make Doxygen commits consistent with the rest of LLDB (NFC) (PR #116269)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] fix: Target Process may crash or freezes on detaching process on windows (PR #115712)

2024-11-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] fix: Target Process may crash or freezes on detaching process on windows (PR #115712)

2024-11-14 Thread via lldb-commits

anatawa12 wrote:

> Do you need me to push the "merge" button?

Yes please. I don't have merge button.

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap.cpp to not use global DAP variable. (PR #116272)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

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

🥳

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jason Molenda via lldb-commits


@@ -288,8 +288,15 @@ Status ScriptedProcess::DoGetMemoryRegionInfo(lldb::addr_t 
load_addr,
   MemoryRegionInfo ®ion) {
   Status error;
   if (auto region_or_err =
-  GetInterface().GetMemoryRegionContainingAddress(load_addr, error))
+  GetInterface().GetMemoryRegionContainingAddress(load_addr, error)) {
 region = *region_or_err;
+if (region.GetRange().GetRangeBase() == 0 &&
+(region.GetRange().GetByteSize() == 0 ||
+ region.GetRange().GetByteSize() == LLDB_INVALID_ADDRESS)) {

jasonmolenda wrote:

I see what you mean for checking the address is contained within the range, and 
rejecting it if not, this works too.

Right now if a stub returns {0, UINT64_MAX} and we don't have a memory 
allocation packet, IRMemory::FindSpace will find no available virtual address 
space and all expressions will fail.

My opposition to {0, UINT64_MAX} being accepted is that it's meaningless.  No 
processor actually has 64-bits of addressing, so telling me that all memory is 
addressable is obviously wrong.  It will break IRMemoryMap::FindSpace's 
algorithm, and this response tells us nothing more than if qMemoryRegionInfo 
was an unsupported packet.

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) (PR #116298)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben created 
https://github.com/llvm/llvm-project/pull/116298

This patch moves some of the logic implemented in the SBFrame APIs to the 
lldb_private::StackFrame class so it can be re-used elsewhere.

>From c5bd8c739816988a6a3c710704fc83a298811bf6 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Thu, 14 Nov 2024 15:31:26 -0800
Subject: [PATCH] [lldb/API] Hoist some of SBFrame logic to
 lldb_private::StackFrame (NFC)

This patch moves some of the logic implemented in the SBFrame APIs to
the lldb_private::StackFrame class so it can be re-used elsewhere.

Signed-off-by: Med Ismail Bennani 
---
 lldb/include/lldb/Target/StackFrame.h | 12 ++
 lldb/source/API/SBFrame.cpp   | 58 +++
 lldb/source/Target/StackFrame.cpp | 51 +++
 3 files changed, 69 insertions(+), 52 deletions(-)

diff --git a/lldb/include/lldb/Target/StackFrame.h 
b/lldb/include/lldb/Target/StackFrame.h
index fce3a943413ca4..e85430791b7d93 100644
--- a/lldb/include/lldb/Target/StackFrame.h
+++ b/lldb/include/lldb/Target/StackFrame.h
@@ -408,6 +408,18 @@ class StackFrame : public ExecutionContextScope,
   /// system implementation details this way.
   bool IsHidden();
 
+  /// Get the frame's demangled name.
+  ///
+  ///  /// \return
+  ///   A C-String containing the function demangled name. Can be null.
+  const char *GetFunctionName();
+
+  /// Get the frame's demangled display name.
+  ///
+  ///  /// \return
+  ///   A C-String containing the function demangled display name. Can be null.
+  const char *GetDisplayFunctionName();
+
   /// Query this frame to find what frame it is in this Thread's
   /// StackFrameList.
   ///
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index dc41e80b457d7d..e2c691fa9bfd45 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -1173,12 +1173,8 @@ bool SBFrame::IsInlined() const {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process->GetRunLock())) {
   frame = exe_ctx.GetFramePtr();
-  if (frame) {
-
-Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
-if (block)
-  return block->GetContainingInlinedBlock() != nullptr;
-  }
+  if (frame)
+return frame->IsInlined();
 }
   }
   return false;
@@ -1255,29 +1251,8 @@ const char *SBFrame::GetFunctionName() const {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process->GetRunLock())) {
   frame = exe_ctx.GetFramePtr();
-  if (frame) {
-SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
- eSymbolContextBlock |
- eSymbolContextSymbol));
-if (sc.block) {
-  Block *inlined_block = sc.block->GetContainingInlinedBlock();
-  if (inlined_block) {
-const InlineFunctionInfo *inlined_info =
-inlined_block->GetInlinedFunctionInfo();
-name = inlined_info->GetName().AsCString();
-  }
-}
-
-if (name == nullptr) {
-  if (sc.function)
-name = sc.function->GetName().GetCString();
-}
-
-if (name == nullptr) {
-  if (sc.symbol)
-name = sc.symbol->GetName().GetCString();
-}
-  }
+  if (frame)
+return frame->GetFunctionName();
 }
   }
   return name;
@@ -1298,29 +1273,8 @@ const char *SBFrame::GetDisplayFunctionName() {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process->GetRunLock())) {
   frame = exe_ctx.GetFramePtr();
-  if (frame) {
-SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
- eSymbolContextBlock |
- eSymbolContextSymbol));
-if (sc.block) {
-  Block *inlined_block = sc.block->GetContainingInlinedBlock();
-  if (inlined_block) {
-const InlineFunctionInfo *inlined_info =
-inlined_block->GetInlinedFunctionInfo();
-name = inlined_info->GetDisplayName().AsCString();
-  }
-}
-
-if (name == nullptr) {
-  if (sc.function)
-name = sc.function->GetDisplayName().GetCString();
-}
-
-if (name == nullptr) {
-  if (sc.symbol)
-name = sc.symbol->GetDisplayName().GetCString();
-}
-  }
+  if (frame)
+return frame->GetDisplayFunctionName();
 }
   }
   return name;
diff --git a/lldb/source/Target/StackFrame.cpp 
b/lldb/source/Target/StackFrame.cpp
index 20d8425c578a33..77179fec3ed438 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1230,6 +1230,57 @@ bool StackFrame::IsHidden() {
   return false;
 }
 
+const char *StackFrame::GetFunctionName() {
+  const char *name = nullptr;
+  SymbolConte

[Lldb-commits] [lldb] [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) (PR #116298)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

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

LGTM. Ideally the SB API is just a shim around the private types.

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


[Lldb-commits] [lldb] [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) (PR #116298)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

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


[Lldb-commits] [lldb] [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) (PR #116298)

2024-11-14 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) (PR #116298)

2024-11-14 Thread via lldb-commits

https://github.com/jimingham commented:

Add the check for a NULL InlinedFunctionInfo return, and this is good to go.

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


[Lldb-commits] [lldb] [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) (PR #116298)

2024-11-14 Thread via lldb-commits


@@ -1230,6 +1230,57 @@ bool StackFrame::IsHidden() {
   return false;
 }
 
+const char *StackFrame::GetFunctionName() {
+  const char *name = nullptr;
+  SymbolContext sc = GetSymbolContext(
+  eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol);
+  if (sc.block) {
+Block *inlined_block = sc.block->GetContainingInlinedBlock();
+if (inlined_block) {
+  const InlineFunctionInfo *inlined_info =

jimingham wrote:

You didn't do this but since you're touching this...  GetInlinedFunctionInfo is 
not guaranteed to return a non-null pointer.  Other places that access the 
underlying m_inlineInfoSP always check it against nullptr before accessing it.  
Probably a good idea to do that here as well...

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


[Lldb-commits] [lldb] [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) (PR #116298)

2024-11-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] 9c7701f - [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) (#116298)

2024-11-14 Thread via lldb-commits

Author: Med Ismail Bennani
Date: 2024-11-14T15:37:34-08:00
New Revision: 9c7701fa78037af03be10ed168fd3c75a2ed1aef

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

LOG: [lldb/API] Hoist some of SBFrame logic to lldb_private::StackFrame (NFC) 
(#116298)

This patch moves some of the logic implemented in the SBFrame APIs to
the lldb_private::StackFrame class so it can be re-used elsewhere.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/include/lldb/Target/StackFrame.h
lldb/source/API/SBFrame.cpp
lldb/source/Target/StackFrame.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/StackFrame.h 
b/lldb/include/lldb/Target/StackFrame.h
index fce3a943413ca4..e85430791b7d93 100644
--- a/lldb/include/lldb/Target/StackFrame.h
+++ b/lldb/include/lldb/Target/StackFrame.h
@@ -408,6 +408,18 @@ class StackFrame : public ExecutionContextScope,
   /// system implementation details this way.
   bool IsHidden();
 
+  /// Get the frame's demangled name.
+  ///
+  ///  /// \return
+  ///   A C-String containing the function demangled name. Can be null.
+  const char *GetFunctionName();
+
+  /// Get the frame's demangled display name.
+  ///
+  ///  /// \return
+  ///   A C-String containing the function demangled display name. Can be null.
+  const char *GetDisplayFunctionName();
+
   /// Query this frame to find what frame it is in this Thread's
   /// StackFrameList.
   ///

diff  --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index dc41e80b457d7d..e2c691fa9bfd45 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -1173,12 +1173,8 @@ bool SBFrame::IsInlined() const {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process->GetRunLock())) {
   frame = exe_ctx.GetFramePtr();
-  if (frame) {
-
-Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
-if (block)
-  return block->GetContainingInlinedBlock() != nullptr;
-  }
+  if (frame)
+return frame->IsInlined();
 }
   }
   return false;
@@ -1255,29 +1251,8 @@ const char *SBFrame::GetFunctionName() const {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process->GetRunLock())) {
   frame = exe_ctx.GetFramePtr();
-  if (frame) {
-SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
- eSymbolContextBlock |
- eSymbolContextSymbol));
-if (sc.block) {
-  Block *inlined_block = sc.block->GetContainingInlinedBlock();
-  if (inlined_block) {
-const InlineFunctionInfo *inlined_info =
-inlined_block->GetInlinedFunctionInfo();
-name = inlined_info->GetName().AsCString();
-  }
-}
-
-if (name == nullptr) {
-  if (sc.function)
-name = sc.function->GetName().GetCString();
-}
-
-if (name == nullptr) {
-  if (sc.symbol)
-name = sc.symbol->GetName().GetCString();
-}
-  }
+  if (frame)
+return frame->GetFunctionName();
 }
   }
   return name;
@@ -1298,29 +1273,8 @@ const char *SBFrame::GetDisplayFunctionName() {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process->GetRunLock())) {
   frame = exe_ctx.GetFramePtr();
-  if (frame) {
-SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
- eSymbolContextBlock |
- eSymbolContextSymbol));
-if (sc.block) {
-  Block *inlined_block = sc.block->GetContainingInlinedBlock();
-  if (inlined_block) {
-const InlineFunctionInfo *inlined_info =
-inlined_block->GetInlinedFunctionInfo();
-name = inlined_info->GetDisplayName().AsCString();
-  }
-}
-
-if (name == nullptr) {
-  if (sc.function)
-name = sc.function->GetDisplayName().GetCString();
-}
-
-if (name == nullptr) {
-  if (sc.symbol)
-name = sc.symbol->GetDisplayName().GetCString();
-}
-  }
+  if (frame)
+return frame->GetDisplayFunctionName();
 }
   }
   return name;

diff  --git a/lldb/source/Target/StackFrame.cpp 
b/lldb/source/Target/StackFrame.cpp
index 20d8425c578a33..77179fec3ed438 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1230,6 +1230,57 @@ bool StackFrame::IsHidden() {
   return false;
 }
 
+const char *StackFrame::GetFunctionName() {
+  const char *name = nullptr;
+  SymbolContext sc = GetSymbolContext(
+  eSymbolContextFunction | eSymbolConte

[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap.cpp to not use global DAP variable. (PR #116272)

2024-11-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo approved this pull request.


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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap.cpp to not use global DAP variable. (PR #116272)

2024-11-14 Thread John Harrison via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap.cpp to not use global DAP variable. (PR #116272)

2024-11-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)


Changes

This removes the global DAP variable and instead allocates a DAP instance in 
main. This should allow us to refactor lldb-dap to enable a server mode that 
accepts multiple connections.

---

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


3 Files Affected:

- (modified) lldb/tools/lldb-dap/DAP.cpp (+4-6) 
- (modified) lldb/tools/lldb-dap/DAP.h (+1-3) 
- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+543-543) 


``diff
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index bdb24fc78cfb64..aee6214857bd0d 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -32,8 +32,6 @@ using namespace lldb_dap;
 
 namespace lldb_dap {
 
-DAP g_dap;
-
 DAP::DAP()
 : broadcaster("lldb-dap"), exception_breakpoints(),
   focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false), 
is_attach(false),
@@ -693,15 +691,15 @@ bool DAP::HandleObject(const llvm::json::Object &object) {
   if (packet_type == "request") {
 const auto command = GetString(object, "command");
 auto handler_pos = request_handlers.find(command);
-if (handler_pos != request_handlers.end()) {
-  handler_pos->second(object);
-  return true; // Success
-} else {
+if (handler_pos == request_handlers.end()) {
   if (log)
 *log << "error: unhandled command \"" << command.data() << "\""
  << std::endl;
   return false; // Fail
 }
+
+handler_pos->second(*this, object);
+return true; // Success
   }
 
   if (packet_type == "response") {
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index 5381b3271ba96f..c6e86a59875ea2 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -63,7 +63,7 @@ enum DAPBroadcasterBits {
   eBroadcastBitStopProgressThread = 1u << 1
 };
 
-typedef void (*RequestCallback)(const llvm::json::Object &command);
+typedef void (*RequestCallback)(DAP &dap, const llvm::json::Object &command);
 typedef void (*ResponseCallback)(llvm::Expected value);
 
 enum class PacketStatus {
@@ -353,8 +353,6 @@ struct DAP {
   void SendJSON(const std::string &json_str);
 };
 
-extern DAP g_dap;
-
 } // namespace lldb_dap
 
 #endif
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index fc22ec03b672e6..055a012ed51c6a 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -24,7 +24,6 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/ScopeExit.h"
-#include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
@@ -119,34 +118,34 @@ constexpr int StackPageSize = 20;
 
 /// Prints a welcome message on the editor if the preprocessor variable
 /// LLDB_DAP_WELCOME_MESSAGE is defined.
-static void PrintWelcomeMessage() {
+static void PrintWelcomeMessage(DAP &dap) {
 #ifdef LLDB_DAP_WELCOME_MESSAGE
-  g_dap.SendOutput(OutputType::Console, LLDB_DAP_WELCOME_MESSAGE);
+  dap.SendOutput(OutputType::Console, LLDB_DAP_WELCOME_MESSAGE);
 #endif
 }
 
-lldb::SBValueList *GetTopLevelScope(int64_t variablesReference) {
+lldb::SBValueList *GetTopLevelScope(DAP &dap, int64_t variablesReference) {
   switch (variablesReference) {
   case VARREF_LOCALS:
-return &g_dap.variables.locals;
+return &dap.variables.locals;
   case VARREF_GLOBALS:
-return &g_dap.variables.globals;
+return &dap.variables.globals;
   case VARREF_REGS:
-return &g_dap.variables.registers;
+return &dap.variables.registers;
   default:
 return nullptr;
   }
 }
 
-SOCKET AcceptConnection(int portno) {
+SOCKET AcceptConnection(DAP &dap, int portno) {
   // Accept a socket connection from any host on "portno".
   SOCKET newsockfd = -1;
   struct sockaddr_in serv_addr, cli_addr;
   SOCKET sockfd = socket(AF_INET, SOCK_STREAM, 0);
   if (sockfd < 0) {
-if (g_dap.log)
-  *g_dap.log << "error: opening socket (" << strerror(errno) << ")"
- << std::endl;
+if (dap.log)
+  *dap.log << "error: opening socket (" << strerror(errno) << ")"
+   << std::endl;
   } else {
 memset((char *)&serv_addr, 0, sizeof(serv_addr));
 serv_addr.sin_family = AF_INET;
@@ -154,9 +153,9 @@ SOCKET AcceptConnection(int portno) {
 serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 serv_addr.sin_port = htons(portno);
 if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
-  if (g_dap.log)
-*g_dap.log << "error: binding socket (" << strerror(errno) << ")"
-   << std::endl;
+  if (dap.log)
+*dap.log << "error: binding socket (" << strerror(errno) << ")"
+ << std::endl;
 } else {
   listen(sockfd, 5);
   socklen_t clilen = sizeof(cli_addr);
@@ -164,9 +163,8 @@ SOCKET AcceptConnection(int portn

[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap.cpp to not use global DAP variable. (PR #116272)

2024-11-14 Thread Walter Erquinigo via lldb-commits


@@ -5046,30 +5026,50 @@ int main(int argc, char *argv[]) {
 pause();
   }
 #endif
+
+  // Initialize LLDB first before we do anything.
+  lldb::SBDebugger::Initialize();
+
+  // Terminate the debugger before the C++ destructor chain kicks in.
+  auto terminate_debugger =
+  llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); });
+
+  DAP dap;
+  dap.debug_adaptor_path = program_path.str().str();
+  dap.repl_mode = defaultReplMode;

walter-erquinigo wrote:

can you add the debug_adaptor_path and the repl_mode in the constrsuctor of the 
Dap class?

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


[Lldb-commits] [lldb] [lldb/Target] Add null-check before dereferencing inlined_info (NFC) (PR #116300)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben updated 
https://github.com/llvm/llvm-project/pull/116300

>From fd5ba55ee1d1231fc0acf19ee124d811da795a41 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Thu, 14 Nov 2024 16:09:53 -0800
Subject: [PATCH] [lldb/Target] Add null-check before dereferencing
 inlined_info (NFC)

This patch is a follow-up to 9c7701fa78037af03be10ed168fd3c75a2ed1aef
and adds extra-null checks before dereferencing the inlined_info
pointer.

Signed-off-by: Med Ismail Bennani 
---
 lldb/source/Target/StackFrame.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Target/StackFrame.cpp 
b/lldb/source/Target/StackFrame.cpp
index 77179fec3ed438..1bca9786fb7c70 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1239,7 +1239,8 @@ const char *StackFrame::GetFunctionName() {
 if (inlined_block) {
   const InlineFunctionInfo *inlined_info =
   inlined_block->GetInlinedFunctionInfo();
-  name = inlined_info->GetName().AsCString();
+  if (inlined_info)
+name = inlined_info->GetName().AsCString();
 }
   }
 
@@ -1265,7 +1266,8 @@ const char *StackFrame::GetDisplayFunctionName() {
 if (inlined_block) {
   const InlineFunctionInfo *inlined_info =
   inlined_block->GetInlinedFunctionInfo();
-  name = inlined_info->GetDisplayName().AsCString();
+  if (inlined_info)
+name = inlined_info->GetDisplayName().AsCString();
 }
   }
 

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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap.cpp to not use global DAP variable. (PR #116272)

2024-11-14 Thread John Harrison via lldb-commits

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


[Lldb-commits] [lldb] [lldb/Target] Add null-check before dereferencing inlined_info (NFC) (PR #116300)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

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


[Lldb-commits] [lldb] [lldb/Target] Add null-check before dereferencing inlined_info (NFC) (PR #116300)

2024-11-14 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] 1857d29 - [lldb/Target] Add null-check before dereferencing inlined_info (NFC) (#116300)

2024-11-14 Thread via lldb-commits

Author: Med Ismail Bennani
Date: 2024-11-14T16:12:38-08:00
New Revision: 1857d297354fd307d2b30ff69036cc343d2fd692

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

LOG: [lldb/Target] Add null-check before dereferencing inlined_info (NFC) 
(#116300)

This patch is a follow-up to 9c7701fa78037af03be10ed168fd3c75a2ed1aef
and adds extra-null checks before dereferencing the inlined_info
pointer.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Target/StackFrame.cpp

Removed: 




diff  --git a/lldb/source/Target/StackFrame.cpp 
b/lldb/source/Target/StackFrame.cpp
index 77179fec3ed438..1bca9786fb7c70 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1239,7 +1239,8 @@ const char *StackFrame::GetFunctionName() {
 if (inlined_block) {
   const InlineFunctionInfo *inlined_info =
   inlined_block->GetInlinedFunctionInfo();
-  name = inlined_info->GetName().AsCString();
+  if (inlined_info)
+name = inlined_info->GetName().AsCString();
 }
   }
 
@@ -1265,7 +1266,8 @@ const char *StackFrame::GetDisplayFunctionName() {
 if (inlined_block) {
   const InlineFunctionInfo *inlined_info =
   inlined_block->GetInlinedFunctionInfo();
-  name = inlined_info->GetDisplayName().AsCString();
+  if (inlined_info)
+name = inlined_info->GetDisplayName().AsCString();
 }
   }
 



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


[Lldb-commits] [lldb] [lldb/Target] Add null-check before dereferencing inlined_info (NFC) (PR #116300)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

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


[Lldb-commits] [lldb] [lldb/Target] Add null-check before dereferencing inlined_info (NFC) (PR #116300)

2024-11-14 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben created 
https://github.com/llvm/llvm-project/pull/116300

This patch is a follow-up to 5b6b0c97ff09de2850577bbabe1f0c296d1c7af1 and adds 
extra-null checks before dereferencing the inlined_info pointer.

>From cbd6cd71cdd99db615445d0c5591482a12b61df8 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Thu, 14 Nov 2024 16:06:13 -0800
Subject: [PATCH] [lldb/Target] Add null-check before dereferencing
 inlined_info (NFC)

This patch is a follow-up to 5b6b0c97ff09de2850577bbabe1f0c296d1c7af1
and adds extra-null checks before dereferencing the inlined_info
pointer.

Signed-off-by: Med Ismail Bennani 
---
 lldb/source/Target/StackFrame.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Target/StackFrame.cpp 
b/lldb/source/Target/StackFrame.cpp
index 77179fec3ed438..1bca9786fb7c70 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1239,7 +1239,8 @@ const char *StackFrame::GetFunctionName() {
 if (inlined_block) {
   const InlineFunctionInfo *inlined_info =
   inlined_block->GetInlinedFunctionInfo();
-  name = inlined_info->GetName().AsCString();
+  if (inlined_info)
+name = inlined_info->GetName().AsCString();
 }
   }
 
@@ -1265,7 +1266,8 @@ const char *StackFrame::GetDisplayFunctionName() {
 if (inlined_block) {
   const InlineFunctionInfo *inlined_info =
   inlined_block->GetInlinedFunctionInfo();
-  name = inlined_info->GetDisplayName().AsCString();
+  if (inlined_info)
+name = inlined_info->GetDisplayName().AsCString();
 }
   }
 

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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap.cpp to not use global DAP variable. (PR #116272)

2024-11-14 Thread John Harrison via lldb-commits


@@ -5046,30 +5026,50 @@ int main(int argc, char *argv[]) {
 pause();
   }
 #endif
+
+  // Initialize LLDB first before we do anything.
+  lldb::SBDebugger::Initialize();
+
+  // Terminate the debugger before the C++ destructor chain kicks in.
+  auto terminate_debugger =
+  llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); });
+
+  DAP dap;
+  dap.debug_adaptor_path = program_path.str().str();
+  dap.repl_mode = defaultReplMode;

ashgti wrote:

Done, moved those both to the constructor.

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


[Lldb-commits] [lldb] 5d16fbc - [lldb] Support any flag to _regexp-bt (#116260)

2024-11-14 Thread via lldb-commits

Author: Dave Lee
Date: 2024-11-14T13:27:41-08:00
New Revision: 5d16fbc275d57b88866a2606453ead6a024ffee0

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

LOG: [lldb] Support any flag to _regexp-bt (#116260)

In particular, this allows `bt -u`.

Note that this passthrough behavior has precedent in `_regexp-break`,
where `b (-.*)` is expanded to `breakpoint set %1`.

Added: 


Modified: 
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py

Removed: 




diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index f2712af0a08a73..764dcfd1903b19 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,8 +851,7 @@ void CommandInterpreter::LoadCommandDictionary() {
 // now "bt 3" is the preferred form, in line with gdb.
 if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",
- "thread backtrace -c %1") &&
+bt_regex_cmd_up->AddRegexCommand("^(-[^[:space:]].*)$", "thread 
backtrace %1") &&
 bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
 bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());

diff  --git 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
index d1cb8214d658ff..978bf2066e43b0 100644
--- 
a/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
+++ 
b/lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py
@@ -46,6 +46,11 @@ def test_backtrace(self):
 "thread backtrace", matching=False, 
patterns=["frame.*std::__.*::__function"]
 )
 # Unfiltered.
+self.expect(
+"bt -u",
+ordered=True,
+patterns=["frame.*foo", "frame.*std::__[^:]*::__function", 
"frame.*main"],
+)
 self.expect(
 "thread backtrace -u",
 ordered=True,



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


[Lldb-commits] [lldb] [lldb] Support any flag to _regexp-bt (PR #116260)

2024-11-14 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Pavel Labath via lldb-commits


@@ -288,8 +288,15 @@ Status ScriptedProcess::DoGetMemoryRegionInfo(lldb::addr_t 
load_addr,
   MemoryRegionInfo ®ion) {
   Status error;
   if (auto region_or_err =
-  GetInterface().GetMemoryRegionContainingAddress(load_addr, error))
+  GetInterface().GetMemoryRegionContainingAddress(load_addr, error)) {
 region = *region_or_err;
+if (region.GetRange().GetRangeBase() == 0 &&
+(region.GetRange().GetByteSize() == 0 ||
+ region.GetRange().GetByteSize() == LLDB_INVALID_ADDRESS)) {

labath wrote:

I guess the reason I don't like that is that it just feels like a very special 
case. Like if I send two regions, each covering half the address space, then 
I'm sort of saying the same thing, but unlike the single region, this response 
will get accepted. It also doesn't handle the case of a 32 bit address space 
being full. The fact that this breaks all of expression evaluation might be 
sort of a good thing actually, as it means the problem is likely to be caught.

If you feel strongly about this, then I don't want to stand in your way, but I 
would rather not have this special case.

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jason Molenda via lldb-commits


@@ -288,8 +288,15 @@ Status ScriptedProcess::DoGetMemoryRegionInfo(lldb::addr_t 
load_addr,
   MemoryRegionInfo ®ion) {
   Status error;
   if (auto region_or_err =
-  GetInterface().GetMemoryRegionContainingAddress(load_addr, error))
+  GetInterface().GetMemoryRegionContainingAddress(load_addr, error)) {
 region = *region_or_err;
+if (region.GetRange().GetRangeBase() == 0 &&
+(region.GetRange().GetByteSize() == 0 ||
+ region.GetRange().GetByteSize() == LLDB_INVALID_ADDRESS)) {

jasonmolenda wrote:

No, your points make sense, thanks for sticking with this discussion.  I'll 
update the patch as you suggest.

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda updated 
https://github.com/llvm/llvm-project/pull/115963

>From f8f1d70d1d9eac6d36c0fa84e2a94c032385da39 Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Tue, 12 Nov 2024 15:55:15 -0800
Subject: [PATCH 1/5] [lldb] Handle an empty SBMemoryRegionInfo from scripted
 process

A scripted process implementation might return an SBMemoryRegionInfo
object in its implementation of `get_memory_region_containing_address`
which will have an address 0 and size 0, without realizing the
problems this can cause.  One problem happens when an expression
is run, and lldb needs to find part of the target's virtual address
space to store the result (actually stored in lldb's host memory),
it uses IRMemoryMap::FindSpace() to do that.  If the process supports
GetMemoryRegionInfo, FindSpace will step through the allocated
memory ranges looking for an unused one.  But if every request is
a memory region with address 0 + size 0, this loop will never
terminate.  Detect this kind of response from a scripted process
plugin and return an error, so callers iterating over the address
space can exit.

Added a test where I copied dummy_scripted_process.py from the
TestScriptedProcess.py existing test, and added a bad
`get_memory_region_containing_address` implementation.

rdar://139678032
---
 .../Process/scripted/ScriptedProcess.cpp  |   9 +-
 .../Makefile  |   3 +
 .../TestScriptedProcessEmptyMemoryRegion.py   |  33 +
 .../dummy_scripted_process.py | 137 ++
 .../main.c|   1 +
 5 files changed, 182 insertions(+), 1 deletion(-)
 create mode 100644 
lldb/test/API/functionalities/scripted_process_empty_memory_region/Makefile
 create mode 100644 
lldb/test/API/functionalities/scripted_process_empty_memory_region/TestScriptedProcessEmptyMemoryRegion.py
 create mode 100644 
lldb/test/API/functionalities/scripted_process_empty_memory_region/dummy_scripted_process.py
 create mode 100644 
lldb/test/API/functionalities/scripted_process_empty_memory_region/main.c

diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp 
b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index d2111ce877ce55..c56e24a4ebd188 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -288,8 +288,15 @@ Status ScriptedProcess::DoGetMemoryRegionInfo(lldb::addr_t 
load_addr,
   MemoryRegionInfo ®ion) {
   Status error;
   if (auto region_or_err =
-  GetInterface().GetMemoryRegionContainingAddress(load_addr, error))
+  GetInterface().GetMemoryRegionContainingAddress(load_addr, error)) {
 region = *region_or_err;
+if (region.GetRange().GetRangeBase() == 0 &&
+(region.GetRange().GetByteSize() == 0 ||
+ region.GetRange().GetByteSize() == LLDB_INVALID_ADDRESS)) {
+  error = Status::FromErrorString(
+  "Invalid memory region from scripted process");
+}
+  }
 
   return error;
 }
diff --git 
a/lldb/test/API/functionalities/scripted_process_empty_memory_region/Makefile 
b/lldb/test/API/functionalities/scripted_process_empty_memory_region/Makefile
new file mode 100644
index 00..10495940055b63
--- /dev/null
+++ 
b/lldb/test/API/functionalities/scripted_process_empty_memory_region/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
diff --git 
a/lldb/test/API/functionalities/scripted_process_empty_memory_region/TestScriptedProcessEmptyMemoryRegion.py
 
b/lldb/test/API/functionalities/scripted_process_empty_memory_region/TestScriptedProcessEmptyMemoryRegion.py
new file mode 100644
index 00..1ff084cfb0278e
--- /dev/null
+++ 
b/lldb/test/API/functionalities/scripted_process_empty_memory_region/TestScriptedProcessEmptyMemoryRegion.py
@@ -0,0 +1,33 @@
+"""
+Test python scripted process which returns an empty SBMemoryRegionInfo
+"""
+
+import os, shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test import lldbtest
+
+
+class ScriptedProcessEmptyMemoryRegion(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_scripted_process_empty_memory_region(self):
+"""Test that lldb handles an empty SBMemoryRegionInfo object from
+a scripted process plugin."""
+self.build()
+
+target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+self.assertTrue(target, VALID_TARGET)
+
+scripted_process_example_relpath = "dummy_scripted_process.py"
+self.runCmd(
+"command script import "
++ os.path.join(self.getSourceDir(), 
scripted_process_example_relpath)
+)
+
+self.expect("memory region 0", error=True, substrs=["Invalid memory 
region"])
+
+self.expect("expr -- 5", substrs=["5"])
diff --git 
a/lldb/test/API/f

[Lldb-commits] [lldb] [lldb][test] Add test categories for Linux and Darwin tests (PR #116194)

2024-11-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Vladislav Dzhidzhoev (dzhidzhoev)


Changes

Label Linux and Darwin tests with the corresponding categories so that 
buildbots could be set up to skip them.

This is to speed up https://lab.llvm.org/staging/#/builders/195/builds/4739 
later.

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


3 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/test_categories.py (+3) 
- (added) lldb/test/API/linux/categories (+1) 
- (added) lldb/test/API/macosx/categories (+1) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/test_categories.py 
b/lldb/packages/Python/lldbsuite/test/test_categories.py
index 036bda9c957d11..537a7aa4025d5c 100644
--- a/lldb/packages/Python/lldbsuite/test/test_categories.py
+++ b/lldb/packages/Python/lldbsuite/test/test_categories.py
@@ -17,6 +17,7 @@
 all_categories = {
 "basic_process": "Basic process execution sniff tests.",
 "cmdline": "Tests related to the LLDB command-line interface",
+"darwin": "Darwin-related tests",
 "dataformatters": "Tests related to the type command and the data 
formatters subsystem",
 "debugserver": "Debugserver tests",
 "dsym": "Tests that can be run with DSYM debug information",
@@ -30,6 +31,7 @@
 "instrumentation-runtime": "Tests for the instrumentation runtime plugins",
 "libc++": "Test for libc++ data formatters",
 "libstdcxx": "Test for libstdcxx data formatters",
+"linux": "Linux-related tests",
 "lldb-server": "Tests related to lldb-server",
 "lldb-dap": "Tests for the Debug Adaptor Protocol with lldb-dap",
 "llgs": "Tests for the gdb-server functionality of lldb-server",
@@ -39,6 +41,7 @@
 "std-module": "Tests related to importing the std module",
 "stresstest": "Tests related to stressing lldb limits",
 "watchpoint": "Watchpoint-related tests",
+"windows": "Windows-related tests",
 }
 
 
diff --git a/lldb/test/API/linux/categories b/lldb/test/API/linux/categories
new file mode 100644
index 00..a08e1f35eb7c51
--- /dev/null
+++ b/lldb/test/API/linux/categories
@@ -0,0 +1 @@
+linux
diff --git a/lldb/test/API/macosx/categories b/lldb/test/API/macosx/categories
new file mode 100644
index 00..1498f270fc2b31
--- /dev/null
+++ b/lldb/test/API/macosx/categories
@@ -0,0 +1 @@
+darwin

``




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


[Lldb-commits] [lldb] [lldb][test] Add test categories for Linux and Darwin tests (PR #116194)

2024-11-14 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev created 
https://github.com/llvm/llvm-project/pull/116194

Label Linux and Darwin tests with the corresponding categories so that 
buildbots could be set up to skip them.

This is to speed up https://lab.llvm.org/staging/#/builders/195/builds/4739 
later.

>From 34047d525f1caeda6817142ec0d53ec8129a6adb Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev 
Date: Thu, 14 Nov 2024 10:21:36 +0100
Subject: [PATCH] [lldb][test] Add test categories for Linux and Darwin tests

Label Linux and Darwin tests with the corresponding categories so that
buildbots could be set up to skip them.

This is to speed up https://lab.llvm.org/staging/#/builders/195/builds/4739 
later.
---
 lldb/packages/Python/lldbsuite/test/test_categories.py | 3 +++
 lldb/test/API/linux/categories | 1 +
 lldb/test/API/macosx/categories| 1 +
 3 files changed, 5 insertions(+)
 create mode 100644 lldb/test/API/linux/categories
 create mode 100644 lldb/test/API/macosx/categories

diff --git a/lldb/packages/Python/lldbsuite/test/test_categories.py 
b/lldb/packages/Python/lldbsuite/test/test_categories.py
index 036bda9c957d11..537a7aa4025d5c 100644
--- a/lldb/packages/Python/lldbsuite/test/test_categories.py
+++ b/lldb/packages/Python/lldbsuite/test/test_categories.py
@@ -17,6 +17,7 @@
 all_categories = {
 "basic_process": "Basic process execution sniff tests.",
 "cmdline": "Tests related to the LLDB command-line interface",
+"darwin": "Darwin-related tests",
 "dataformatters": "Tests related to the type command and the data 
formatters subsystem",
 "debugserver": "Debugserver tests",
 "dsym": "Tests that can be run with DSYM debug information",
@@ -30,6 +31,7 @@
 "instrumentation-runtime": "Tests for the instrumentation runtime plugins",
 "libc++": "Test for libc++ data formatters",
 "libstdcxx": "Test for libstdcxx data formatters",
+"linux": "Linux-related tests",
 "lldb-server": "Tests related to lldb-server",
 "lldb-dap": "Tests for the Debug Adaptor Protocol with lldb-dap",
 "llgs": "Tests for the gdb-server functionality of lldb-server",
@@ -39,6 +41,7 @@
 "std-module": "Tests related to importing the std module",
 "stresstest": "Tests related to stressing lldb limits",
 "watchpoint": "Watchpoint-related tests",
+"windows": "Windows-related tests",
 }
 
 
diff --git a/lldb/test/API/linux/categories b/lldb/test/API/linux/categories
new file mode 100644
index 00..a08e1f35eb7c51
--- /dev/null
+++ b/lldb/test/API/linux/categories
@@ -0,0 +1 @@
+linux
diff --git a/lldb/test/API/macosx/categories b/lldb/test/API/macosx/categories
new file mode 100644
index 00..1498f270fc2b31
--- /dev/null
+++ b/lldb/test/API/macosx/categories
@@ -0,0 +1 @@
+darwin

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


[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)

2024-11-14 Thread Robert O'Callahan via lldb-commits

rocallahan wrote:

Ok, tell me what you think of this proposal:

1) Each thread plan has a virtual `GetDirection()` method returning 
`RunDirection`. Existing plans other than `ThreadBasePlan` return `eRunForward`.
2) There is a per-process `base direction` flag. 
`ThreadBasePlan::GetDirection()` returns the value of that flag. Defaults to 
`eRunForward`.
3) There is a new `SBProcess::ContinueInDirection(direction)` method. This 
method updates the "process base direction" flag. For simplicity, for now, _if 
the base direction changed_, pop all plans on all threads.
4) `SBProcess::Continue()` is unchanged, i.e. preserves the base direction.
5) When we resume execution:
5a) If we choose to resume a single runnable thread whose current plan has 
`StopOthers()` , just resume using that plan's direction.
5b) Otherwise use the process base direction, and before resuming, pop plans 
until all threads' current plans match that direction.

I think this is fairly simple while behaving much like what you suggest. It 
doesn't require introducing a new kind of `ThreadPlan` which is good. I think 
it can extend cleanly to support reverse-step etc.

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


[Lldb-commits] [lldb] [lldb][test] Disable inline_sites_live.cpp for non-Windows targets (PR #116196)

2024-11-14 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev created 
https://github.com/llvm/llvm-project/pull/116196

This is a follow-up for the conversation here
https://github.com/llvm/llvm-project/pull/115722/.

This test is designed for Windows target/PDB format, so it shouldn't be built 
and run for DWARF/etc.

>From 31d2ce786f8017b74906be3d3f154f0e00c57cb1 Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev 
Date: Thu, 14 Nov 2024 11:05:59 +0100
Subject: [PATCH] [lldb][test] Disable inline_sites_live.cpp for non-Windows
 targets

This is a follow-up for the conversation here
https://github.com/llvm/llvm-project/pull/115722/.

This test is designed for Windows target/PDB format, so it shouldn't be
built and run for DWARF/etc.
---
 lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
index 549bc881b19bb7..906f3d7dff0a56 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
@@ -1,5 +1,5 @@
 // clang-format off
-// REQUIRES: system-windows
+// REQUIRES: target-windows
 
 // RUN: %build -o %t.exe -- %s
 // RUN: %lldb -f %t.exe -s \

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


[Lldb-commits] [lldb] [lldb][test] Disable inline_sites_live.cpp for non-Windows targets (PR #116196)

2024-11-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Vladislav Dzhidzhoev (dzhidzhoev)


Changes

This is a follow-up for the conversation here
https://github.com/llvm/llvm-project/pull/115722/.

This test is designed for Windows target/PDB format, so it shouldn't be built 
and run for DWARF/etc.

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


1 Files Affected:

- (modified) lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp (+1-1) 


``diff
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
index 549bc881b19bb7..906f3d7dff0a56 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
@@ -1,5 +1,5 @@
 // clang-format off
-// REQUIRES: system-windows
+// REQUIRES: target-windows
 
 // RUN: %build -o %t.exe -- %s
 // RUN: %lldb -f %t.exe -s \

``




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


[Lldb-commits] [lldb] [lldb] Fixed find-module.test in case of a remote target (PR #116198)

2024-11-14 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/116198

Changing from UNSUPPOERTED to XFAIL in #94165 break x86 linux host / Aarch64 
linux target build https://lab.llvm.org/buildbot/#/builders/195/builds/1047

>From 29813707f239eaab7f6320f0355db151c48c9093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 14 Nov 2024 14:13:29 +0400
Subject: [PATCH] [lldb] Fixed find-module.test in case of a remote target

Changing from UNSUPPOERTED to XFAIL in #94165 break x86 linux host / Aarch64 
linux target build
https://lab.llvm.org/buildbot/#/builders/195/builds/1047
---
 lldb/test/Shell/Minidump/Windows/find-module.test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/Shell/Minidump/Windows/find-module.test 
b/lldb/test/Shell/Minidump/Windows/find-module.test
index fe457f4123522f..39d9dab4d346d6 100644
--- a/lldb/test/Shell/Minidump/Windows/find-module.test
+++ b/lldb/test/Shell/Minidump/Windows/find-module.test
@@ -1,7 +1,7 @@
 Test that we correctly find a PE/COFF file in our executable search path, and
 use it when opening minidumps.
 
-XFAIL: remote{{.*}}
+XFAIL: system-windows && remote-linux
 
 RUN: yaml2obj %S/Inputs/find-module.exe.yaml -o %T/find-module.exe
 RUN: yaml2obj %S/Inputs/find-module.dmp.yaml -o %T/find-module.dmp

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


[Lldb-commits] [lldb] [lldb] Fixed find-module.test in case of a remote target (PR #116198)

2024-11-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)


Changes

Changing from UNSUPPOERTED to XFAIL in #94165 break x86 linux host / 
Aarch64 linux target build 
https://lab.llvm.org/buildbot/#/builders/195/builds/1047

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


1 Files Affected:

- (modified) lldb/test/Shell/Minidump/Windows/find-module.test (+1-1) 


``diff
diff --git a/lldb/test/Shell/Minidump/Windows/find-module.test 
b/lldb/test/Shell/Minidump/Windows/find-module.test
index fe457f4123522f..39d9dab4d346d6 100644
--- a/lldb/test/Shell/Minidump/Windows/find-module.test
+++ b/lldb/test/Shell/Minidump/Windows/find-module.test
@@ -1,7 +1,7 @@
 Test that we correctly find a PE/COFF file in our executable search path, and
 use it when opening minidumps.
 
-XFAIL: remote{{.*}}
+XFAIL: system-windows && remote-linux
 
 RUN: yaml2obj %S/Inputs/find-module.exe.yaml -o %T/find-module.exe
 RUN: yaml2obj %S/Inputs/find-module.dmp.yaml -o %T/find-module.dmp

``




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


[Lldb-commits] [lldb] [lldb][test] Add test categories for Linux and Darwin tests (PR #116194)

2024-11-14 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][test] Add test categories for Linux and Darwin tests (PR #116194)

2024-11-14 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett commented:

I'm a bit skeptical about saying "X related tests" given that it will include 
things like core files that can be run anywhere, but we also can't say "tests 
that run on X" because we'd have to label everything individually.

How are you going to use these categories exactly? Is this level of detail 
enough for your use case?

I don't think that, for example, you not running the AArch64 Linux core file 
tests is actually a problem, we have plenty of coverage for that elsewhere.

I just want to make sure the categories are fit for purpose.

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


[Lldb-commits] [lldb] [lldb][test] Add test categories for Linux and Darwin tests (PR #116194)

2024-11-14 Thread David Spickett via lldb-commits


@@ -39,6 +41,7 @@
 "std-module": "Tests related to importing the std module",
 "stresstest": "Tests related to stressing lldb limits",
 "watchpoint": "Watchpoint-related tests",
+"windows": "Windows-related tests",

DavidSpickett wrote:

What's going to set this one?

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


[Lldb-commits] [lldb] [lldb] Fixed find-module.test in case of a remote target (PR #116198)

2024-11-14 Thread David Spickett via lldb-commits

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

So it was unsupported so it never ran on that bot. Then it was changed to xfail 
for remote, so it passed on one bot but was broken on another.

This change narrows the xfail to the one configuration that fails.

In that case, LGTM.

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] fix: Target Process may crash or freezes on detaching process on windows (PR #115712)

2024-11-14 Thread Pavel Labath via lldb-commits

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

Okay, I think I'm satisfied by the explanation. Thanks for your patience. Do 
you need me to push the "merge" button?

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


[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

2024-11-14 Thread Pavel Labath via lldb-commits


@@ -288,8 +288,15 @@ Status ScriptedProcess::DoGetMemoryRegionInfo(lldb::addr_t 
load_addr,
   MemoryRegionInfo ®ion) {
   Status error;
   if (auto region_or_err =
-  GetInterface().GetMemoryRegionContainingAddress(load_addr, error))
+  GetInterface().GetMemoryRegionContainingAddress(load_addr, error)) {
 region = *region_or_err;
+if (region.GetRange().GetRangeBase() == 0 &&
+(region.GetRange().GetByteSize() == 0 ||
+ region.GetRange().GetByteSize() == LLDB_INVALID_ADDRESS)) {

labath wrote:

> We had a gdb stub returning {0, UINT64_MAX} the other week and it broke 
> IRMemory::FindSpace() which will avoid any memory region with 
> read/write/execute flags if qMemoryRegionInfo packets are supported. The stub 
> claimed the entire address space, FindSpace() said it could not find any 
> address range available, and all expressions broke.

Okay, but what's the alternative? Picking a piece of memory that may overlap 
with some existing data? It sounds to me like the stub gets exactly what it 
asked for.

> Yeah, a range of {0, 1} would result in algorithms like FindSpace() looping 
> for a very long time, and be nearly as bad. But so far the two instances I've 
> seen of people return bad ranges are {0,0} and {0,UINT64_MAX}.

True, but if we can change the expression to catch both, why not do it? What 
I'm suggesting is to change the expression into something like `if 
(GetRange().GetRangeBase() > addr || GetRange().GetRangeEnd() <= addr)`. The 
`(0,0) case is subsumed by that, but this also catches any other incorrect 
response.

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


[Lldb-commits] [lldb] [lldb][test] Add test categories for Linux and Darwin tests (PR #116194)

2024-11-14 Thread Pavel Labath via lldb-commits

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

I think I'm fine with this. I'd probably skip the windows category for now, 
since we're also not adding categories any of the bsd variants.

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


[Lldb-commits] [lldb] [lldb] Add timed callbacks to the MainLoop class (PR #112895)

2024-11-14 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

> I'm not sure what one needs to do that

You need to be a member of the LLVM organization (i.e. have commit access). 
This has tripped me up a few times as well. 

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


[Lldb-commits] [clang] [lldb] [lldb] Analyze enum promotion type during parsing (PR #115005)

2024-11-14 Thread Ilia Kuklin via lldb-commits

kuilpd wrote:

Ping

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


[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

2024-11-14 Thread Pavel Labath via lldb-commits

labath wrote:

Any brave souls? :)

 @rocallahan, I can't add you as a reviewer (I'm not sure what one needs to do 
that), but I would totally go with your LGTM :)

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


[Lldb-commits] [lldb] [lldb][test] Add test categories for Linux and Darwin tests (PR #116194)

2024-11-14 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Is the real, underlying problem that `skipUnlessDarwin` is checking the host 
platform instead of the target platform? I'm somewhat worried about adding a 
category that (at first glance) competes with the existing decorators and the 
associated risk of folks misunderstanding/misusing them. 

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


[Lldb-commits] [lldb] [lldb] Add Function::GetAddress and redirect some uses (PR #115836)

2024-11-14 Thread Pavel Labath via lldb-commits


@@ -407,6 +406,15 @@ CompileUnit *Function::GetCompileUnit() { return 
m_comp_unit; }
 
 const CompileUnit *Function::GetCompileUnit() const { return m_comp_unit; }
 
+Address Function::GetAddress() const {
+  if (m_ranges.empty())
+return Address();
+  // We're using a (DWARF-like) convention where the base address of the first
+  // interval denotes the entry point of the function. If that turns out to be
+  // insufficient, we can introduce a separate "entry point address" field.
+  return m_ranges[0].GetBaseAddress();

labath wrote:

Also having written this, I realized that this patch does make a functional 
change (for the better) -- lldb will now correctly return the entry point of 
the function in case its entry point is not its lowest address. I'm going to 
add a test case for that.

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


[Lldb-commits] [lldb] [lldb] Add Function::GetAddress and redirect some uses (PR #115836)

2024-11-14 Thread Pavel Labath via lldb-commits


@@ -407,6 +406,15 @@ CompileUnit *Function::GetCompileUnit() { return 
m_comp_unit; }
 
 const CompileUnit *Function::GetCompileUnit() const { return m_comp_unit; }
 
+Address Function::GetAddress() const {
+  if (m_ranges.empty())
+return Address();
+  // We're using a (DWARF-like) convention where the base address of the first
+  // interval denotes the entry point of the function. If that turns out to be
+  // insufficient, we can introduce a separate "entry point address" field.
+  return m_ranges[0].GetBaseAddress();

labath wrote:

And that discovers another problem -- we sort the ranges long before they make 
their way here. I'll need to rethink this patch (the result will probably 
involve adding an explicit "entry point" member).

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


[Lldb-commits] [lldb] [lldb] Add Function::GetAddress and redirect some uses (PR #115836)

2024-11-14 Thread Pavel Labath via lldb-commits

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


  1   2   >