xref: /llvm-project/lldb/test/API/functionalities/stop-on-sharedlibrary-load/main.cpp (revision c8faa8c2669c1867ef6ac33466f219a39d5faaa7)
1 #include "dylib.h"
2 #include <limits.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 
main(int argc,char const * argv[])7 int main(int argc, char const *argv[]) {
8   const char *a_name = "load_a";
9   void *a_dylib_handle = NULL;
10 
11   a_dylib_handle = dylib_open(a_name); // Set a breakpoint here.
12   if (a_dylib_handle == NULL) { // Set another here - we should not hit this one
13     fprintf(stderr, "%s\n", dylib_last_error());
14     exit(1);
15   }
16 
17   const char *b_name = "load_b";
18   void *b_dylib_handle = NULL;
19 
20   b_dylib_handle = dylib_open(b_name);
21   if (b_dylib_handle == NULL) { // Set a third here - we should not hit this one
22     fprintf(stderr, "%s\n", dylib_last_error());
23     exit(1);
24   }
25 
26   return 0;
27 }
28