17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*
237c478bdstevel@tonic-gate * Copyright (c) 1994, by Sun Microsytems, Inc.
247c478bdstevel@tonic-gate */
257c478bdstevel@tonic-gate
267c478bdstevel@tonic-gate/*
277c478bdstevel@tonic-gate * Routines that
287c478bdstevel@tonic-gate *	- return an address for a symbol name
297c478bdstevel@tonic-gate *	- return a symbol name for an address
307c478bdstevel@tonic-gate */
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gate#ifndef DEBUG
337c478bdstevel@tonic-gate#define	NDEBUG	1
347c478bdstevel@tonic-gate#endif
357c478bdstevel@tonic-gate
367c478bdstevel@tonic-gate#include <stdlib.h>
377c478bdstevel@tonic-gate#include <unistd.h>
387c478bdstevel@tonic-gate#include <string.h>
397c478bdstevel@tonic-gate#include <errno.h>
407c478bdstevel@tonic-gate#include <sys/procfs.h>
417c478bdstevel@tonic-gate#include <sys/stat.h>
427c478bdstevel@tonic-gate#include <assert.h>
437c478bdstevel@tonic-gate
447c478bdstevel@tonic-gate#include "tnfctl_int.h"
457c478bdstevel@tonic-gate#include "dbg.h"
467c478bdstevel@tonic-gate
477c478bdstevel@tonic-gate
487c478bdstevel@tonic-gate/*
497c478bdstevel@tonic-gate * Typedefs
507c478bdstevel@tonic-gate */
517c478bdstevel@tonic-gate
527c478bdstevel@tonic-gatetypedef struct sym_args {
537c478bdstevel@tonic-gate	char		*sa_name;
547c478bdstevel@tonic-gate	uintptr_t	sa_addr;
557c478bdstevel@tonic-gate} sym_args_t;
567c478bdstevel@tonic-gate
577c478bdstevel@tonic-gate/*
587c478bdstevel@tonic-gate * Declarations
597c478bdstevel@tonic-gate */
607c478bdstevel@tonic-gate
617c478bdstevel@tonic-gatestatic tnfctl_errcode_t sym_findname_in_obj(int objfd, uintptr_t baseaddr,
627c478bdstevel@tonic-gate	uintptr_t symaddr, char **symname);
637c478bdstevel@tonic-gate
647c478bdstevel@tonic-gatestatic tnfctl_errcode_t sym_match(char *name, uintptr_t addr, void *sym_entry,
657c478bdstevel@tonic-gate	tnfctl_elf_search_t *search_info_p);
667c478bdstevel@tonic-gate
677c478bdstevel@tonic-gatestatic tnfctl_errcode_t sym_matchname(char *name, uintptr_t addr,
687c478bdstevel@tonic-gate	void *sym_entry,
697c478bdstevel@tonic-gate	tnfctl_elf_search_t *search_info_p);
707c478bdstevel@tonic-gate
717c478bdstevel@tonic-gate
727c478bdstevel@tonic-gate/* ---------------------------------------------------------------- */
737c478bdstevel@tonic-gate/* ----------------------- Public Functions ----------------------- */
747c478bdstevel@tonic-gate/* ---------------------------------------------------------------- */
757c478bdstevel@tonic-gate
767c478bdstevel@tonic-gate/*
777c478bdstevel@tonic-gate * _tnfctl_sym_find_in_obj() - determines the virtual address of the supplied
787c478bdstevel@tonic-gate * symbol in the object file specified by fd.
797c478bdstevel@tonic-gate */
807c478bdstevel@tonic-gatetnfctl_errcode_t
817c478bdstevel@tonic-gate_tnfctl_sym_find_in_obj(int objfd, uintptr_t baseaddr, const char *symname,
827c478bdstevel@tonic-gate		uintptr_t *symaddr)
837c478bdstevel@tonic-gate{
847c478bdstevel@tonic-gate	tnfctl_errcode_t	prexstat = TNFCTL_ERR_NONE;
857c478bdstevel@tonic-gate	sym_args_t		symargs;
867c478bdstevel@tonic-gate	tnfctl_elf_search_t	search_info;
877c478bdstevel@tonic-gate
887c478bdstevel@tonic-gate	DBG_TNF_PROBE_1(_tnfctl_sym_find_in_obj_1, "libtnfctl",
897c478bdstevel@tonic-gate			"sunw%verbosity 3",
907c478bdstevel@tonic-gate			tnf_string, searching_for, symname);
917c478bdstevel@tonic-gate
927c478bdstevel@tonic-gate	symargs.sa_name = (char *) symname;
937c478bdstevel@tonic-gate	/* clear output argument in advance */
947c478bdstevel@tonic-gate	symargs.sa_addr = 0;
957c478bdstevel@tonic-gate
967c478bdstevel@tonic-gate	search_info.section_func = _tnfctl_traverse_dynsym;
977c478bdstevel@tonic-gate	search_info.record_func = sym_match;
987c478bdstevel@tonic-gate	search_info.record_data = &symargs;
997c478bdstevel@tonic-gate
1007c478bdstevel@tonic-gate	prexstat = _tnfctl_traverse_object(objfd, baseaddr, &search_info);
1017c478bdstevel@tonic-gate	if (prexstat)
1027c478bdstevel@tonic-gate		return (prexstat);
1037c478bdstevel@tonic-gate
1047c478bdstevel@tonic-gate	/* check if we found symbol address */
1057c478bdstevel@tonic-gate	if (symargs.sa_addr == 0) {
1067c478bdstevel@tonic-gate		return (TNFCTL_ERR_BADARG);
1077c478bdstevel@tonic-gate	}
1087c478bdstevel@tonic-gate
1097c478bdstevel@tonic-gate	*symaddr = symargs.sa_addr;
1107c478bdstevel@tonic-gate	return (TNFCTL_ERR_NONE);
1117c478bdstevel@tonic-gate}
1127c478bdstevel@tonic-gate
1137c478bdstevel@tonic-gate
1147c478bdstevel@tonic-gate/*
1157c478bdstevel@tonic-gate * _tnfctl_sym_find() - determines the virtual address of the supplied symbol
1167c478bdstevel@tonic-gate * in the process.
1177c478bdstevel@tonic-gate */
1187c478bdstevel@tonic-gatetnfctl_errcode_t
1197c478bdstevel@tonic-gate_tnfctl_sym_find(tnfctl_handle_t *hndl, const char *symname, uintptr_t *symaddr)
1207c478bdstevel@tonic-gate{
1217c478bdstevel@tonic-gate	boolean_t	release_lock;
1227c478bdstevel@tonic-gate	tnfctl_errcode_t	prexstat = TNFCTL_ERR_NONE;
1237c478bdstevel@tonic-gate	objlist_t	*obj;
1247c478bdstevel@tonic-gate
1257c478bdstevel@tonic-gate	DBG_TNF_PROBE_1(_tnfctl_sym_find_start, "libtnfctl",
1267c478bdstevel@tonic-gate			"start _tnfctl_sym_find; sunw%verbosity 3",
1277c478bdstevel@tonic-gate			tnf_string, searching_for, symname);
1287c478bdstevel@tonic-gate
1297c478bdstevel@tonic-gate	/*LINTED statement has no consequent: else*/
1307c478bdstevel@tonic-gate	LOCK(hndl, prexstat, release_lock);
1317c478bdstevel@tonic-gate
1327c478bdstevel@tonic-gate	/* for every object in list, search for symbol */
1337c478bdstevel@tonic-gate	for (obj = hndl->objlist; obj; obj = obj->next) {
1347c478bdstevel@tonic-gate		if (obj->old == B_TRUE)
1357c478bdstevel@tonic-gate			continue;	/* don't examine dlclose'd libs */
1367c478bdstevel@tonic-gate
1377c478bdstevel@tonic-gate		/* return value of TNFCTL_ERR_BADARG means symbol not found */
1387c478bdstevel@tonic-gate		prexstat = _tnfctl_sym_find_in_obj(obj->objfd,
1397c478bdstevel@tonic-gate			obj->baseaddr, symname, symaddr);
1407c478bdstevel@tonic-gate		if (prexstat == TNFCTL_ERR_NONE)
1417c478bdstevel@tonic-gate			/* symbol found */
1427c478bdstevel@tonic-gate			break;
1437c478bdstevel@tonic-gate		else if (prexstat != TNFCTL_ERR_BADARG)
1447c478bdstevel@tonic-gate			/* error condition */
1457c478bdstevel@tonic-gate			break;
1467c478bdstevel@tonic-gate		/* continue loop on TNFCTL_ERR_BADARG */
1477c478bdstevel@tonic-gate	}
1487c478bdstevel@tonic-gate
1497c478bdstevel@tonic-gate	/*LINTED statement has no consequent: else*/
1507c478bdstevel@tonic-gate	UNLOCK(hndl, release_lock);
1517c478bdstevel@tonic-gate
1527c478bdstevel@tonic-gate	DBG_TNF_PROBE_0(_tnfctl_sym_find_end, "libtnfctl",
1537c478bdstevel@tonic-gate			"end _tnfctl_sym_find; sunw%verbosity 3");
1547c478bdstevel@tonic-gate
1557c478bdstevel@tonic-gate	return (prexstat);
1567c478bdstevel@tonic-gate}
1577c478bdstevel@tonic-gate
1587c478bdstevel@tonic-gate/*
1597c478bdstevel@tonic-gate * _tnfctl_sym_obj_find() - determines the virtual address of the supplied
1607c478bdstevel@tonic-gate *	symbol in the object specified by base name
1617c478bdstevel@tonic-gate */
1627c478bdstevel@tonic-gatetnfctl_errcode_t
1637c478bdstevel@tonic-gate_tnfctl_sym_obj_find(tnfctl_handle_t *hndl, const char *lib_base_name,
1647c478bdstevel@tonic-gate	const char *symname, uintptr_t *symaddr)
1657c478bdstevel@tonic-gate{
1667c478bdstevel@tonic-gate	tnfctl_errcode_t	prexstat = TNFCTL_ERR_NONE;
1677c478bdstevel@tonic-gate	objlist_t	*obj, *found_obj;
1687c478bdstevel@tonic-gate	const char *str_ptr;
1697c478bdstevel@tonic-gate
1707c478bdstevel@tonic-gate	assert((hndl->mode == INTERNAL_MODE) ?
1717c478bdstevel@tonic-gate		(MUTEX_HELD(&_tnfctl_lmap_lock)) : 1);
1727c478bdstevel@tonic-gate
1737c478bdstevel@tonic-gate	DBG_TNF_PROBE_1(_tnfctl_sym_obj_find_start, "libtnfctl",
1747c478bdstevel@tonic-gate			"start _tnfctl_sym_obj_find; sunw%verbosity 3",
1757c478bdstevel@tonic-gate			tnf_string, searching_for, symname);
1767c478bdstevel@tonic-gate
1777c478bdstevel@tonic-gate	found_obj = NULL;
1787c478bdstevel@tonic-gate	/* for every object in list ... */
1797c478bdstevel@tonic-gate	for (obj = hndl->objlist; obj; obj = obj->next) {
1807c478bdstevel@tonic-gate		if (obj->old == B_TRUE)
1817c478bdstevel@tonic-gate			continue;	/* don't examine dlclose'd libs */
1827c478bdstevel@tonic-gate
1837c478bdstevel@tonic-gate		if (obj->objname == NULL)
1847c478bdstevel@tonic-gate			continue;
1857c478bdstevel@tonic-gate
1867c478bdstevel@tonic-gate		/* find the last occurrence of / in the name */
1877c478bdstevel@tonic-gate		str_ptr = strrchr(obj->objname, '/');
1887c478bdstevel@tonic-gate		if (str_ptr == NULL) {
1897c478bdstevel@tonic-gate			str_ptr = obj->objname;
1907c478bdstevel@tonic-gate		} else {
1917c478bdstevel@tonic-gate			str_ptr++;	/* bump up past '/' */
1927c478bdstevel@tonic-gate		}
1937c478bdstevel@tonic-gate
1947c478bdstevel@tonic-gate		/* XXX - use strcoll ? */
1957c478bdstevel@tonic-gate		if (strcmp(str_ptr, lib_base_name) == 0) {
1967c478bdstevel@tonic-gate			found_obj = obj;
1977c478bdstevel@tonic-gate			break;
1987c478bdstevel@tonic-gate		}
1997c478bdstevel@tonic-gate	}
2007c478bdstevel@tonic-gate	/* return value of TNFCTL_ERR_BADARG means symbol not found */
2017c478bdstevel@tonic-gate	if (found_obj == NULL)
2027c478bdstevel@tonic-gate		return (TNFCTL_ERR_BADARG);
2037c478bdstevel@tonic-gate
2047c478bdstevel@tonic-gate	prexstat = _tnfctl_sym_find_in_obj(found_obj->objfd,
2057c478bdstevel@tonic-gate			found_obj->baseaddr, symname, symaddr);
2067c478bdstevel@tonic-gate
2077c478bdstevel@tonic-gate	DBG_TNF_PROBE_0(_tnfctl_sym_obj_find_end, "libtnfctl",
2087c478bdstevel@tonic-gate			"end _tnfctl_sym_obj_find; sunw%verbosity 3");
2097c478bdstevel@tonic-gate
2107c478bdstevel@tonic-gate	return (prexstat);
2117c478bdstevel@tonic-gate}
2127c478bdstevel@tonic-gate
2137c478bdstevel@tonic-gate/*
2147c478bdstevel@tonic-gate * _tnfctl_sym_findname() - determines the name of a function from its address.
2157c478bdstevel@tonic-gate */
2167c478bdstevel@tonic-gatetnfctl_errcode_t
2177c478bdstevel@tonic-gate_tnfctl_sym_findname(tnfctl_handle_t *hndl, uintptr_t symaddr,
2187c478bdstevel@tonic-gate	char **symname)
2197c478bdstevel@tonic-gate{
2207c478bdstevel@tonic-gate	boolean_t	release_lock;
2217c478bdstevel@tonic-gate	tnfctl_errcode_t	prexstat = TNFCTL_ERR_NONE;
2227c478bdstevel@tonic-gate	objlist_t	*obj;
2237c478bdstevel@tonic-gate
2247c478bdstevel@tonic-gate	DBG_TNF_PROBE_1(_tnfctl_sym_findname_start, "libtnfctl",
2257c478bdstevel@tonic-gate			"start _tnfctl_sym_findname; sunw%verbosity 3",
2267c478bdstevel@tonic-gate			tnf_opaque, searching_for, symaddr);
2277c478bdstevel@tonic-gate
2287c478bdstevel@tonic-gate	/*LINTED statement has no consequent: else*/
2297c478bdstevel@tonic-gate	LOCK(hndl, prexstat, release_lock);
2307c478bdstevel@tonic-gate
2317c478bdstevel@tonic-gate	/* for every object in list, search for name */
2327c478bdstevel@tonic-gate	for (obj = hndl->objlist; obj; obj = obj->next) {
2337c478bdstevel@tonic-gate		if (obj->old == B_TRUE)
2347c478bdstevel@tonic-gate			continue;	/* don't examine dlclose'd libs */
2357c478bdstevel@tonic-gate		/* return value of TNFCTL_ERR_BADARG means symbol not found */
2367c478bdstevel@tonic-gate		prexstat = sym_findname_in_obj(obj->objfd,
2377c478bdstevel@tonic-gate			obj->baseaddr, symaddr, symname);
2387c478bdstevel@tonic-gate		if (prexstat == TNFCTL_ERR_NONE)
2397c478bdstevel@tonic-gate			/* symbol found */
2407c478bdstevel@tonic-gate			break;
2417c478bdstevel@tonic-gate		else if (prexstat != TNFCTL_ERR_BADARG)
2427c478bdstevel@tonic-gate			/* error condition */
2437c478bdstevel@tonic-gate			break;
2447c478bdstevel@tonic-gate		/* continue loop on TNFCTL_ERR_BADARG */
2457c478bdstevel@tonic-gate	}
2467c478bdstevel@tonic-gate
2477c478bdstevel@tonic-gate	/*LINTED statement has no consequent: else*/
2487c478bdstevel@tonic-gate	UNLOCK(hndl, release_lock);
2497c478bdstevel@tonic-gate
2507c478bdstevel@tonic-gate	DBG_TNF_PROBE_0(_tnfctl_sym_findname_end, "libtnfctl",
2517c478bdstevel@tonic-gate			"end _tnfctl_sym_findname; sunw%verbosity 3");
2527c478bdstevel@tonic-gate
2537c478bdstevel@tonic-gate	return (prexstat);
2547c478bdstevel@tonic-gate}
2557c478bdstevel@tonic-gate
2567c478bdstevel@tonic-gate
2577c478bdstevel@tonic-gate/* ---------------------------------------------------------------- */
2587c478bdstevel@tonic-gate/* ----------------------- Private Functions ---------------------- */
2597c478bdstevel@tonic-gate/* ---------------------------------------------------------------- */
2607c478bdstevel@tonic-gate
2617c478bdstevel@tonic-gate/*
2627c478bdstevel@tonic-gate * sym_findname_in_obj() - determines the name of the supplied
2637c478bdstevel@tonic-gate * address in the specified object file.
2647c478bdstevel@tonic-gate */
2657c478bdstevel@tonic-gatestatic tnfctl_errcode_t
2667c478bdstevel@tonic-gatesym_findname_in_obj(int objfd, uintptr_t baseaddr, uintptr_t symaddr,
2677c478bdstevel@tonic-gate	char **symname)
2687c478bdstevel@tonic-gate{
2697c478bdstevel@tonic-gate	tnfctl_errcode_t	prexstat = TNFCTL_ERR_NONE;
2707c478bdstevel@tonic-gate	sym_args_t	symargs;
2717c478bdstevel@tonic-gate	tnfctl_elf_search_t	search_info;
2727c478bdstevel@tonic-gate
2737c478bdstevel@tonic-gate	DBG_TNF_PROBE_1(sym_findname_in_obj_1, "libtnfctl",
2747c478bdstevel@tonic-gate			"sunw%verbosity 3",
2757c478bdstevel@tonic-gate			tnf_opaque, searching_for, symaddr);
2767c478bdstevel@tonic-gate
2777c478bdstevel@tonic-gate	/* clear output argument in advance */
2787c478bdstevel@tonic-gate	symargs.sa_name = NULL;
2797c478bdstevel@tonic-gate	symargs.sa_addr = symaddr;
2807c478bdstevel@tonic-gate
2817c478bdstevel@tonic-gate	search_info.section_func = _tnfctl_traverse_dynsym;
2827c478bdstevel@tonic-gate	search_info.record_func = sym_matchname;
2837c478bdstevel@tonic-gate	search_info.record_data = &symargs;
2847c478bdstevel@tonic-gate
2857c478bdstevel@tonic-gate	prexstat = _tnfctl_traverse_object(objfd, baseaddr, &search_info);
2867c478bdstevel@tonic-gate	if (prexstat)
2877c478bdstevel@tonic-gate		return (prexstat);
2887c478bdstevel@tonic-gate
2897c478bdstevel@tonic-gate	/* check if we found symbol address */
2907c478bdstevel@tonic-gate	if (symargs.sa_name == NULL) {
2917c478bdstevel@tonic-gate		return (TNFCTL_ERR_BADARG);
2927c478bdstevel@tonic-gate	}
2937c478bdstevel@tonic-gate
2947c478bdstevel@tonic-gate	*symname = symargs.sa_name;
2957c478bdstevel@tonic-gate	return (TNFCTL_ERR_NONE);
2967c478bdstevel@tonic-gate}
2977c478bdstevel@tonic-gate
2987c478bdstevel@tonic-gate/*
2997c478bdstevel@tonic-gate * sym_match() - function to be called on each symbol in a dynsym section.
3007c478bdstevel@tonic-gate *		Used to find the address of a symbol.
3017c478bdstevel@tonic-gate */
3027c478bdstevel@tonic-gatestatic tnfctl_errcode_t
3037c478bdstevel@tonic-gatesym_match(char *name, uintptr_t addr, void *sym_entry,
3047c478bdstevel@tonic-gate	tnfctl_elf_search_t *search_info_p)
3057c478bdstevel@tonic-gate{
3067c478bdstevel@tonic-gate	sym_args_t	*symargs_p = (sym_args_t *) search_info_p->record_data;
3077c478bdstevel@tonic-gate	Elf3264_Sym	*sym = (Elf3264_Sym *) sym_entry;
3087c478bdstevel@tonic-gate#if 0
3097c478bdstevel@tonic-gate	printf("enter sym_match: \n");
3107c478bdstevel@tonic-gate	if (symargs_p->sa_name != 0)
3117c478bdstevel@tonic-gate		printf("(symargs_p->sa_name) = %s\n", symargs_p->sa_name);
3127c478bdstevel@tonic-gate	else
3137c478bdstevel@tonic-gate		printf("symargs_p->sa_name = 0\n");
3147c478bdstevel@tonic-gate	if (name != 0)
3157c478bdstevel@tonic-gate		printf("(name) = %s\n", name);
3167c478bdstevel@tonic-gate	else
3177c478bdstevel@tonic-gate		printf("name = 0\n");
3187c478bdstevel@tonic-gate#endif
3197c478bdstevel@tonic-gate
3207c478bdstevel@tonic-gate#ifdef VERYVERBOSE
3217c478bdstevel@tonic-gate	(void) fprintf(stderr, "sym_match: checking \"%s\"\n", name);
3227c478bdstevel@tonic-gate#endif
3237c478bdstevel@tonic-gate
3247c478bdstevel@tonic-gate	if ((sym->st_shndx != SHN_UNDEF) &&
3257c478bdstevel@tonic-gate			(strcmp(name, symargs_p->sa_name) == 0)) {
3267c478bdstevel@tonic-gate
3277c478bdstevel@tonic-gate		DBG_TNF_PROBE_2(sym_match_1, "libtnfctl",
3287c478bdstevel@tonic-gate			"sunw%verbosity 2; sunw%debug '\tMatched Symbol'",
3297c478bdstevel@tonic-gate			tnf_string, symbol, name,
3307c478bdstevel@tonic-gate			tnf_opaque, address_found, addr);
3317c478bdstevel@tonic-gate
3327c478bdstevel@tonic-gate		symargs_p->sa_addr = addr;
3337c478bdstevel@tonic-gate	}
3347c478bdstevel@tonic-gate#if 0
3357c478bdstevel@tonic-gate	printf("leaving sym_match\n");
3367c478bdstevel@tonic-gate#endif
3377c478bdstevel@tonic-gate	return (TNFCTL_ERR_NONE);
3387c478bdstevel@tonic-gate}
3397c478bdstevel@tonic-gate
3407c478bdstevel@tonic-gate
3417c478bdstevel@tonic-gate/*
3427c478bdstevel@tonic-gate * sym_matchname() - function to be called on each symbol in a dynsym
3437c478bdstevel@tonic-gate * section. Used to find the name of a symbol whose address is known.
3447c478bdstevel@tonic-gate */
3457c478bdstevel@tonic-gatestatic tnfctl_errcode_t
3467c478bdstevel@tonic-gatesym_matchname(char *name, uintptr_t addr, void *sym_entry,
3477c478bdstevel@tonic-gate	tnfctl_elf_search_t * search_info_p)
3487c478bdstevel@tonic-gate{
3497c478bdstevel@tonic-gate	sym_args_t	*symargs_p = (sym_args_t *) search_info_p->record_data;
3507c478bdstevel@tonic-gate	Elf3264_Sym	*sym = (Elf3264_Sym *) sym_entry;
3517c478bdstevel@tonic-gate
3527c478bdstevel@tonic-gate#ifdef VERYVERBOSE
3537c478bdstevel@tonic-gate	(void) fprintf(stderr, "sym_matchname: checking \"%s\"\n", name);
3547c478bdstevel@tonic-gate#endif
3557c478bdstevel@tonic-gate
3567c478bdstevel@tonic-gate	if ((sym->st_shndx != SHN_UNDEF) &&
3577c478bdstevel@tonic-gate			symargs_p->sa_addr == addr) {
3587c478bdstevel@tonic-gate
3597c478bdstevel@tonic-gate		DBG_TNF_PROBE_2(sym_matchname_1, "libtnfctl",
3607c478bdstevel@tonic-gate			"sunw%verbosity 2; sunw%debug '\tMatched Name'",
3617c478bdstevel@tonic-gate			tnf_string, symbol_found, name,
3627c478bdstevel@tonic-gate			tnf_opaque, address, addr);
3637c478bdstevel@tonic-gate
3647c478bdstevel@tonic-gate		symargs_p->sa_name = strdup(name);
3657c478bdstevel@tonic-gate	}
3667c478bdstevel@tonic-gate
3677c478bdstevel@tonic-gate	return (TNFCTL_ERR_NONE);
3687c478bdstevel@tonic-gate}
369