]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dyld_image_path_containing_address.dtest/main.c
dyld-733.6.tar.gz
[apple/dyld.git] / testing / test-cases / dyld_image_path_containing_address.dtest / main.c
1
2 // BUILD: $CC main.c -o $BUILD_DIR/dyld_image_path_containing_address-test.exe
3
4 // RUN: ./dyld_image_path_containing_address-test.exe
5
6
7 #include <stdio.h>
8 #include <string.h>
9 #include <dlfcn.h>
10 #include <mach-o/dyld.h>
11 #include <mach-o/dyld_priv.h>
12
13
14 int main()
15 {
16 printf("[BEGIN] dyld_image_path_containing_address-test\n");
17
18 int count = _dyld_image_count();
19 for (int i=0; i < count; ++i) {
20 const struct mach_header* mh = _dyld_get_image_header(i);
21 const char* name1 = _dyld_get_image_name(i);
22 const char* name2 = dyld_image_path_containing_address(mh);
23 if ( strcmp(name1, name2) != 0 ) {
24 printf("[FAIL] dyld_image_path_containing_address-test: %s != %s\n", name1, name2);
25 return 0;
26 }
27 }
28
29 printf("[PASS] dyld_image_path_containing_address-test\n");
30 return 0;
31 }
32