Skip to content

Commit 8e3f44d

Browse files
authored
Fix a bug where using "thread backtrace unique" would switch you to (llvm#140993)
always using the "frame-format-unique" even when you weren't doing the unique backtrace mode.
1 parent e72d8b2 commit 8e3f44d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lldb/source/Commands/CommandObjectThreadUtil.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ void CommandObjectIterateOverThreads::DoExecute(Args &command,
3737
result.SetStatus(m_success_return);
3838

3939
bool all_threads = false;
40+
m_unique_stacks = false;
41+
4042
if (command.GetArgumentCount() == 0) {
4143
Thread *thread = m_exe_ctx.GetThreadPtr();
4244
if (thread)

lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,32 @@ def is_thread3(thread):
132132
# Construct our expected back trace string
133133
expect_string = "10 thread(s)%s" % (expect_threads)
134134

135+
# There was a bug where if you used 'thread backtrace unique'
136+
# we would switch all future backtraces to use the
137+
# "frame-format-unique" not the "frame-format". Make
138+
# sure we don't do that...
139+
setting_data = self.dbg.GetSetting("frame-format-unique")
140+
setting_str = setting_data.GetStringValue(1000)
141+
setting_str = "UNIQUE: " + setting_str
142+
lldb.SBDebugger.SetInternalVariable(
143+
"frame-format-unique", setting_str, self.dbg.GetInstanceName()
144+
)
135145
# Now that we are stopped, we should have 10 threads waiting in the
136146
# thread3 function. All of these threads should show as one stack.
137147
self.expect(
138148
"thread backtrace unique",
139149
"Backtrace with unique stack shown correctly",
140-
substrs=[expect_string, "main.cpp:%d" % self.thread3_before_lock_line],
150+
substrs=[
151+
expect_string,
152+
"UNIQUE:",
153+
"main.cpp:%d" % self.thread3_before_lock_line,
154+
],
155+
)
156+
# Make sure setting the unique flag in the command isn't
157+
# persistent:
158+
self.expect(
159+
"thread backtrace",
160+
"Backtrace unique is not sticky",
161+
substrs=["UNIQUE:"],
162+
matching=False,
141163
)

0 commit comments

Comments
 (0)