xref: /llvm-project/lldb/test/API/functionalities/bt-interrupt/main.c (revision bbd54e08b08f5ccd38c4665178e65c58f7b14459)
1e19387e6SJim Ingham #include <stdio.h>
2e19387e6SJim Ingham 
3e19387e6SJim Ingham // This example is meant to recurse infinitely.
4e19387e6SJim Ingham // The extra struct is just to make the frame dump
5e19387e6SJim Ingham // more complicated.
6e19387e6SJim Ingham 
7e19387e6SJim Ingham struct Foo {
8e19387e6SJim Ingham   int a;
9e19387e6SJim Ingham   int b;
10e19387e6SJim Ingham   char *c;
11e19387e6SJim Ingham };
12e19387e6SJim Ingham 
13e19387e6SJim Ingham int
forgot_termination(int input,struct Foo my_foo)14e19387e6SJim Ingham forgot_termination(int input, struct Foo my_foo) {
15*bbd54e08SPavel Labath   char frame_increasing_buffer[0x1000]; // To blow the stack sooner.
16e19387e6SJim Ingham   return forgot_termination(++input, my_foo);
17e19387e6SJim Ingham }
18e19387e6SJim Ingham 
19e19387e6SJim Ingham int
main()20e19387e6SJim Ingham main()
21e19387e6SJim Ingham {
22e19387e6SJim Ingham   struct Foo myFoo = {100, 300, "A string you will print a lot"}; // Set a breakpoint here
23e19387e6SJim Ingham   return forgot_termination(1, myFoo);
24e19387e6SJim Ingham }
25