mdb_module_load.c revision c9a6ea2e938727c95af7108c5e00eee4c890c7ae
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <unistd.h>
#include <strings.h>
#include <dlfcn.h>
#include <ctype.h>
#include <link.h>
#include <mdb/mdb_module.h>
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_debug.h>
#include <mdb/mdb_string.h>
#include <mdb/mdb_frame.h>
int
{
const char *wformat = "no module '%s' could be found\n";
char buf[MAXPATHLEN], *p, *q;
int i;
strbasename(name));
/*
* Remove any .so(.[0-9]+)? suffix
*/
for (q = p + 1; isdigit(*q); q++)
;
if (*q == '\0') {
/* found digits to remove */
*p = '\0';
continue;
}
if (strcmp(p, ".so") == 0) {
*p = '\0';
break;
}
}
}
goto err;
goto err;
}
}
/*
* If a simple name is specified, search for it in the module path.
* The module path is searched in order, and for each element we
* look for the following files:
*
* 1. If the module name ends in ".so(.[0-9]+)?", search for the literal
* name and then search for the name without the [0-9]+ suffix.
* 2. If the module name ends in ".so", search for the literal name.
* 3. Search for the module name with ".so" appended.
*
* Once a matching file is detected, we attempt to load that module
* and do not resume our search in the case of an error.
*/
"checking for %s\n", buf);
}
}
*p = '\0'; /* strip trailing digits */
"checking for %s\n", buf);
}
}
}
}
err:
if (!(mode & MDB_MOD_SILENT))
return (-1);
}
typedef struct mdb_modload_data {
int mld_first;
int mld_mode;
/*ARGSUSED*/
static int
{
}
}
/*
* A bit of a kludge: because we manage alternately capable
* libc instances by mounting the appropriately capable
* list does not contain libc.so.1, but rather one of its
* hwcap variants. Unfortunately, there is not a way of
* getting from this shared object to the object that it is
* effectively interposing on -- which means that without
* special processing, we will not load any libc.so dmod. So
* if we see that we have a shared object coming out of the
* "libc" directory, we assume that we have a "libc-like"
* object, and explicitly load the "libc.so" dmod.
*/
}
return (0);
}
void
mdb_module_load_all(int mode)
{
}
int
{
return (mdb_module_unload_common(name));
}