[Lldb-commits] [lldb] r143395 - in /lldb/trunk/test/lang/cpp/stl: TestSTL.py main.cpp
Johnny Chen
johnny.chen at apple.com
Mon Oct 31 16:28:53 PDT 2011
Author: johnny
Date: Mon Oct 31 18:28:52 2011
New Revision: 143395
URL: http://llvm.org/viewvc/llvm-project?rev=143395&view=rev
Log:
Add some expr evaluations for simple STL data types.
Radar to be filed soon.
Modified:
lldb/trunk/test/lang/cpp/stl/TestSTL.py
lldb/trunk/test/lang/cpp/stl/main.cpp
Modified: lldb/trunk/test/lang/cpp/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/stl/TestSTL.py?rev=143395&r1=143394&r2=143395&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/stl/TestSTL.py (original)
+++ lldb/trunk/test/lang/cpp/stl/TestSTL.py Mon Oct 31 18:28:52 2011
@@ -41,8 +41,6 @@
# 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 @@
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")
-
- self.runCmd("process status")
- if "stopped" in self.res.GetOutput():
- self.expect("thread backtrace", "We have successfully stepped in",
- substrs = ['stop reason = step in'])
+ # Now try some expressions....
+
+ 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__':
Modified: lldb/trunk/test/lang/cpp/stl/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/stl/main.cpp?rev=143395&r1=143394&r2=143395&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/stl/main.cpp (original)
+++ lldb/trunk/test/lang/cpp/stl/main.cpp Mon Oct 31 18:28:52 2011
@@ -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.
}
More information about the lldb-commits
mailing list