Files
clang-p2996/lldb/test/API/tools/lldb-vscode/disassemble/TestVSCode_disassemble.py
Jonas Devlieghere ecbe78c124 [lldb] Fix Python test formatting (NFC)
All Python files in the LLVM repository were reformatted with Black [1].
Files inside the LLDB subproject were reformatted in 2238dcc393. This
patch updates a handful of tests that were added or modified since then
and weren't formatted with Black.

[1] https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style/68257
2023-08-04 14:36:13 -07:00

42 lines
1.3 KiB
Python

"""
Test lldb-vscode disassemble request
"""
import vscode
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import lldbvscode_testcase
import os
class TestVSCode_disassemble(lldbvscode_testcase.VSCodeTestCaseBase):
@skipIfWindows
@skipIfRemote
def test_disassemble(self):
"""
Tests the 'disassemble' request.
"""
program = self.getBuildArtifact("a.out")
self.build_and_launch(program)
source = "main.c"
self.source_path = os.path.join(os.getcwd(), source)
self.set_source_breakpoints(
source,
[
line_number(source, "// breakpoint 1"),
],
)
self.continue_to_next_stop()
pc_assembly = self.disassemble(frameIndex=0)
self.assertTrue("location" in pc_assembly, "Source location missing.")
self.assertTrue("instruction" in pc_assembly, "Assembly instruction missing.")
# The calling frame (qsort) is coming from a system library, as a result
# we should not have a source location.
qsort_assembly = self.disassemble(frameIndex=1)
self.assertFalse("location" in qsort_assembly, "Source location not expected.")
self.assertTrue("instruction" in pc_assembly, "Assembly instruction missing.")