summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/test/lang/cpp/stl/TestSTL.py20
-rw-r--r--lldb/test/lang/cpp/stl/main.cpp16
2 files changed, 26 insertions, 10 deletions
diff --git a/lldb/test/lang/cpp/stl/TestSTL.py b/lldb/test/lang/cpp/stl/TestSTL.py
index 160e02b8420..33dfc7fc130 100644
--- a/lldb/test/lang/cpp/stl/TestSTL.py
+++ b/lldb/test/lang/cpp/stl/TestSTL.py
@@ -41,8 +41,6 @@ class STLTestCase(TestBase):
# rdar://problem/8543077
# test/stl: clang built binaries results in the breakpoint locations = 3,
# is this a problem with clang generated debug info?
- #
- # Break on line 13 of main.cpp.
self.expect("breakpoint set -f main.cpp -l %d" % self.line,
BREAKPOINT_CREATED,
startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
@@ -59,14 +57,18 @@ class STLTestCase(TestBase):
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
substrs = [' resolved, hit count = 1'])
- # Now do 'thread step-in', if we have successfully stopped, we should
- # stop due to the reason of "step in".
- self.runCmd("thread step-in")
+ # Now try some expressions....
- self.runCmd("process status")
- if "stopped" in self.res.GetOutput():
- self.expect("thread backtrace", "We have successfully stepped in",
- substrs = ['stop reason = step in'])
+ self.runCmd('expr for (int i = 0; i < hello_world.length(); ++i) { (void)printf("%c\\n", hello_world[i]); }')
+
+ self.expect('expr associative_array.size()',
+ substrs = [' = 3'])
+ self.expect('expr associative_array.count(hello_world)',
+ substrs = [' = 1'])
+ self.expect('expr associative_array[hello_world]',
+ substrs = [' = 1'])
+ self.expect('expr associative_array["hello"]',
+ substrs = [' = 2'])
if __name__ == '__main__':
diff --git a/lldb/test/lang/cpp/stl/main.cpp b/lldb/test/lang/cpp/stl/main.cpp
index 0ac0dda9026..1ef7d7222a0 100644
--- a/lldb/test/lang/cpp/stl/main.cpp
+++ b/lldb/test/lang/cpp/stl/main.cpp
@@ -8,8 +8,22 @@
//===----------------------------------------------------------------------===//
#include <iostream>
#include <string>
+#include <map>
int main (int argc, char const *argv[])
{
- std::string hello_world ("Hello World!"); // Set break point at this line.
+ std::string hello_world ("Hello World!");
std::cout << hello_world << std::endl;
+ std::cout << hello_world.length() << std::endl;
+ std::cout << hello_world[11] << std::endl;
+
+ std::map<std::string, int> associative_array;
+ std::cout << "size of upon construction associative_array: " << associative_array.size() << std::endl;
+ associative_array[hello_world] = 1;
+ associative_array["hello"] = 2;
+ associative_array["world"] = 3;
+
+ std::cout << "size of associative_array: " << associative_array.size() << std::endl;
+ printf("associative_array[\"hello\"]=%d\n", associative_array["hello"]);
+
+ printf("before returning....\n"); // Set break point at this line.
}
OpenPOWER on IntegriCloud