/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
*/
/*
* Copyright (c) 1994, by Sun Microsytems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Routines that
* - return an address for a symbol name
* - return a symbol name for an address
*/
#ifndef DEBUG
#endif
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <note.h>
#include "tnfctl_int.h"
#include "dbg.h"
/*
* Typedefs
*/
typedef struct sym_args {
char *sa_name;
} sym_args_t;
/*
* Declarations
*/
void *sym_entry,
/* ---------------------------------------------------------------- */
/* ----------------------- Public Functions ----------------------- */
/* ---------------------------------------------------------------- */
/*
* _tnfctl_sym_find_in_obj() - determines the virtual address of the supplied
* symbol in the object file specified by fd.
*/
{
"sunw%verbosity 3",
/* clear output argument in advance */
if (prexstat)
return (prexstat);
/* check if we found symbol address */
return (TNFCTL_ERR_BADARG);
}
return (TNFCTL_ERR_NONE);
}
/*
* _tnfctl_sym_find() - determines the virtual address of the supplied symbol
* in the process.
*/
{
"start _tnfctl_sym_find; sunw%verbosity 3",
/*LINTED statement has no consequent: else*/
/* for every object in list, search for symbol */
continue; /* don't examine dlclose'd libs */
/* return value of TNFCTL_ERR_BADARG means symbol not found */
if (prexstat == TNFCTL_ERR_NONE)
/* symbol found */
break;
else if (prexstat != TNFCTL_ERR_BADARG)
/* error condition */
break;
/* continue loop on TNFCTL_ERR_BADARG */
}
/*LINTED statement has no consequent: else*/
"end _tnfctl_sym_find; sunw%verbosity 3");
return (prexstat);
}
/*
* _tnfctl_sym_obj_find() - determines the virtual address of the supplied
* symbol in the object specified by base name
*/
{
const char *str_ptr;
"start _tnfctl_sym_obj_find; sunw%verbosity 3",
/* for every object in list ... */
continue; /* don't examine dlclose'd libs */
continue;
/* find the last occurrence of / in the name */
} else {
str_ptr++; /* bump up past '/' */
}
/* XXX - use strcoll ? */
break;
}
}
/* return value of TNFCTL_ERR_BADARG means symbol not found */
return (TNFCTL_ERR_BADARG);
"end _tnfctl_sym_obj_find; sunw%verbosity 3");
return (prexstat);
}
/*
* _tnfctl_sym_findname() - determines the name of a function from its address.
*/
char **symname)
{
"start _tnfctl_sym_findname; sunw%verbosity 3",
/*LINTED statement has no consequent: else*/
/* for every object in list, search for name */
continue; /* don't examine dlclose'd libs */
/* return value of TNFCTL_ERR_BADARG means symbol not found */
if (prexstat == TNFCTL_ERR_NONE)
/* symbol found */
break;
else if (prexstat != TNFCTL_ERR_BADARG)
/* error condition */
break;
/* continue loop on TNFCTL_ERR_BADARG */
}
/*LINTED statement has no consequent: else*/
"end _tnfctl_sym_findname; sunw%verbosity 3");
return (prexstat);
}
/* ---------------------------------------------------------------- */
/* ----------------------- Private Functions ---------------------- */
/* ---------------------------------------------------------------- */
/*
* sym_findname_in_obj() - determines the name of the supplied
* address in the specified object file.
*/
static tnfctl_errcode_t
char **symname)
{
"sunw%verbosity 3",
/* clear output argument in advance */
if (prexstat)
return (prexstat);
/* check if we found symbol address */
return (TNFCTL_ERR_BADARG);
}
return (TNFCTL_ERR_NONE);
}
/*
* sym_match() - function to be called on each symbol in a dynsym section.
* Used to find the address of a symbol.
*/
static tnfctl_errcode_t
{
#if 0
printf("enter sym_match: \n");
else
printf("symargs_p->sa_name = 0\n");
if (name != 0)
else
printf("name = 0\n");
#endif
#ifdef VERYVERBOSE
#endif
"sunw%verbosity 2; sunw%debug '\tMatched Symbol'",
}
#if 0
printf("leaving sym_match\n");
#endif
return (TNFCTL_ERR_NONE);
}
/*
* sym_matchname() - function to be called on each symbol in a dynsym
* section. Used to find the name of a symbol whose address is known.
*/
static tnfctl_errcode_t
{
#ifdef VERYVERBOSE
#endif
"sunw%verbosity 2; sunw%debug '\tMatched Name'",
}
return (TNFCTL_ERR_NONE);
}