Bugzilla Bug 280984: need to pass the L_IGNOREUNLOAD flag to loadquery so

that shared libraries that have been dlclose'd but with nonzero ref count
will be listed.  Also use function address test, which is more reliable
than file name test.  The patch is contributed by Philip K. Warren (IBM)
<pkwarren@gmail.com>. r=wtc.


git-svn-id: svn://10.0.0.236/trunk@168829 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtchang%redhat.com 2005-02-05 01:56:54 +00:00
parent 299c44c32c
commit da66b9903b

View File

@ -1760,7 +1760,7 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
return NULL;
}
/* If buffer is too small, loadquery fails with ENOMEM. */
if (loadquery(L_GETINFO, info, info_length) != -1) {
if (loadquery(L_GETINFO | L_IGNOREUNLOAD, info, info_length) != -1) {
break;
}
PR_Free(info);
@ -1776,7 +1776,9 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
for (infop = info;
;
infop = (struct ld_info *)((char *)infop + infop->ldinfo_next)) {
if (strstr(infop->ldinfo_filename, name) != NULL) {
unsigned long start = (unsigned long)infop->ldinfo_dataorg;
unsigned long end = start + infop->ldinfo_datasize;
if (start <= (unsigned long)addr && end > (unsigned long)addr) {
result = PR_Malloc(strlen(infop->ldinfo_filename)+1);
if (result != NULL) {
strcpy(result, infop->ldinfo_filename);