aboutsummaryrefslogtreecommitdiff
path: root/test/lang/c
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2013-01-08 23:22:42 +0000
committerJim Ingham <jingham@apple.com>2013-01-08 23:22:42 +0000
commit0e3b98e7de6d69613a9729bac9d4b965c0635698 (patch)
treedd714dbc1a7a9e57b0c0a1f147ecb09cd6f0b753 /test/lang/c
parentccd5c4ee85d1592f9ae3da02c85f5647ca02fab2 (diff)
downloadlldb-0e3b98e7de6d69613a9729bac9d4b965c0635698.tar.gz
Add an SBProcess API to get the current StopID, either considering or ignoring stops caused by expression
evaluation. <rdar://problem/12968562> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@171914 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/lang/c')
-rw-r--r--test/lang/c/stepping/TestStepAndBreakpoints.py21
-rw-r--r--test/lang/c/stepping/main.c2
2 files changed, 22 insertions, 1 deletions
diff --git a/test/lang/c/stepping/TestStepAndBreakpoints.py b/test/lang/c/stepping/TestStepAndBreakpoints.py
index 3f5a74f0a..67472db4a 100644
--- a/test/lang/c/stepping/TestStepAndBreakpoints.py
+++ b/test/lang/c/stepping/TestStepAndBreakpoints.py
@@ -72,6 +72,9 @@ class TestObjCStepping(TestBase):
thread = threads[0]
+ # Get the stop id and for fun make sure it increases:
+ old_stop_id = process.GetStopID()
+
# Now step over, which should cause us to hit the breakpoint in "a"
thread.StepOver()
@@ -80,6 +83,10 @@ class TestObjCStepping(TestBase):
if len(threads) != 1:
self.fail ("Failed to stop at breakpoint in a.")
+ # Check that the stop ID increases:
+ new_stop_id = process.GetStopID()
+ self.assertTrue(new_stop_id > old_stop_id, "Stop ID increases monotonically.")
+
thread = threads[0]
# Step over, and we should hit the breakpoint in b:
@@ -99,13 +106,25 @@ class TestObjCStepping(TestBase):
current_bp.append(thread.GetStopReasonDataAtIndex(0))
current_bp.append(thread.GetStopReasonDataAtIndex(1))
- frame.EvaluateExpression ('(int) printf ("aaaaaaaaaa\n")')
+ stop_id_before_expression = process.GetStopID()
+ stop_id_before_including_expressions = process.GetStopID(True)
+
+ frame.EvaluateExpression ("(int) printf (print_string)")
frame = thread.GetFrameAtIndex(0)
self.assertTrue (current_line == frame.GetLineEntry().GetLine(), "The line stayed the same after expression.")
self.assertTrue (current_file == frame.GetLineEntry().GetFileSpec(), "The file stayed the same after expression.")
self.assertTrue (thread.GetStopReason() == lldb.eStopReasonBreakpoint, "We still say we stopped for a breakpoint.")
self.assertTrue (thread.GetStopReasonDataAtIndex(0) == current_bp[0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
+
+ # Also make sure running the expression didn't change the public stop id
+ # but did change if we are asking for expression stops as well.
+ stop_id_after_expression = process.GetStopID()
+ stop_id_after_including_expressions = process.GetStopID(True)
+
+ self.assertTrue (stop_id_before_expression == stop_id_after_expression, "Expression calling doesn't change stop ID")
+
+ self.assertTrue (stop_id_after_including_expressions > stop_id_before_including_expressions, "Stop ID including expressions increments over expression call.")
# Do the same thing with an expression that's going to crash, and make sure we are still unchanged.
diff --git a/test/lang/c/stepping/main.c b/test/lang/c/stepping/main.c
index 599139cfa..cd72cac4a 100644
--- a/test/lang/c/stepping/main.c
+++ b/test/lang/c/stepping/main.c
@@ -11,6 +11,7 @@
int a(int);
int b(int);
int c(int);
+const char *print_string = "aaaaaaaaaa\n";
int a(int val)
{
@@ -63,5 +64,6 @@ int main (int argc, char const *argv[])
int A7 = complex (a(5), b(6), c(7)); // Stop here to make sure bogus target steps over.
+ printf ("I am using print_string: %s.\n", print_string);
return 0;
}