Mercurial > hg > graal-jvmci-8
comparison src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @ 1907:1e9a9d2e6509
6970683: improvements to hs_err output
Reviewed-by: kvn, jrose, dholmes, coleenp
author | never |
---|---|
date | Thu, 21 Oct 2010 11:55:10 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
comparison
equal
deleted
inserted
replaced
1906:f8aaf8522a6b | 1907:1e9a9d2e6509 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
198 | 198 |
199 ucontext_t* uc = (ucontext_t*)context; | 199 ucontext_t* uc = (ucontext_t*)context; |
200 sigcontext* sc = (sigcontext*)context; | 200 sigcontext* sc = (sigcontext*)context; |
201 st->print_cr("Registers:"); | 201 st->print_cr("Registers:"); |
202 | 202 |
203 st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT | |
204 " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT, | |
205 SIG_REGS(sc).u_regs[CON_G1], | |
206 SIG_REGS(sc).u_regs[CON_G2], | |
207 SIG_REGS(sc).u_regs[CON_G3], | |
208 SIG_REGS(sc).u_regs[CON_G4]); | |
209 st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT | |
210 " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, | |
211 SIG_REGS(sc).u_regs[CON_G5], | |
212 SIG_REGS(sc).u_regs[CON_G6], | |
213 SIG_REGS(sc).u_regs[CON_G7], | |
214 SIG_REGS(sc).y); | |
203 st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT | 215 st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT |
204 " O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT, | 216 " O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT, |
205 SIG_REGS(sc).u_regs[CON_O0], | 217 SIG_REGS(sc).u_regs[CON_O0], |
206 SIG_REGS(sc).u_regs[CON_O1], | 218 SIG_REGS(sc).u_regs[CON_O1], |
207 SIG_REGS(sc).u_regs[CON_O2], | 219 SIG_REGS(sc).u_regs[CON_O2], |
211 SIG_REGS(sc).u_regs[CON_O4], | 223 SIG_REGS(sc).u_regs[CON_O4], |
212 SIG_REGS(sc).u_regs[CON_O5], | 224 SIG_REGS(sc).u_regs[CON_O5], |
213 SIG_REGS(sc).u_regs[CON_O6], | 225 SIG_REGS(sc).u_regs[CON_O6], |
214 SIG_REGS(sc).u_regs[CON_O7]); | 226 SIG_REGS(sc).u_regs[CON_O7]); |
215 | 227 |
216 st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT | 228 |
217 " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT, | 229 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); |
218 SIG_REGS(sc).u_regs[CON_G1], | 230 st->print_cr(" L0=" INTPTR_FORMAT " L1=" INTPTR_FORMAT |
219 SIG_REGS(sc).u_regs[CON_G2], | 231 " L2=" INTPTR_FORMAT " L3=" INTPTR_FORMAT, |
220 SIG_REGS(sc).u_regs[CON_G3], | 232 sp[L0->sp_offset_in_saved_window()], |
221 SIG_REGS(sc).u_regs[CON_G4]); | 233 sp[L1->sp_offset_in_saved_window()], |
222 st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT | 234 sp[L2->sp_offset_in_saved_window()], |
223 " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, | 235 sp[L3->sp_offset_in_saved_window()]); |
224 SIG_REGS(sc).u_regs[CON_G5], | 236 st->print_cr(" L4=" INTPTR_FORMAT " L5=" INTPTR_FORMAT |
225 SIG_REGS(sc).u_regs[CON_G6], | 237 " L6=" INTPTR_FORMAT " L7=" INTPTR_FORMAT, |
226 SIG_REGS(sc).u_regs[CON_G7], | 238 sp[L4->sp_offset_in_saved_window()], |
227 SIG_REGS(sc).y); | 239 sp[L5->sp_offset_in_saved_window()], |
240 sp[L6->sp_offset_in_saved_window()], | |
241 sp[L7->sp_offset_in_saved_window()]); | |
242 st->print_cr(" I0=" INTPTR_FORMAT " I1=" INTPTR_FORMAT | |
243 " I2=" INTPTR_FORMAT " I3=" INTPTR_FORMAT, | |
244 sp[I0->sp_offset_in_saved_window()], | |
245 sp[I1->sp_offset_in_saved_window()], | |
246 sp[I2->sp_offset_in_saved_window()], | |
247 sp[I3->sp_offset_in_saved_window()]); | |
248 st->print_cr(" I4=" INTPTR_FORMAT " I5=" INTPTR_FORMAT | |
249 " I6=" INTPTR_FORMAT " I7=" INTPTR_FORMAT, | |
250 sp[I4->sp_offset_in_saved_window()], | |
251 sp[I5->sp_offset_in_saved_window()], | |
252 sp[I6->sp_offset_in_saved_window()], | |
253 sp[I7->sp_offset_in_saved_window()]); | |
228 | 254 |
229 st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT, | 255 st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT, |
230 SIG_PC(sc), | 256 SIG_PC(sc), |
231 SIG_NPC(sc)); | 257 SIG_NPC(sc)); |
232 st->cr(); | 258 st->cr(); |
233 st->cr(); | 259 st->cr(); |
234 | 260 |
235 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); | |
236 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); | 261 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); |
237 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); | 262 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); |
238 st->cr(); | 263 st->cr(); |
239 | 264 |
240 // Note: it may be unsafe to inspect memory near pc. For example, pc may | 265 // Note: it may be unsafe to inspect memory near pc. For example, pc may |
241 // point to garbage if entry point in an nmethod is corrupted. Leave | 266 // point to garbage if entry point in an nmethod is corrupted. Leave |
242 // this at the end, and hope for the best. | 267 // this at the end, and hope for the best. |
243 address pc = os::Linux::ucontext_get_pc(uc); | 268 address pc = os::Linux::ucontext_get_pc(uc); |
244 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); | 269 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); |
245 print_hex_dump(st, pc - 16, pc + 16, sizeof(char)); | 270 print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); |
271 } | |
272 | |
273 | |
274 void os::print_register_info(outputStream *st, void *context) { | |
275 if (context == NULL) return; | |
276 | |
277 ucontext_t *uc = (ucontext_t*)context; | |
278 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); | |
279 | |
280 st->print_cr("Register to memory mapping:"); | |
281 st->cr(); | |
282 | |
283 // this is only for the "general purpose" registers | |
284 st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON__G1]); | |
285 st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON__G2]); | |
286 st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON__G3]); | |
287 st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON__G4]); | |
288 st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON__G5]); | |
289 st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON__G6]); | |
290 st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON__G7]); | |
291 st->cr(); | |
292 | |
293 st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON__O0]); | |
294 st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON__O1]); | |
295 st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON__O2]); | |
296 st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON__O3]); | |
297 st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON__O4]); | |
298 st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON__O5]); | |
299 st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON__O6]); | |
300 st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON__O7]); | |
301 st->cr(); | |
302 | |
303 st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]); | |
304 st->print("L1="); print_location(st, sp[L1->sp_offset_in_saved_window()]); | |
305 st->print("L2="); print_location(st, sp[L2->sp_offset_in_saved_window()]); | |
306 st->print("L3="); print_location(st, sp[L3->sp_offset_in_saved_window()]); | |
307 st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]); | |
308 st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]); | |
309 st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]); | |
310 st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]); | |
311 st->cr(); | |
312 | |
313 st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]); | |
314 st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]); | |
315 st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]); | |
316 st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]); | |
317 st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]); | |
318 st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]); | |
319 st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]); | |
320 st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]); | |
321 st->cr(); | |
246 } | 322 } |
247 | 323 |
248 | 324 |
249 address os::Linux::ucontext_get_pc(ucontext_t* uc) { | 325 address os::Linux::ucontext_get_pc(ucontext_t* uc) { |
250 return (address) SIG_PC((sigcontext*)uc); | 326 return (address) SIG_PC((sigcontext*)uc); |