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

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 14 09:21:45 PST 2024


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 <davelee.com at gmail.com>
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,



More information about the lldb-commits mailing list