aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Lee <davelee.com@gmail.com>2022-05-24 17:22:12 -0700
committerDave Lee <davelee.com@gmail.com>2022-08-07 12:19:47 -0600
commitc615e467dbaf5240e4f48f3536d4857ff58c7531 (patch)
treeb5d85db453feee12cbcef5a90acf4f0cbca36b5e
parent87990fd8f4ba0e87ae21c69ae0cff4921c0e2cdf (diff)
[lldb] Hoist TraceOn check out of loop (NFC)
-rw-r--r--lldb/test/API/lang/cpp/class_types/TestClassTypesDisassembly.py29
1 files changed, 11 insertions, 18 deletions
diff --git a/lldb/test/API/lang/cpp/class_types/TestClassTypesDisassembly.py b/lldb/test/API/lang/cpp/class_types/TestClassTypesDisassembly.py
index 82a529494a68..7adc82f1a639 100644
--- a/lldb/test/API/lang/cpp/class_types/TestClassTypesDisassembly.py
+++ b/lldb/test/API/lang/cpp/class_types/TestClassTypesDisassembly.py
@@ -48,24 +48,17 @@ class IterateFrameAndDisassembleTestCase(TestBase):
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
- depth = thread.GetNumFrames()
- for i in range(depth - 1):
- frame = thread.GetFrameAtIndex(i)
- function = frame.GetFunction()
- # Print the function header.
- if self.TraceOn():
- print()
- print(function)
- if function:
- # Get all instructions for this function and print them out.
- insts = function.GetInstructions(target)
- for inst in insts:
- # We could simply do 'print inst' to print out the disassembly.
- # But we want to print to stdout only if self.TraceOn() is
- # True.
- disasm = str(inst)
- if self.TraceOn():
- print(disasm)
+ if self.TraceOn():
+ for frame in thread.frames:
+ function = frame.GetFunction()
+ if function:
+ # Print the function header.
+ print()
+ print(function)
+ # Get all instructions for this function and print them out.
+ insts = function.GetInstructions(target)
+ for inst in insts:
+ print(inst)
def setUp(self):
# Call super's setUp().