0
|
1 /*
|
|
2 * Copyright 2003-2006 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 /* This file is auto-generated */
|
|
26 #include "JvmOffsetsIndex.h"
|
|
27
|
|
28 #define DEBUG
|
|
29
|
|
30 #ifdef DEBUG
|
|
31 #define MARK_LINE this->line = __LINE__
|
|
32 #else
|
|
33 #define MARK_LINE
|
|
34 #endif
|
|
35
|
|
36 #ifdef _LP64
|
|
37 #define STACK_BIAS 0x7ff
|
|
38 #define pointer uint64_t
|
|
39 #else
|
|
40 #define STACK_BIAS 0
|
|
41 #define pointer uint32_t
|
|
42 #endif
|
|
43
|
|
44 extern pointer __JvmOffsets;
|
|
45
|
|
46 extern pointer __1cJCodeCacheF_heap_;
|
|
47 extern pointer __1cIUniverseP_methodKlassObj_;
|
|
48 extern pointer __1cIUniverseO_collectedHeap_;
|
|
49
|
|
50 extern pointer __1cHnmethodG__vtbl_;
|
|
51 extern pointer __1cKBufferBlobG__vtbl_;
|
|
52
|
|
53 #define copyin_ptr(ADDR) *(pointer*) copyin((pointer) (ADDR), sizeof(pointer))
|
|
54 #define copyin_uchar(ADDR) *(uchar_t*) copyin((pointer) (ADDR), sizeof(uchar_t))
|
|
55 #define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t))
|
|
56 #define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t))
|
|
57 #define copyin_int32(ADDR) *(int32_t*) copyin((pointer) (ADDR), sizeof(int32_t))
|
|
58
|
|
59 #define SAME(x) x
|
|
60 #define copyin_offset(JVM_CONST) JVM_CONST = \
|
|
61 copyin_int32(JvmOffsetsPtr + SAME(IDX_)JVM_CONST * sizeof(int32_t))
|
|
62
|
|
63 int init_done;
|
|
64
|
|
65 dtrace:helper:ustack:
|
|
66 {
|
|
67 MARK_LINE;
|
|
68 this->done = 0;
|
|
69 /*
|
|
70 * TBD:
|
|
71 * Here we initialize init_done, otherwise jhelper does not work.
|
|
72 * Therefore, copyin_offset() statements work multiple times now.
|
|
73 * There is a hope we could avoid it in the future, and so,
|
|
74 * this initialization can be removed.
|
|
75 */
|
|
76 init_done = 0;
|
|
77 this->error = (char *) NULL;
|
|
78 this->result = (char *) NULL;
|
|
79 this->methodOop = 0;
|
|
80 this->codecache = 0;
|
|
81 this->klass = (pointer) NULL;
|
|
82 this->vtbl = (pointer) NULL;
|
|
83 this->suffix = '\0';
|
|
84 }
|
|
85
|
|
86 dtrace:helper:ustack:
|
|
87 {
|
|
88 MARK_LINE;
|
|
89 /* Initialization of JvmOffsets constants */
|
|
90 JvmOffsetsPtr = (pointer) &``__JvmOffsets;
|
|
91 }
|
|
92
|
|
93 dtrace:helper:ustack:
|
|
94 /!init_done && !this->done/
|
|
95 {
|
|
96 MARK_LINE;
|
|
97 init_done = 1;
|
|
98
|
|
99 copyin_offset(COMPILER);
|
|
100 copyin_offset(OFFSET_CollectedHeap_reserved);
|
|
101 copyin_offset(OFFSET_MemRegion_start);
|
|
102 copyin_offset(OFFSET_MemRegion_word_size);
|
|
103 copyin_offset(SIZE_HeapWord);
|
|
104
|
|
105 copyin_offset(OFFSET_interpreter_frame_method);
|
|
106 copyin_offset(OFFSET_Klass_name);
|
|
107 copyin_offset(OFFSET_constantPoolOopDesc_pool_holder);
|
|
108
|
|
109 copyin_offset(OFFSET_HeapBlockHeader_used);
|
|
110 copyin_offset(OFFSET_oopDesc_klass);
|
|
111
|
|
112 copyin_offset(OFFSET_symbolOopDesc_length);
|
|
113 copyin_offset(OFFSET_symbolOopDesc_body);
|
|
114
|
|
115 copyin_offset(OFFSET_methodOopDesc_constMethod);
|
|
116 copyin_offset(OFFSET_methodOopDesc_constants);
|
|
117 copyin_offset(OFFSET_constMethodOopDesc_name_index);
|
|
118 copyin_offset(OFFSET_constMethodOopDesc_signature_index);
|
|
119
|
|
120 copyin_offset(OFFSET_CodeHeap_memory);
|
|
121 copyin_offset(OFFSET_CodeHeap_segmap);
|
|
122 copyin_offset(OFFSET_CodeHeap_log2_segment_size);
|
|
123
|
|
124 copyin_offset(OFFSET_VirtualSpace_low);
|
|
125 copyin_offset(OFFSET_VirtualSpace_high);
|
|
126
|
|
127 copyin_offset(OFFSET_CodeBlob_name);
|
|
128
|
|
129 copyin_offset(OFFSET_nmethod_method);
|
|
130 copyin_offset(SIZE_HeapBlockHeader);
|
|
131 copyin_offset(SIZE_oopDesc);
|
|
132 copyin_offset(SIZE_constantPoolOopDesc);
|
|
133
|
|
134 /*
|
|
135 * The PC to translate is in arg0.
|
|
136 */
|
|
137 this->pc = arg0;
|
|
138
|
|
139 /*
|
|
140 * The methodOopPtr is in %l2 on SPARC. This can be found at
|
|
141 * offset 8 from the frame pointer on 32-bit processes.
|
|
142 */
|
|
143 #if defined(__sparc)
|
|
144 this->methodOopPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
|
|
145 #elif defined(__i386) || defined(__amd64)
|
|
146 this->methodOopPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
|
|
147 #else
|
|
148 #error "Don't know architecture"
|
|
149 #endif
|
|
150
|
|
151 this->Universe_methodKlassOop = copyin_ptr(&``__1cIUniverseP_methodKlassObj_);
|
|
152 this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);
|
|
153
|
|
154 /* Reading volatile values */
|
|
155 this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address +
|
|
156 OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
|
|
157
|
|
158 this->CodeCache_high = copyin_ptr(this->CodeCache_heap_address +
|
|
159 OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
|
|
160
|
|
161 this->CodeCache_segmap_low = copyin_ptr(this->CodeCache_heap_address +
|
|
162 OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
|
|
163
|
|
164 this->CodeCache_segmap_high = copyin_ptr(this->CodeCache_heap_address +
|
|
165 OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high);
|
|
166
|
|
167 this->CodeHeap_log2_segment_size = copyin_uint32(
|
|
168 this->CodeCache_heap_address + OFFSET_CodeHeap_log2_segment_size);
|
|
169
|
|
170 /*
|
|
171 * Get Java heap bounds
|
|
172 */
|
|
173 this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
|
|
174 this->heap_start = copyin_ptr(this->Universe_collectedHeap +
|
|
175 OFFSET_CollectedHeap_reserved +
|
|
176 OFFSET_MemRegion_start);
|
|
177 this->heap_size = SIZE_HeapWord *
|
|
178 copyin_ptr(this->Universe_collectedHeap +
|
|
179 OFFSET_CollectedHeap_reserved +
|
|
180 OFFSET_MemRegion_word_size
|
|
181 );
|
|
182 this->heap_end = this->heap_start + this->heap_size;
|
|
183 }
|
|
184
|
|
185 dtrace:helper:ustack:
|
|
186 /!this->done &&
|
|
187 this->CodeCache_low <= this->pc && this->pc < this->CodeCache_high/
|
|
188 {
|
|
189 MARK_LINE;
|
|
190 this->codecache = 1;
|
|
191
|
|
192 /*
|
|
193 * Find start.
|
|
194 */
|
|
195 this->segment = (this->pc - this->CodeCache_low) >>
|
|
196 this->CodeHeap_log2_segment_size;
|
|
197 this->block = this->CodeCache_segmap_low;
|
|
198 this->tag = copyin_uchar(this->block + this->segment);
|
|
199 "second";
|
|
200 }
|
|
201
|
|
202 dtrace:helper:ustack:
|
|
203 /!this->done && this->codecache && this->tag > 0/
|
|
204 {
|
|
205 MARK_LINE;
|
|
206 this->tag = copyin_uchar(this->block + this->segment);
|
|
207 this->segment = this->segment - this->tag;
|
|
208 }
|
|
209
|
|
210 dtrace:helper:ustack:
|
|
211 /!this->done && this->codecache && this->tag > 0/
|
|
212 {
|
|
213 MARK_LINE;
|
|
214 this->tag = copyin_uchar(this->block + this->segment);
|
|
215 this->segment = this->segment - this->tag;
|
|
216 }
|
|
217
|
|
218 dtrace:helper:ustack:
|
|
219 /!this->done && this->codecache && this->tag > 0/
|
|
220 {
|
|
221 MARK_LINE;
|
|
222 this->tag = copyin_uchar(this->block + this->segment);
|
|
223 this->segment = this->segment - this->tag;
|
|
224 }
|
|
225
|
|
226 dtrace:helper:ustack:
|
|
227 /!this->done && this->codecache && this->tag > 0/
|
|
228 {
|
|
229 MARK_LINE;
|
|
230 this->tag = copyin_uchar(this->block + this->segment);
|
|
231 this->segment = this->segment - this->tag;
|
|
232 }
|
|
233
|
|
234 dtrace:helper:ustack:
|
|
235 /!this->done && this->codecache && this->tag > 0/
|
|
236 {
|
|
237 MARK_LINE;
|
|
238 this->tag = copyin_uchar(this->block + this->segment);
|
|
239 this->segment = this->segment - this->tag;
|
|
240 }
|
|
241
|
|
242 dtrace:helper:ustack:
|
|
243 /!this->done && this->codecache && this->tag > 0/
|
|
244 {
|
|
245 MARK_LINE;
|
|
246 this->error = "<couldn't find start>";
|
|
247 this->done = 1;
|
|
248 }
|
|
249
|
|
250 dtrace:helper:ustack:
|
|
251 /!this->done && this->codecache/
|
|
252 {
|
|
253 MARK_LINE;
|
|
254 this->block = this->CodeCache_low +
|
|
255 (this->segment << this->CodeHeap_log2_segment_size);
|
|
256 this->used = copyin_uint32(this->block + OFFSET_HeapBlockHeader_used);
|
|
257 }
|
|
258
|
|
259 dtrace:helper:ustack:
|
|
260 /!this->done && this->codecache && !this->used/
|
|
261 {
|
|
262 MARK_LINE;
|
|
263 this->error = "<block not in use>";
|
|
264 this->done = 1;
|
|
265 }
|
|
266
|
|
267 dtrace:helper:ustack:
|
|
268 /!this->done && this->codecache/
|
|
269 {
|
|
270 MARK_LINE;
|
|
271 this->start = this->block + SIZE_HeapBlockHeader;
|
|
272 this->vtbl = copyin_ptr(this->start);
|
|
273
|
|
274 this->nmethod_vtbl = (pointer) &``__1cHnmethodG__vtbl_;
|
|
275 this->BufferBlob_vtbl = (pointer) &``__1cKBufferBlobG__vtbl_;
|
|
276 }
|
|
277
|
|
278 dtrace:helper:ustack:
|
|
279 /!this->done && this->vtbl == this->nmethod_vtbl/
|
|
280 {
|
|
281 MARK_LINE;
|
|
282 this->methodOopPtr = copyin_ptr(this->start + OFFSET_nmethod_method);
|
|
283 this->suffix = '*';
|
|
284 this->methodOop = 1;
|
|
285 }
|
|
286
|
|
287 dtrace:helper:ustack:
|
|
288 /!this->done && this->vtbl == this->BufferBlob_vtbl/
|
|
289 {
|
|
290 MARK_LINE;
|
|
291 this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
|
|
292 }
|
|
293
|
|
294 dtrace:helper:ustack:
|
|
295 /!this->done && this->vtbl == this->BufferBlob_vtbl &&
|
|
296 this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
|
|
297 {
|
|
298 MARK_LINE;
|
|
299 this->klass = copyin_ptr(this->methodOopPtr + OFFSET_oopDesc_klass);
|
|
300 this->methodOop = this->klass == this->Universe_methodKlassOop;
|
|
301 this->done = !this->methodOop;
|
|
302 }
|
|
303
|
|
304 dtrace:helper:ustack:
|
|
305 /!this->done && !this->methodOop/
|
|
306 {
|
|
307 MARK_LINE;
|
|
308 this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
|
|
309 this->result = this->name != 0 ? copyinstr(this->name) : "<CodeBlob>";
|
|
310 this->done = 1;
|
|
311 }
|
|
312
|
|
313 dtrace:helper:ustack:
|
|
314 /!this->done && this->methodOop/
|
|
315 {
|
|
316 MARK_LINE;
|
|
317 this->constMethod = copyin_ptr(this->methodOopPtr +
|
|
318 OFFSET_methodOopDesc_constMethod);
|
|
319
|
|
320 this->nameIndex = copyin_uint16(this->constMethod +
|
|
321 OFFSET_constMethodOopDesc_name_index);
|
|
322
|
|
323 this->signatureIndex = copyin_uint16(this->constMethod +
|
|
324 OFFSET_constMethodOopDesc_signature_index);
|
|
325
|
|
326 this->constantPool = copyin_ptr(this->methodOopPtr +
|
|
327 OFFSET_methodOopDesc_constants);
|
|
328
|
|
329 this->nameSymbol = copyin_ptr(this->constantPool +
|
|
330 this->nameIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
|
|
331
|
|
332 this->nameSymbolLength = copyin_uint16(this->nameSymbol +
|
|
333 OFFSET_symbolOopDesc_length);
|
|
334
|
|
335 this->signatureSymbol = copyin_ptr(this->constantPool +
|
|
336 this->signatureIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
|
|
337
|
|
338 this->signatureSymbolLength = copyin_uint16(this->signatureSymbol +
|
|
339 OFFSET_symbolOopDesc_length);
|
|
340
|
|
341 this->klassPtr = copyin_ptr(this->constantPool +
|
|
342 OFFSET_constantPoolOopDesc_pool_holder);
|
|
343
|
|
344 this->klassSymbol = copyin_ptr(this->klassPtr +
|
|
345 OFFSET_Klass_name + SIZE_oopDesc);
|
|
346
|
|
347 this->klassSymbolLength = copyin_uint16(this->klassSymbol +
|
|
348 OFFSET_symbolOopDesc_length);
|
|
349
|
|
350 /*
|
|
351 * Enough for three strings, plus the '.', plus the trailing '\0'.
|
|
352 */
|
|
353 this->result = (char *) alloca(this->klassSymbolLength +
|
|
354 this->nameSymbolLength +
|
|
355 this->signatureSymbolLength + 2 + 1);
|
|
356
|
|
357 copyinto(this->klassSymbol + OFFSET_symbolOopDesc_body,
|
|
358 this->klassSymbolLength, this->result);
|
|
359
|
|
360 /*
|
|
361 * Add the '.' between the class and the name.
|
|
362 */
|
|
363 this->result[this->klassSymbolLength] = '.';
|
|
364
|
|
365 copyinto(this->nameSymbol + OFFSET_symbolOopDesc_body,
|
|
366 this->nameSymbolLength,
|
|
367 this->result + this->klassSymbolLength + 1);
|
|
368
|
|
369 copyinto(this->signatureSymbol + OFFSET_symbolOopDesc_body,
|
|
370 this->signatureSymbolLength,
|
|
371 this->result + this->klassSymbolLength +
|
|
372 this->nameSymbolLength + 1);
|
|
373
|
|
374 /*
|
|
375 * Now we need to add a trailing '\0' and possibly a tag character.
|
|
376 */
|
|
377 this->result[this->klassSymbolLength + 1 +
|
|
378 this->nameSymbolLength +
|
|
379 this->signatureSymbolLength] = this->suffix;
|
|
380 this->result[this->klassSymbolLength + 2 +
|
|
381 this->nameSymbolLength +
|
|
382 this->signatureSymbolLength] = '\0';
|
|
383
|
|
384 this->done = 1;
|
|
385 }
|
|
386
|
|
387 dtrace:helper:ustack:
|
|
388 /this->done && this->error == (char *) NULL/
|
|
389 {
|
|
390 this->result;
|
|
391 }
|
|
392
|
|
393 dtrace:helper:ustack:
|
|
394 /this->done && this->error != (char *) NULL/
|
|
395 {
|
|
396 this->error;
|
|
397 }
|
|
398
|
|
399 dtrace:helper:ustack:
|
|
400 /!this->done && this->codecache/
|
|
401 {
|
|
402 this->done = 1;
|
|
403 "error";
|
|
404 }
|
|
405
|
|
406
|
|
407 dtrace:helper:ustack:
|
|
408 /!this->done/
|
|
409 {
|
|
410 NULL;
|
|
411 }
|