Skip to content

Commit c615e46

Browse files
committed
[lldb] Hoist TraceOn check out of loop (NFC)
1 parent 87990fd commit c615e46

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

lldb/test/API/lang/cpp/class_types/TestClassTypesDisassembly.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,17 @@ def test_and_python_api(self):
4848
thread = lldbutil.get_stopped_thread(
4949
process, lldb.eStopReasonBreakpoint)
5050
self.assertIsNotNone(thread)
51-
depth = thread.GetNumFrames()
52-
for i in range(depth - 1):
53-
frame = thread.GetFrameAtIndex(i)
54-
function = frame.GetFunction()
55-
# Print the function header.
56-
if self.TraceOn():
57-
print()
58-
print(function)
59-
if function:
60-
# Get all instructions for this function and print them out.
61-
insts = function.GetInstructions(target)
62-
for inst in insts:
63-
# We could simply do 'print inst' to print out the disassembly.
64-
# But we want to print to stdout only if self.TraceOn() is
65-
# True.
66-
disasm = str(inst)
67-
if self.TraceOn():
68-
print(disasm)
51+
if self.TraceOn():
52+
for frame in thread.frames:
53+
function = frame.GetFunction()
54+
if function:
55+
# Print the function header.
56+
print()
57+
print(function)
58+
# Get all instructions for this function and print them out.
59+
insts = function.GetInstructions(target)
60+
for inst in insts:
61+
print(inst)
6962

7063
def setUp(self):
7164
# Call super's setUp().

0 commit comments

Comments
 (0)