aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/lang/c/register_variables/test.c')
-rw-r--r--packages/Python/lldbsuite/test/lang/c/register_variables/test.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/lang/c/register_variables/test.c b/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
new file mode 100644
index 000000000000..e467ac48f745
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+
+struct bar {
+ int m1;
+ int m2;
+};
+
+void f1(int a, struct bar *b) __attribute__ ((noinline));
+void f1(int a, struct bar *b)
+{
+ b->m2 = b->m1 + a; // set breakpoint here
+}
+
+void f2(struct bar *b) __attribute__ ((noinline));
+void f2(struct bar *b)
+{
+ int c = b->m2;
+ printf("%d\n", c); // set breakpoint here
+}
+
+int main()
+{
+ struct bar myBar = { 3, 4 };
+ f1(2, &myBar);
+ f2(&myBar);
+ return 0;
+}