8044071: Print format/argument warnings

Reviewed-by: drchase, dholmes, lfoltan, twisti
This commit is contained in:
Mikael Vidstedt 2014-05-29 16:01:13 -07:00
parent 679712201d
commit fc984ddd84
8 changed files with 31 additions and 29 deletions

View file

@ -135,7 +135,7 @@ void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry)
if (TraceICs) { if (TraceICs) {
ResourceMark rm; ResourceMark rm;
tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
instruction_address(), p2i(instruction_address()),
callee->name_and_sig_as_C_string()); callee->name_and_sig_as_C_string());
} }

View file

@ -557,7 +557,8 @@ void frame::patch_pc(Thread* thread, address pc) {
// QQQ this assert is invalid (or too strong anyway) sice _pc could // QQQ this assert is invalid (or too strong anyway) sice _pc could
// be original pc and frame could have the deopt pc. // be original pc and frame could have the deopt pc.
// assert(_pc == *O7_addr() + pc_return_offset, "frame has wrong pc"); // assert(_pc == *O7_addr() + pc_return_offset, "frame has wrong pc");
tty->print_cr("patch_pc at address 0x%x [0x%x -> 0x%x] ", O7_addr(), _pc, pc); tty->print_cr("patch_pc at address " INTPTR_FORMAT " [" INTPTR_FORMAT " -> " INTPTR_FORMAT "]",
p2i(O7_addr()), p2i(_pc), p2i(pc));
} }
_cb = CodeCache::find_blob(pc); _cb = CodeCache::find_blob(pc);
*O7_addr() = pc - pc_return_offset; *O7_addr() = pc - pc_return_offset;

View file

@ -1202,7 +1202,7 @@ void RegistersForDebugging::print(outputStream* s) {
if ( j != last ) s->print(" - f%d", last); if ( j != last ) s->print(" - f%d", last);
s->print(" = %f", val); s->print(" = %f", val);
s->fill_to(25); s->fill_to(25);
s->print_cr(" (0x%x)", val); s->print_cr(" (0x%x)", *(int*)&val);
j = last + 1; j = last + 1;
} }
s->cr(); s->cr();

View file

@ -78,7 +78,7 @@ void NativeInstruction::verify() {
} }
void NativeInstruction::print() { void NativeInstruction::print() {
tty->print_cr(INTPTR_FORMAT ": 0x%x", addr_at(0), long_at(0)); tty->print_cr(INTPTR_FORMAT ": 0x%x", p2i(addr_at(0)), long_at(0));
} }
void NativeInstruction::set_long_at(int offset, int i) { void NativeInstruction::set_long_at(int offset, int i) {
@ -142,7 +142,7 @@ void NativeCall::verify() {
} }
void NativeCall::print() { void NativeCall::print() {
tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, instruction_address(), destination()); tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, p2i(instruction_address()), p2i(destination()));
} }
@ -271,7 +271,7 @@ bool NativeFarCall::is_call_at(address instr) {
} }
void NativeFarCall::print() { void NativeFarCall::print() {
tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, instruction_address(), destination()); tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, p2i(instruction_address()), p2i(destination()));
} }
bool NativeFarCall::destination_is_compiled_verified_entry_point() { bool NativeFarCall::destination_is_compiled_verified_entry_point() {
@ -324,7 +324,7 @@ void NativeMovConstReg::verify() {
void NativeMovConstReg::print() { void NativeMovConstReg::print() {
tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data()); tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, p2i(instruction_address()), data());
} }
@ -446,7 +446,7 @@ void NativeMovConstRegPatching::verify() {
void NativeMovConstRegPatching::print() { void NativeMovConstRegPatching::print() {
tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data()); tty->print_cr(INTPTR_FORMAT ": mov reg, 0x%x", p2i(instruction_address()), data());
} }
@ -585,9 +585,10 @@ void NativeMovRegMem::verify() {
void NativeMovRegMem::print() { void NativeMovRegMem::print() {
if (is_immediate()) { if (is_immediate()) {
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %x]", instruction_address(), offset()); // offset is a signed 13-bit immediate, so casting it to int will not lose significant bits
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %d]", p2i(instruction_address()), (int)offset());
} else { } else {
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", instruction_address()); tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", p2i(instruction_address()));
} }
} }
@ -730,9 +731,9 @@ void NativeMovRegMemPatching::verify() {
void NativeMovRegMemPatching::print() { void NativeMovRegMemPatching::print() {
if (is_immediate()) { if (is_immediate()) {
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %x]", instruction_address(), offset()); tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %d]", p2i(instruction_address()), offset());
} else { } else {
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", instruction_address()); tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", p2i(instruction_address()));
} }
} }
@ -863,7 +864,7 @@ void NativeJump::verify() {
void NativeJump::print() { void NativeJump::print() {
tty->print_cr(INTPTR_FORMAT ": jmpl reg, " INTPTR_FORMAT, instruction_address(), jump_destination()); tty->print_cr(INTPTR_FORMAT ": jmpl reg, " INTPTR_FORMAT, p2i(instruction_address()), p2i(jump_destination()));
} }

View file

@ -1722,15 +1722,15 @@ void AbstractInterpreter::layout_activation(Method* method,
if (caller->is_interpreted_frame()) { if (caller->is_interpreted_frame()) {
tty->print("interpreted "); tty->print("interpreted ");
} }
tty->print_cr("caller fp=0x%x sp=0x%x", caller->fp(), caller->sp()); tty->print_cr("caller fp=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, p2i(caller->fp()), p2i(caller->sp()));
tty->print_cr("save area = 0x%x, 0x%x", caller->sp(), caller->sp() + 16); tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(caller->sp()), p2i(caller->sp() + 16));
tty->print_cr("save area = 0x%x, 0x%x", caller->fp(), caller->fp() + 16); tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(caller->fp()), p2i(caller->fp() + 16));
tty->print_cr("interpreter fp=0x%x sp=0x%x", interpreter_frame->fp(), interpreter_frame->sp()); tty->print_cr("interpreter fp=" INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->fp()), p2i(interpreter_frame->sp()));
tty->print_cr("save area = 0x%x, 0x%x", interpreter_frame->sp(), interpreter_frame->sp() + 16); tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->sp()), p2i(interpreter_frame->sp() + 16));
tty->print_cr("save area = 0x%x, 0x%x", interpreter_frame->fp(), interpreter_frame->fp() + 16); tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->fp()), p2i(interpreter_frame->fp() + 16));
tty->print_cr("Llocals = 0x%x", locals); tty->print_cr("Llocals = " INTPTR_FORMAT, p2i(locals));
tty->print_cr("Lesp = 0x%x", esp); tty->print_cr("Lesp = " INTPTR_FORMAT, p2i(esp));
tty->print_cr("Lmonitors = 0x%x", monitors); tty->print_cr("Lmonitors = " INTPTR_FORMAT, p2i(monitors));
} }
if (method->max_locals() > 0) { if (method->max_locals() > 0) {

View file

@ -111,7 +111,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
if (PrintMiscellaneous && (WizardMode || Verbose)) { if (PrintMiscellaneous && (WizardMode || Verbose)) {
tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d", tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
vtable_index, s->entry_point(), vtable_index, p2i(s->entry_point()),
(int)(s->code_end() - s->entry_point()), (int)(s->code_end() - s->entry_point()),
(int)(s->code_end() - __ pc())); (int)(s->code_end() - __ pc()));
} }
@ -206,7 +206,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
if (PrintMiscellaneous && (WizardMode || Verbose)) { if (PrintMiscellaneous && (WizardMode || Verbose)) {
tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d", tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
itable_index, s->entry_point(), itable_index, p2i(s->entry_point()),
(int)(s->code_end() - s->entry_point()), (int)(s->code_end() - s->entry_point()),
(int)(s->code_end() - __ pc())); (int)(s->code_end() - __ pc()));
} }

