summaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2023-05-25 08:48:57 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2023-05-25 12:54:09 -0700
commit2238dcc39358353cac21df75c3c3286ab20b8f53 (patch)
tree1bb7ec8d7405ccd7fdb5a8a78d0cf5ef40bcc963 /lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
parentdaeee56798c51e8f007e8e8e6e677a420b14c9ef (diff)
[NFC][Py Reformat] Reformat python files in lldb
This is an ongoing series of commits that are reformatting our Python code. Reformatting is done with `black` (23.1.0). If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run `git checkout --ours <yourfile>` and then reformat it with black. RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Differential revision: https://reviews.llvm.org/D151460
Diffstat (limited to 'lldb/test/API/python_api/function_symbol/TestSymbolAPI.py')
-rw-r--r--lldb/test/API/python_api/function_symbol/TestSymbolAPI.py54
1 files changed, 29 insertions, 25 deletions
diff --git a/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py b/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
index 2517f9b8e296..fb6073bbd26e 100644
--- a/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
+++ b/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
@@ -9,15 +9,16 @@ from lldbsuite.test import lldbutil
class SymbolAPITestCase(TestBase):
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
self.line1 = line_number(
- 'main.c', '// Find the line number for breakpoint 1 here.')
+ "main.c", "// Find the line number for breakpoint 1 here."
+ )
self.line2 = line_number(
- 'main.c', '// Find the line number for breakpoint 2 here.')
+ "main.c", "// Find the line number for breakpoint 2 here."
+ )
def test(self):
"""Exercise some SBSymbol and SBAddress APIs."""
@@ -29,57 +30,60 @@ class SymbolAPITestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Now create the two breakpoints inside function 'a'.
- breakpoint1 = target.BreakpointCreateByLocation('main.c', self.line1)
- breakpoint2 = target.BreakpointCreateByLocation('main.c', self.line2)
+ breakpoint1 = target.BreakpointCreateByLocation("main.c", self.line1)
+ breakpoint2 = target.BreakpointCreateByLocation("main.c", self.line2)
self.trace("breakpoint1:", breakpoint1)
self.trace("breakpoint2:", breakpoint2)
- self.assertTrue(breakpoint1 and
- breakpoint1.GetNumLocations() == 1,
- VALID_BREAKPOINT)
- self.assertTrue(breakpoint2 and
- breakpoint2.GetNumLocations() == 1,
- VALID_BREAKPOINT)
+ self.assertTrue(
+ breakpoint1 and breakpoint1.GetNumLocations() == 1, VALID_BREAKPOINT
+ )
+ self.assertTrue(
+ breakpoint2 and breakpoint2.GetNumLocations() == 1, VALID_BREAKPOINT
+ )
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple(
- None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1.
self.assertState(process.GetState(), lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(
- process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(
thread.IsValid(),
- "There should be a thread stopped due to breakpoint condition")
+ "There should be a thread stopped due to breakpoint condition",
+ )
frame0 = thread.GetFrameAtIndex(0)
symbol_line1 = frame0.GetSymbol()
# We should have a symbol type of code.
self.assertEqual(symbol_line1.GetType(), lldb.eSymbolTypeCode)
addr_line1 = symbol_line1.GetStartAddress()
# And a section type of code, too.
- self.assertEqual(addr_line1.GetSection().GetSectionType(),
- lldb.eSectionTypeCode)
+ self.assertEqual(
+ addr_line1.GetSection().GetSectionType(), lldb.eSectionTypeCode
+ )
# Continue the inferior, the breakpoint 2 should be hit.
process.Continue()
self.assertState(process.GetState(), lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(
- process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(
thread.IsValid(),
- "There should be a thread stopped due to breakpoint condition")
+ "There should be a thread stopped due to breakpoint condition",
+ )
frame0 = thread.GetFrameAtIndex(0)
symbol_line2 = frame0.GetSymbol()
# We should have a symbol type of code.
self.assertEqual(symbol_line2.GetType(), lldb.eSymbolTypeCode)
addr_line2 = symbol_line2.GetStartAddress()
# And a section type of code, too.
- self.assertEqual(addr_line2.GetSection().GetSectionType(),
- lldb.eSectionTypeCode)
+ self.assertEqual(
+ addr_line2.GetSection().GetSectionType(), lldb.eSectionTypeCode
+ )
# Now verify that both addresses point to the same module.
if self.TraceOn():
print("UUID:", addr_line1.GetModule().GetUUIDString())
- self.assertEqual(addr_line1.GetModule().GetUUIDString(),
- addr_line2.GetModule().GetUUIDString())
+ self.assertEqual(
+ addr_line1.GetModule().GetUUIDString(),
+ addr_line2.GetModule().GetUUIDString(),
+ )