]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dyld_image_path_containing_address.dtest/main.c
dyld-750.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 #include "test_support.h"
14
15 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
16 int count = _dyld_image_count();
17 for (int i=0; i < count; ++i) {
18 const struct mach_header* mh = _dyld_get_image_header(i);
19 const char* name1 = _dyld_get_image_name(i);
20 const char* name2 = dyld_image_path_containing_address(mh);
21 if ( strcmp(name1, name2) != 0 ) {
22 FAIL("%s != %s", name1, name2);
23 }
24 }
25
26 PASS("Success");
27 }
28