diff options
author | dim <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 |
commit | 78b9749c0a4ea980a8b934645da6ae98fcc665e8 (patch) | |
tree | dd2a1ddf0476664c2b823409c36cbccd52662ca7 /packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp | |
parent | 60cb593f9d55fa5ca7a5372b731f2330345b4b9a (diff) | |
download | FreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.zip FreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.tar.gz |
Vendor import of lldb trunk r256945:
https://llvm.org/svn/llvm-project/lldb/trunk@256945
Diffstat (limited to 'packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp')
-rw-r--r-- | packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp b/packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp new file mode 100644 index 0000000..e11f83e --- /dev/null +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp @@ -0,0 +1,127 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +struct inner +{ + int var_d; +}; + +struct my_type +{ + int var_a; + char var_b; + struct inner inner_; +}; + +int +local_int_test(void) +{ + int a = 10, b = 20; + return 0; // BP_local_int_test +} + +int +local_int_test_with_args(int c, int d) +{ + int a = 10, b = 20; + return 0; // BP_local_int_test_with_args +} + +int +local_struct_test(void) +{ + struct my_type var_c; + var_c.var_a = 10; + var_c.var_b = 'a'; + var_c.inner_.var_d = 30; + return 0; // BP_local_struct_test +} + +int local_struct_test_with_args(struct my_type var_e) +{ + struct my_type var_c; + var_c.var_a = 10; + var_c.var_b = 'a'; + var_c.inner_.var_d = 30; + return 0; // BP_local_struct_test_with_args +} + +int +local_array_test(void) +{ + int array[3]; + array[0] = 100; + array[1] = 200; + array[2] = 300; + return 0; // BP_local_array_test +} + +int +local_array_test_with_args(int* other_array) +{ + int array[3]; + array[0] = 100; + array[1] = 200; + array[2] = 300; + return 0; // BP_local_array_test_with_args +} + +int +local_pointer_test(void) +{ + const char *test_str = "Rakaposhi"; + int var_e = 24; + int *ptr = &var_e; + return 0; // BP_local_pointer_test +} + +int +local_pointer_test_with_args(const char *arg_str, int *arg_ptr) +{ + const char *test_str = "Rakaposhi"; + int var_e = 24; + int *ptr = &var_e; + return 0; // BP_local_pointer_test_with_args +} + +int do_tests_with_args() +{ + local_int_test_with_args(30, 40); + + struct my_type var_e; + var_e.var_a = 20; + var_e.var_b = 'b'; + var_e.inner_.var_d = 40; + local_struct_test_with_args(var_e); + + int array[3]; + array[0] = 400; + array[1] = 500; + array[2] = 600; + local_array_test_with_args(array); + + const char *test_str = "String"; + int var_z = 25; + int *ptr = &var_z; + local_pointer_test_with_args(test_str, ptr); + + return 0; +} + +int +main(int argc, char const *argv[]) +{ + local_int_test(); + local_struct_test(); + local_array_test(); + local_pointer_test(); + + do_tests_with_args(); + return 0; +} |