1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef __RTLD_DB_H 28 #define __RTLD_DB_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <proc_service.h> 33 #include <thread.h> 34 #include <synch.h> 35 #include <sgs.h> 36 #include <machdep.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 struct rd_agent { 43 mutex_t rd_mutex; 44 struct ps_prochandle *rd_psp; /* prochandle pointer */ 45 psaddr_t rd_rdebug; /* rtld r_debug */ 46 psaddr_t rd_preinit; /* rtld_db_preinit */ 47 psaddr_t rd_postinit; /* rtld_db_postinit */ 48 psaddr_t rd_dlact; /* rtld_db_dlact */ 49 psaddr_t rd_tbinder; /* tail of binder */ 50 psaddr_t rd_rtlddbpriv; /* rtld rtld_db_priv */ 51 ulong_t rd_flags; /* flags */ 52 ulong_t rd_rdebugvers; /* rtld_db_priv.vers */ 53 int rd_dmodel; /* data model */ 54 }; 55 56 57 /* 58 * Values for rd_flags 59 */ 60 #define RDF_FL_COREFILE 0x0001 /* client is core file image */ 61 62 63 64 #define RDAGLOCK(x) (void) mutex_lock(&(x->rd_mutex)); 65 #define RDAGUNLOCK(x) (void) mutex_unlock(&(x->rd_mutex)); 66 #define LOG(func) (void) mutex_lock(&glob_mutex); \ 67 if (rtld_db_logging) \ 68 func; \ 69 (void) mutex_unlock(&glob_mutex); 70 71 extern mutex_t glob_mutex; 72 extern int rtld_db_version; 73 extern int rtld_db_logging; 74 75 extern rd_err_e rd_binder_exit_addr(struct rd_agent *, const char *, 76 psaddr_t *); 77 extern rd_err_e _rd_reset32(struct rd_agent *); 78 extern rd_err_e _rd_event_enable32(rd_agent_t *, int); 79 extern rd_err_e _rd_event_getmsg32(rd_agent_t *, rd_event_msg_t *); 80 extern rd_err_e _rd_objpad_enable32(struct rd_agent *, size_t); 81 extern rd_err_e _rd_loadobj_iter32(rd_agent_t *, rl_iter_f *, void *); 82 extern rd_err_e find_dynamic_ent32(struct rd_agent *, psaddr_t, 83 Xword, Elf32_Dyn *); 84 85 extern rd_err_e plt32_resolution(rd_agent_t *, psaddr_t, lwpid_t, 86 psaddr_t, rd_plt_info_t *); 87 #ifdef _LP64 88 extern rd_err_e _rd_reset64(struct rd_agent *); 89 extern rd_err_e _rd_event_enable64(rd_agent_t *, int); 90 extern rd_err_e _rd_event_getmsg64(rd_agent_t *, rd_event_msg_t *); 91 extern rd_err_e _rd_objpad_enable64(struct rd_agent *, size_t); 92 extern rd_err_e _rd_loadobj_iter64(rd_agent_t *, rl_iter_f *, void *); 93 extern rd_err_e find_dynamic_ent64(struct rd_agent *, psaddr_t, 94 Xword, Elf64_Dyn *); 95 extern rd_err_e plt64_resolution(rd_agent_t *, psaddr_t, lwpid_t, 96 psaddr_t, rd_plt_info_t *); 97 #endif 98 99 #ifdef __cplusplus 100 } 101 #endif 102 103 #endif /* __RTLD_DB_H */ 104