xref: /llvm-project/lldb/test/API/functionalities/breakpoint/debugbreak/main.c (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1 #ifdef _MSC_VER
2 #include <intrin.h>
3 #define BREAKPOINT_INTRINSIC()    __debugbreak()
4 #else
5 #define BREAKPOINT_INTRINSIC()    __asm__ __volatile__ ("int3")
6 #endif
7 
8 int
bar(int const * foo)9 bar(int const *foo)
10 {
11     int count = 0, i = 0;
12     for (; i < 10; ++i)
13     {
14         count += 1;
15         BREAKPOINT_INTRINSIC();
16         count += 1;
17     }
18     return *foo;
19 }
20 
21 int
main(int argc,char ** argv)22 main(int argc, char **argv)
23 {
24     int foo = 42;
25     bar(&foo);
26     return 0;
27 }
28 
29 
30