Skip to content

Commit 79f02b0

Browse files
committed
Temporary debugging
1 parent 0298acc commit 79f02b0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

cli/loader_library_probe.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ const char *jl_loader_probe_system_library(const char *libname, const char *symb
8989
{
9090
char buf[PATH_MAX];
9191

92+
fprintf(stderr, "scanning LD_LIBRARY_PATH\n");
93+
9294
/**
9395
* Make a best-effort attempt to emulate the linker's use of LD_LIBRARY_PATH
9496
**/
@@ -117,6 +119,8 @@ const char *jl_loader_probe_system_library(const char *libname, const char *symb
117119
}
118120
}
119121

122+
fprintf(stderr, "scanning ld.so.cache\n");
123+
120124
/**
121125
* Check the ld.so.cache for the library. Assuming we can find the cache,
122126
* this is by far our best chance to locate the lib successfully.
@@ -145,6 +149,8 @@ const char *jl_loader_probe_system_library(const char *libname, const char *symb
145149
munmap((void *)cache, sz);
146150
}
147151

152+
fprintf(stderr, "scanning default libdirs\n");
153+
148154
/**
149155
* As a last-ditch effort, try to emulate / search the "default" libdirs used
150156
* by the GLIBC dynamic linker.
@@ -156,6 +162,7 @@ const char *jl_loader_probe_system_library(const char *libname, const char *symb
156162
buf[0] = '\0';
157163
strcat(buf, default_libdirs[i]);
158164
strcat(buf, libname);
165+
fprintf(stderr, "default libdir: \"%s\"\n", buf);
159166
if (jl_loader_locate_symbol(buf, symbol))
160167
return strdup(buf);
161168
}

cli/loader_symbol_probe.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,21 @@ int jl_loader_locate_symbol(const char *library, const char *symbol)
9696
{
9797
int found = 0;
9898

99+
fprintf(stderr, "library: \"%s\" symbol: \"%s\"", library, symbol);
100+
99101
size_t library_sz;
100102
void *elf_file = jl_loader_open_via_mmap(library, &library_sz);
101103
if (elf_file == NULL)
102-
goto bail;
104+
return 0;
105+
106+
fprintf(stderr, "checking header\n");
103107

104108
const char *hdr = (const char *)elf_file;
105109
if (strncmp(hdr, ELFMAG, SELFMAG) != 0)
106110
goto bail;
107111

112+
fprintf(stderr, "locate symbol\n");
113+
108114
assert(hdr[5] == ELFDATA2LSB);
109115
if (hdr[4] == ELFCLASS32) {
110116
found = Elf32_locate_symbol((Elf32_Ehdr *)hdr, symbol);

0 commit comments

Comments
 (0)