-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Support any flag to _regexp-bt #116260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kastiglione
merged 3 commits into
llvm:main
from
kastiglione:lldb-Support-any-flag-to-_regexp-bt
Nov 14, 2024
Merged
[lldb] Support any flag to _regexp-bt #116260
kastiglione
merged 3 commits into
llvm:main
from
kastiglione:lldb-Support-any-flag-to-_regexp-bt
Nov 14, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In particular, this allows `bt -u`.
@llvm/pr-subscribers-lldb Author: Dave Lee (kastiglione) ChangesIn particular, this allows Full diff: https://github.com/llvm/llvm-project/pull/116260.diff 2 Files Affected:
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,
|
You can test this locally with the following command:git-clang-format --diff c9719ad5cd7e0fa65b52333f28aa62c05052d989 b83d07056ecaf53a34c3da81ff3472d2c84cc09a --extensions cpp -- lldb/source/Interpreter/CommandInterpreter.cpp View the diff from clang-format here.diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 764dcfd190..0eb928e1db 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -851,9 +851,12 @@ 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("^(-[^[:space:]].*)$", "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("^(-[^[: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());
m_command_dict[std::string(command_sp->GetCommandName())] = command_sp;
}
|
jimingham
reviewed
Nov 14, 2024
jimingham
approved these changes
Nov 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In particular, this allows
bt -u
.Note that this passthrough behavior has precedent in
_regexp-break
, whereb (-.*)
is expanded tobreakpoint set %1
.