View file

@ -234,7 +234,7 @@ void os::print_context(outputStream *st, void *context) {
SIG_REGS(sc).u_regs[CON_G3], SIG_REGS(sc).u_regs[CON_G3],
SIG_REGS(sc).u_regs[CON_G4]); SIG_REGS(sc).u_regs[CON_G4]);
st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT
" G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, " G7=" INTPTR_FORMAT " Y=0x%x",
SIG_REGS(sc).u_regs[CON_G5], SIG_REGS(sc).u_regs[CON_G5],
SIG_REGS(sc).u_regs[CON_G6], SIG_REGS(sc).u_regs[CON_G6],
SIG_REGS(sc).u_regs[CON_G7], SIG_REGS(sc).u_regs[CON_G7],
@ -285,7 +285,7 @@ void os::print_context(outputStream *st, void *context) {
st->cr(); st->cr();
st->cr(); st->cr();
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); st->print_cr("Top of Stack: (sp=" INTPTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
st->cr(); st->cr();
@ -293,7 +293,7 @@ void os::print_context(outputStream *st, void *context) {
// point to garbage if entry point in an nmethod is corrupted. Leave // point to garbage if entry point in an nmethod is corrupted. Leave
// this at the end, and hope for the best. // this at the end, and hope for the best.
address pc = os::Linux::ucontext_get_pc(uc); address pc = os::Linux::ucontext_get_pc(uc);
st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); st->print_cr("Instructions: (pc=" INTPTR_FORMAT ")", p2i(pc));
print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
} }
@ -453,7 +453,7 @@ inline static bool checkVerifyOops(address pc, address fault, address* stub) {
&& pc < MacroAssembler::_verify_oop_implicit_branch[1] ) { && pc < MacroAssembler::_verify_oop_implicit_branch[1] ) {
*stub = MacroAssembler::_verify_oop_implicit_branch[2]; *stub = MacroAssembler::_verify_oop_implicit_branch[2];
warning("fixed up memory fault in +VerifyOops at address " warning("fixed up memory fault in +VerifyOops at address "
INTPTR_FORMAT, fault); INTPTR_FORMAT, p2i(fault));
return true; return true;
} }
return false; return false;

View file

@ -36,7 +36,7 @@ static bool detect_niagara() {
} }
while (!feof(fp)) { while (!feof(fp)) {
if (fscanf(fp, "cpu\t\t: %100[^\n]", &cpu) == 1) { if (fscanf(fp, "cpu\t\t: %100[^\n]", cpu) == 1) {
if (strstr(cpu, "Niagara") != NULL) { if (strstr(cpu, "Niagara") != NULL) {
rv = true; rv = true;
} }