summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-04-25 22:04:05 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-04-25 22:04:05 +0000
commitd369908dace1e5e9e2ab66bd500f1ecb6f2d98f9 (patch)
treee2119ba4aa475bde8361e8f99c508d861dc982aa
parentbd0a3fe5e8d25ed888fe1e1a63d8ff51e15f4ae6 (diff)
downloadbcm5719-llvm-d369908dace1e5e9e2ab66bd500f1ecb6f2d98f9.tar.gz
bcm5719-llvm-d369908dace1e5e9e2ab66bd500f1ecb6f2d98f9.zip
Move two functions around.
llvm-svn: 130158
-rw-r--r--lldb/test/lldbutil.py76
1 files changed, 36 insertions, 40 deletions
diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py
index 89c9d8f3bc8..4ca1d8aae5e 100644
--- a/lldb/test/lldbutil.py
+++ b/lldb/test/lldbutil.py
@@ -128,46 +128,6 @@ def bytearray_to_int(bytes, bytesize):
return unpacked[0]
-# ===========================================================
-# Returns the list of stopped thread(s) given an lldb process
-# ===========================================================
-
-def get_stopped_threads(process, reason):
- """Returns the thread(s) with the specified stop reason in a list."""
- threads = []
- for t in lldb_iter(process, 'GetNumThreads', 'GetThreadAtIndex'):
- if t.GetStopReason() == reason:
- threads.append(t)
- return threads
-
-def get_stopped_thread(process, reason):
- """A convenience function which returns the first thread with the given stop
- reason or None.
-
- Example usages:
-
- 1. Get the stopped thread due to a breakpoint condition
-
- ...
- from lldbutil import get_stopped_thread
- thread = get_stopped_thread(self.process, lldb.eStopReasonPlanComplete)
- self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
- ...
-
- 2. Get the thread stopped due to a breakpoint
-
- ...
- from lldbutil import get_stopped_thread
- thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
- ...
-
- """
- threads = get_stopped_threads(process, reason)
- if len(threads) == 0:
- return None
- return threads[0]
-
# ==============================================================
# Get the description of an lldb object or None if not available
# ==============================================================
@@ -277,6 +237,42 @@ def ValueTypeString(enum):
# Utility functions related to Threads and Processes
# ==================================================
+def get_stopped_threads(process, reason):
+ """Returns the thread(s) with the specified stop reason in a list."""
+ threads = []
+ for t in lldb_iter(process, 'GetNumThreads', 'GetThreadAtIndex'):
+ if t.GetStopReason() == reason:
+ threads.append(t)
+ return threads
+
+def get_stopped_thread(process, reason):
+ """A convenience function which returns the first thread with the given stop
+ reason or None.
+
+ Example usages:
+
+ 1. Get the stopped thread due to a breakpoint condition
+
+ ...
+ from lldbutil import get_stopped_thread
+ thread = get_stopped_thread(self.process, lldb.eStopReasonPlanComplete)
+ self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+ ...
+
+ 2. Get the thread stopped due to a breakpoint
+
+ ...
+ from lldbutil import get_stopped_thread
+ thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+ ...
+
+ """
+ threads = get_stopped_threads(process, reason)
+ if len(threads) == 0:
+ return None
+ return threads[0]
+
def get_caller_symbol(thread):
"""
Returns the symbol name for the call site of the leaf function.
OpenPOWER on IntegriCloud