Skip to content

Commit ea2e622

Browse files
committed
Fix a bug where using "thread backtrace unique" would switch you to
always using the "frame-format-unique" even when you weren't doing the unique backtrace mode.
1 parent 569b6f6 commit ea2e622

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-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: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,26 @@ 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("frame-format-unique", setting_str, self.dbg.GetInstanceName())
135143
# Now that we are stopped, we should have 10 threads waiting in the
136144
# thread3 function. All of these threads should show as one stack.
137145
self.expect(
138146
"thread backtrace unique",
139147
"Backtrace with unique stack shown correctly",
140-
substrs=[expect_string, "main.cpp:%d" % self.thread3_before_lock_line],
148+
substrs=[expect_string, "UNIQUE:", "main.cpp:%d" % self.thread3_before_lock_line],
149+
)
150+
# Make sure setting the unique flag in the command isn't
151+
# persistent:
152+
self.expect(
153+
"thread backtrace",
154+
"Backtrace unique is not sticky",
155+
substrs=["UNIQUE:"],
156+
matching=False
141157
)

0 commit comments

Comments
 (0)