-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Fix a bug where using "thread backtrace unique" would switch you to #140993
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
Open
jimingham
wants to merge
1
commit into
llvm:main
Choose a base branch
from
jimingham:frame-format-unique
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
always using the "frame-format-unique" even when you weren't doing the unique backtrace mode.
@llvm/pr-subscribers-lldb Author: None (jimingham) Changesalways using the "frame-format-unique" even when you weren't doing the unique backtrace mode. Full diff: https://github.com/llvm/llvm-project/pull/140993.diff 2 Files Affected:
diff --git a/lldb/source/Commands/CommandObjectThreadUtil.cpp b/lldb/source/Commands/CommandObjectThreadUtil.cpp
index cdc5946547f47..a451de137d702 100644
--- a/lldb/source/Commands/CommandObjectThreadUtil.cpp
+++ b/lldb/source/Commands/CommandObjectThreadUtil.cpp
@@ -37,6 +37,8 @@ void CommandObjectIterateOverThreads::DoExecute(Args &command,
result.SetStatus(m_success_return);
bool all_threads = false;
+ m_unique_stacks = false;
+
if (command.GetArgumentCount() == 0) {
Thread *thread = m_exe_ctx.GetThreadPtr();
if (thread)
diff --git a/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py b/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
index ee9b14f15b6e9..40bc2a175c2f9 100644
--- a/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
+++ b/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
@@ -132,10 +132,26 @@ def is_thread3(thread):
# Construct our expected back trace string
expect_string = "10 thread(s)%s" % (expect_threads)
+ # There was a bug where if you used 'thread backtrace unique'
+ # we would switch all future backtraces to use the
+ # "frame-format-unique" not the "frame-format". Make
+ # sure we don't do that...
+ setting_data = self.dbg.GetSetting("frame-format-unique")
+ setting_str = setting_data.GetStringValue(1000)
+ setting_str = "UNIQUE: " + setting_str
+ lldb.SBDebugger.SetInternalVariable("frame-format-unique", setting_str, self.dbg.GetInstanceName())
# Now that we are stopped, we should have 10 threads waiting in the
# thread3 function. All of these threads should show as one stack.
self.expect(
"thread backtrace unique",
"Backtrace with unique stack shown correctly",
- substrs=[expect_string, "main.cpp:%d" % self.thread3_before_lock_line],
+ substrs=[expect_string, "UNIQUE:", "main.cpp:%d" % self.thread3_before_lock_line],
+ )
+ # Make sure setting the unique flag in the command isn't
+ # persistent:
+ self.expect(
+ "thread backtrace",
+ "Backtrace unique is not sticky",
+ substrs=["UNIQUE:"],
+ matching=False
)
|
You can test this locally with the following command:darker --check --diff -r HEAD~1...HEAD lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py View the diff from darker here.--- TestNumThreads.py 2025-05-22 02:44:29.000000 +0000
+++ TestNumThreads.py 2025-05-22 02:47:37.902846 +0000
@@ -137,21 +137,27 @@
# "frame-format-unique" not the "frame-format". Make
# sure we don't do that...
setting_data = self.dbg.GetSetting("frame-format-unique")
setting_str = setting_data.GetStringValue(1000)
setting_str = "UNIQUE: " + setting_str
- lldb.SBDebugger.SetInternalVariable("frame-format-unique", setting_str, self.dbg.GetInstanceName())
+ lldb.SBDebugger.SetInternalVariable(
+ "frame-format-unique", setting_str, self.dbg.GetInstanceName()
+ )
# Now that we are stopped, we should have 10 threads waiting in the
# thread3 function. All of these threads should show as one stack.
self.expect(
"thread backtrace unique",
"Backtrace with unique stack shown correctly",
- substrs=[expect_string, "UNIQUE:", "main.cpp:%d" % self.thread3_before_lock_line],
+ substrs=[
+ expect_string,
+ "UNIQUE:",
+ "main.cpp:%d" % self.thread3_before_lock_line,
+ ],
)
# Make sure setting the unique flag in the command isn't
# persistent:
self.expect(
"thread backtrace",
"Backtrace unique is not sticky",
substrs=["UNIQUE:"],
- matching=False
+ matching=False,
)
|
labath
approved these changes
May 22, 2025
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.
always using the "frame-format-unique" even when you weren't doing the unique backtrace mode.