diff options
author | jimingham <jingham@apple.com> | 2025-05-22 10:35:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-22 10:35:35 -0700 |
commit | 8e3f44d68bf2f5318406dac73e86333d7c34976d (patch) | |
tree | a63f5538701dc60480ca347f699053818a86dcec | |
parent | e72d8b25531cb5a4fd1e802bac8c9aa6efee0aa1 (diff) | |
download | llvm-8e3f44d68bf2f5318406dac73e86333d7c34976d.zip llvm-8e3f44d68bf2f5318406dac73e86333d7c34976d.tar.gz llvm-8e3f44d68bf2f5318406dac73e86333d7c34976d.tar.bz2 |
Fix a bug where using "thread backtrace unique" would switch you to (#140993)
always using the "frame-format-unique" even when you weren't doing the
unique backtrace mode.
-rw-r--r-- | lldb/source/Commands/CommandObjectThreadUtil.cpp | 2 | ||||
-rw-r--r-- | lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectThreadUtil.cpp b/lldb/source/Commands/CommandObjectThreadUtil.cpp index cdc5946..a451de1 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 ee9b14f..2f7d64b 100644 --- a/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py +++ b/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py @@ -132,10 +132,32 @@ class NumberOfThreadsTestCase(TestBase): # 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, ) |