Add TestTargetAPI.py:

// When stopped on breakppint 1, and then 2, we can get the line entries using
// SBFrame API SBFrame.GetLineEntry().  We'll get the start addresses for the
// two line entries; with the start address (of SBAddress type), we can then
// resolve the symbol context using the SBTarget API
// SBTarget.ResolveSymbolContextForAddress().
//
// The two symbol context should point to the same symbol, i.e., 'a' function.


Add two utility functions to lldbutil.py:

o get_stopped_threads(process, reason):

  return the list of threads with the specified stop reason or an empty list if not found

o get_stopped_thread(process, reason):

  return the first thread with the given stop reason or None if not found

llvm-svn: 126916
diff --git a/lldb/test/python_api/symbol-context/TestSymbolContext.py b/lldb/test/python_api/symbol-context/TestSymbolContext.py
index 96d8356..4c373ad 100644
--- a/lldb/test/python_api/symbol-context/TestSymbolContext.py
+++ b/lldb/test/python_api/symbol-context/TestSymbolContext.py
@@ -54,7 +54,10 @@
         self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
 
         # Frame #0 should be on self.line.
-        frame0 = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0)
+        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")
+        frame0 = thread.GetFrameAtIndex(0)
         self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
 
         # Now get the SBSymbolContext from this frame.  We want everything. :-)
@@ -81,6 +84,7 @@
         #print "block:", block
 
         lineEntry = context.GetLineEntry()
+        #print "line entry:", lineEntry
         self.expect(lineEntry.GetFileSpec().GetDirectory(), "The line entry should have the correct directory",
                     exe=False,
             substrs = [self.mydir])