0
|
1 /*
|
|
2 * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 *
|
|
5 * This code is free software; you can redistribute it and/or modify it
|
|
6 * under the terms of the GNU General Public License version 2 only, as
|
|
7 * published by the Free Software Foundation.
|
|
8 *
|
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 * version 2 for more details (a copy is included in the LICENSE file that
|
|
13 * accompanied this code).
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License version
|
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 *
|
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 * have any questions.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 #ifndef _PROC_SERVICE_2_H
|
|
26 #define _PROC_SERVICE_2_H
|
|
27
|
|
28 /*
|
|
29 * Types, function definitions for the provider of services beyond
|
|
30 * proc_service. This interface will be used by import modules like
|
|
31 * BAT/prex, NEO debugger etc.
|
|
32 */
|
|
33
|
|
34 /*
|
|
35 CCR info
|
|
36
|
|
37 Version history:
|
|
38
|
|
39 1.0 - Initial CCR release
|
|
40
|
|
41 1.1 - Changes for GLUE/neo.
|
|
42 New entry points ps_svnt_generic() and ps_svc_generic()
|
|
43 - New entry point ps_getpid()
|
|
44
|
|
45 Release information for automatic CCR updates:
|
|
46 BEGIN RELEASE NOTES: (signifies what gets put into CCR release notes)
|
|
47 1.2 - Changes to support Solaris 2.7
|
|
48
|
|
49 END RELEASE NOTES: (signifies what gets put into CCR release notes)
|
|
50
|
|
51 Following is used for CCR version number:
|
|
52
|
|
53 #define CCR_PROC_SERVICE_2_VERSION 1.2
|
|
54
|
|
55 */
|
|
56
|
|
57
|
|
58 #include <proc_service.h>
|
|
59 #include <sys/types.h>
|
|
60
|
|
61 #ifdef __cplusplus
|
|
62 extern "C" {
|
|
63 #endif
|
|
64
|
|
65 struct ps_loadobj {
|
|
66 int objfd; /* fd of the load object or executable
|
|
67 * -1 implies its not available.
|
|
68 * This file decriptor is live only during the
|
|
69 * particular call to ps_iter_f(). If you
|
|
70 * need it beyond that you need to dup() it.
|
|
71 */
|
|
72 psaddr_t
|
|
73 text_base; /* address where text of loadobj was mapped */
|
|
74 psaddr_t
|
|
75 data_base; /* address where data of loadobj was mapped */
|
|
76 const char *objname; /* loadobj name */
|
|
77 };
|
|
78
|
|
79 typedef int ps_iter_f(const struct ps_prochandle *, const struct ps_loadobj *,
|
|
80 void *cd);
|
|
81
|
|
82 /*
|
|
83 * Returns the ps_prochandle for the current process under focus. Returns
|
|
84 * NULL if there is none.
|
|
85 */
|
|
86
|
|
87 const struct ps_prochandle *
|
|
88 ps_get_prochandle(void);
|
|
89
|
|
90 /*
|
|
91 * Returns the ps_prochandle for the current process(allows core files to
|
|
92 * be specified) under focus. Returns NULL if there is none.
|
|
93 */
|
|
94 const struct ps_prochandle *
|
|
95 ps_get_prochandle2(int cores_too);
|
|
96
|
|
97 /*
|
|
98 * Returns the pid of the process referred to by the ps_prochandle.
|
|
99 *
|
|
100 * 0 is returned in case the ps_prochandle is not valid or refers to dead
|
|
101 * process.
|
|
102 *
|
|
103 */
|
|
104 pid_t
|
|
105 ps_getpid(const struct ps_prochandle *);
|
|
106
|
|
107 /*
|
|
108 * Iteration function that iterates over all load objects *and the
|
|
109 * executable*
|
|
110 *
|
|
111 * If the callback routine returns:
|
|
112 * 0 - continue processing link objects
|
|
113 * non zero - stop calling the callback function
|
|
114 *
|
|
115 */
|
|
116
|
|
117 ps_err_e
|
|
118 ps_loadobj_iter(const struct ps_prochandle *, ps_iter_f *, void *clnt_data);
|
|
119
|
|
120 /*
|
|
121 * Address => function name mapping
|
|
122 *
|
|
123 * Given an address, returns a pointer to the function's
|
|
124 * linker name (null terminated).
|
|
125 */
|
|
126
|
|
127 ps_err_e
|
|
128 ps_find_fun_name(const struct ps_prochandle *, psaddr_t addr,
|
|
129 const char **name);
|
|
130
|
|
131 /*
|
|
132 * Interface to LD_PRELOAD. LD_PRELOAD given library across the
|
|
133 * program 'exec'.
|
|
134 *
|
|
135 */
|
|
136
|
|
137 /*
|
|
138 * Append/Prepend the 'lib' (has to be library name as understood by LD_PRELOAD)
|
|
139 * to the LD_PRELOAD variable setting to be used by the debugee
|
|
140 * Returns a cookie (in id).
|
|
141 */
|
|
142 ps_err_e
|
|
143 ps_ld_preload_append(const char *lib, int *id);
|
|
144 ps_err_e
|
|
145 ps_ld_preload_prepend(const char *lib, int *id);
|
|
146
|
|
147 /*
|
|
148 * Remove the library associated with 'id' from the LD_PRELOAD setting.
|
|
149 *
|
|
150 */
|
|
151 ps_err_e
|
|
152 ps_ld_preload_remove(int id);
|
|
153
|
|
154 #ifdef __cplusplus
|
|
155 }
|
|
156 #endif
|
|
157
|
|
158 /*
|
|
159 * The following are C++ only interfaces
|
|
160 */
|
|
161 #ifdef __cplusplus
|
|
162
|
|
163 /*
|
|
164 * classes ServiceDbx and ServantDbx and defined in "gp_dbx_svc.h" which is
|
|
165 * accessed via CCR
|
|
166 */
|
|
167 extern class ServantDbx *ps_svnt_generic();
|
|
168 extern class ServiceDbx *ps_svc_generic();
|
|
169
|
|
170 #endif
|
|
171
|
|
172 #endif /* _PROC_SERVICE_2_H */
|