summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadbcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py90
1 files changed, 60 insertions, 30 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
index 588aa66cf53..a1272cbcbce 100644
--- a/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
+++ b/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
@@ -5,14 +5,15 @@ Test SBThread APIs.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
from lldbsuite.test.lldbutil import get_stopped_thread, get_caller_symbol
+
class ThreadAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -62,12 +63,17 @@ class ThreadAPITestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number within main.cpp to break inside main().
- self.break_line = line_number("main.cpp", "// Set break point at this line and check variable 'my_char'.")
- # Find the line numbers within main2.cpp for step_out_of_malloc_into_function_b() and step_over_3_times().
- self.step_out_of_malloc = line_number("main2.cpp", "// thread step-out of malloc into function b.")
- self.after_3_step_overs = line_number("main2.cpp", "// we should reach here after 3 step-over's.")
-
- # We'll use the test method name as the exe_name for executable comppiled from main2.cpp.
+ self.break_line = line_number(
+ "main.cpp", "// Set break point at this line and check variable 'my_char'.")
+ # Find the line numbers within main2.cpp for
+ # step_out_of_malloc_into_function_b() and step_over_3_times().
+ self.step_out_of_malloc = line_number(
+ "main2.cpp", "// thread step-out of malloc into function b.")
+ self.after_3_step_overs = line_number(
+ "main2.cpp", "// we should reach here after 3 step-over's.")
+
+ # We'll use the test method name as the exe_name for executable
+ # comppiled from main2.cpp.
self.exe_name = self.testMethodName
def get_process(self):
@@ -77,20 +83,25 @@ class ThreadAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.break_line)
+ breakpoint = target.BreakpointCreateByLocation(
+ "main.cpp", self.break_line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
self.runCmd("process status")
proc_of_thread = thread.GetProcess()
#print("proc_of_thread:", proc_of_thread)
- self.assertTrue(proc_of_thread.GetProcessID() == process.GetProcessID())
+ self.assertTrue(proc_of_thread.GetProcessID()
+ == process.GetProcessID())
def get_stop_description(self):
"""Test Python SBThread.GetStopDescription() API."""
@@ -99,15 +110,19 @@ class ThreadAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.break_line)
+ breakpoint = target.BreakpointCreateByLocation(
+ "main.cpp", self.break_line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
#self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
#self.runCmd("process status")
# Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription
@@ -115,7 +130,7 @@ class ThreadAPITestCase(TestBase):
# The 100 is just an arbitrary number specifying the buffer size.
stop_description = thread.GetStopDescription(100)
self.expect(stop_description, exe=False,
- startstr = 'breakpoint')
+ startstr='breakpoint')
def step_out_of_malloc_into_function_b(self, exe_name):
"""Test Python SBThread.StepOut() API to step out of a malloc call where the call site is at function b()."""
@@ -128,21 +143,26 @@ class ThreadAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
while True:
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
caller_symbol = get_caller_symbol(thread)
if not caller_symbol:
- self.fail("Test failed: could not locate the caller symbol of malloc")
+ self.fail(
+ "Test failed: could not locate the caller symbol of malloc")
# Our top frame may be an inlined function in malloc() (e.g., on
# FreeBSD). Apply a simple heuristic of stepping out until we find
# a non-malloc caller
while caller_symbol.startswith("malloc"):
thread.StepOut()
- self.assertTrue(thread.IsValid(), "Thread valid after stepping to outer malloc")
+ self.assertTrue(thread.IsValid(),
+ "Thread valid after stepping to outer malloc")
caller_symbol = get_caller_symbol(thread)
if caller_symbol == "b(int)":
@@ -155,8 +175,9 @@ class ThreadAPITestCase(TestBase):
thread.StepOut()
self.runCmd("thread backtrace")
- self.assertTrue(thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == self.step_out_of_malloc,
- "step out of malloc into function b is successful")
+ self.assertTrue(
+ thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == self.step_out_of_malloc,
+ "step out of malloc into function b is successful")
def step_over_3_times(self, exe_name):
"""Test Python SBThread.StepOver() API."""
@@ -165,19 +186,23 @@ class ThreadAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation('main2.cpp', self.step_out_of_malloc)
+ breakpoint = target.BreakpointCreateByLocation(
+ 'main2.cpp', self.step_out_of_malloc)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the 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.step_out_of_malloc.
self.assertTrue(process.GetState() == lldb.eStateStopped)
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
self.runCmd("thread backtrace")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
@@ -188,7 +213,8 @@ class ThreadAPITestCase(TestBase):
thread.StepOver()
self.runCmd("thread backtrace")
- # Verify that we are stopped at the correct source line number in main2.cpp.
+ # Verify that we are stopped at the correct source line number in
+ # main2.cpp.
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
@@ -206,19 +232,23 @@ class ThreadAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation('main2.cpp', self.step_out_of_malloc)
+ breakpoint = target.BreakpointCreateByLocation(
+ 'main2.cpp', self.step_out_of_malloc)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the 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.step_out_of_malloc.
self.assertTrue(process.GetState() == lldb.eStateStopped)
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
self.runCmd("thread backtrace")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
@@ -234,7 +264,7 @@ class ThreadAPITestCase(TestBase):
# Disable the breakpoint.
self.assertTrue(target.DisableAllBreakpoints())
self.runCmd("breakpoint list")
-
+
thread.StepOver()
thread.StepOver()
thread.StepOver()
OpenPOWER on IntegriCloud