From: Florian Krohm Date: Wed, 5 Aug 2015 22:27:24 +0000 (+0000) Subject: Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. X-Git-Tag: svn/VALGRIND_3_11_0~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01ea732633f6630e660580bc2968016038d001bf;p=thirdparty%2Fvalgrind.git Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15500 --- diff --git a/coregrind/m_debuginfo/d3basics.c b/coregrind/m_debuginfo/d3basics.c index 9a6051afdc..f26d1c5c91 100644 --- a/coregrind/m_debuginfo/d3basics.c +++ b/coregrind/m_debuginfo/d3basics.c @@ -974,8 +974,8 @@ GXResult ML_(evaluate_GX)( const GExpr* gx, const GExpr* fbGX, aMax = ML_(read_Addr)(p); p += sizeof(Addr); nbytes = ML_(read_UShort)(p); p += sizeof(UShort); nGuards++; - if (0) VG_(printf)(" guard %d: %#lx %#lx\n", - (Int)nGuards, aMin,aMax); + if (0) VG_(printf)(" guard %lu: %#lx %#lx\n", + nGuards, aMin,aMax); if (regs == NULL) { vg_assert(aMin == (Addr)0); vg_assert(aMax == ~(Addr)0); diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 21a2bb7ff6..324a96d53a 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -621,9 +621,9 @@ static void show_DebugInfoMappings n = VG_(sizeXA)(maps); for (i = 0; i < n; i++) { const DebugInfoMapping* map = VG_(indexXA)(maps, i); - TRACE_SYMTAB(" [%ld] avma 0x%-16llx size %-8lu " - "foff %-8lld %s %s %s\n", - i, (ULong)map->avma, map->size, (Long)map->foff, + TRACE_SYMTAB(" [%ld] avma 0x%-16lx size %-8lu " + "foff %-8ld %s %s %s\n", + i, map->avma, map->size, map->foff, map->rx ? "rx" : "--", map->rw ? "rw" : "--", map->ro ? "ro" : "--"); @@ -1222,7 +1222,7 @@ void VG_(di_notify_pdb_debuginfo)( Int fd_obj, Addr avma_obj, VG_(message)(Vg_UserMsg, "LOAD_PDB_DEBUGINFO: clreq: fd=%d, avma=%#lx, total_size=%lu, " "bias=%#lx\n", - fd_obj, avma_obj, total_size, bias_obj + fd_obj, avma_obj, total_size, (UWord)bias_obj ); } @@ -2302,7 +2302,7 @@ const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor *iipc) /* Print in XML format, dumping in as much info as we know. Ensure all tags are balanced. */ APPEND(""); - VG_(sprintf)(ibuf,"0x%llX", (ULong)eip); + VG_(sprintf)(ibuf,"0x%lX", eip); APPEND(maybe_newline); APPEND(ibuf); if (know_objname) { @@ -2330,7 +2330,7 @@ const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor *iipc) APPEND(""); APPEND(maybe_newline); APPEND(""); - VG_(sprintf)(ibuf,"%d",lineno); + VG_(sprintf)(ibuf,"%u",lineno); APPEND(ibuf); APPEND(""); } @@ -2350,7 +2350,7 @@ const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor *iipc) // 0x80483BF: ??? (a.c:20) // 0x80483BF: ??? // - VG_(sprintf)(ibuf,"0x%llX: ", (ULong)eip); + VG_(sprintf)(ibuf,"0x%lX: ", eip); APPEND(ibuf); if (know_fnname) { APPEND(buf_fn); @@ -2388,7 +2388,7 @@ const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor *iipc) } APPEND(buf_srcloc); APPEND(":"); - VG_(sprintf)(ibuf,"%d",lineno); + VG_(sprintf)(ibuf,"%u",lineno); APPEND(ibuf); APPEND(")"); } else if (know_objname) { @@ -3042,10 +3042,10 @@ Bool VG_(use_FPO_info) ( /*MOD*/Addr* ipP, Word j; if (0) { /* debug printing only */ - VG_(printf)("look for %#lx size %ld i %ld\n", + VG_(printf)("look for %#lx size %lu i %ld\n", *ipP, di->fpo_size, i); for (j = 0; j < di->fpo_size; j++) - VG_(printf)("[%02ld] %#x %d\n", + VG_(printf)("[%02ld] %#x %u\n", j, di->fpo[j].ulOffStart, di->fpo[j].cbProcSize); } vg_assert(i >= 0 && i < di->fpo_size); @@ -3296,19 +3296,19 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, if (xml) { TAGL( dn1 ); p2XA( dn1, - "Location 0x%lx is %lu byte%s inside local var \"%pS\",", + "Location 0x%lx is %ld byte%s inside local var \"%pS\",", data_addr, var_offset, vo_plural, var->name ); TAGR( dn1 ); TAGL( dn2 ); p2XA( dn2, - "in frame #%d of thread %d", frameNo, (Int)tid ); + "in frame #%d of thread %u", frameNo, tid ); TAGR( dn2 ); } else { p2XA( dn1, - "Location 0x%lx is %lu byte%s inside local var \"%s\",", + "Location 0x%lx is %ld byte%s inside local var \"%s\",", data_addr, var_offset, vo_plural, var->name ); p2XA( dn2, - "in frame #%d of thread %d", frameNo, (Int)tid ); + "in frame #%d of thread %u", frameNo, tid ); } } else @@ -3320,14 +3320,14 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, if (xml) { TAGL( dn1 ); p2XA( dn1, - "Location 0x%lx is %lu byte%s inside local var \"%pS\"", + "Location 0x%lx is %ld byte%s inside local var \"%pS\"", data_addr, var_offset, vo_plural, var->name ); TAGR( dn1 ); XAGL( dn2 ); TXTL( dn2 ); p2XA( dn2, - "declared at %pS:%d, in frame #%d of thread %d", - fileName, var->lineNo, frameNo, (Int)tid ); + "declared at %pS:%d, in frame #%d of thread %u", + fileName, var->lineNo, frameNo, tid ); TXTR( dn2 ); // FIXME: also do p2XA( dn2, @@ -3336,11 +3336,11 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, XAGR( dn2 ); } else { p2XA( dn1, - "Location 0x%lx is %lu byte%s inside local var \"%s\"", + "Location 0x%lx is %ld byte%s inside local var \"%s\"", data_addr, var_offset, vo_plural, var->name ); p2XA( dn2, - "declared at %s:%d, in frame #%d of thread %d", - fileName, var->lineNo, frameNo, (Int)tid ); + "declared at %s:%d, in frame #%d of thread %u", + fileName, var->lineNo, frameNo, tid ); } } else @@ -3352,21 +3352,21 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, if (xml) { TAGL( dn1 ); p2XA( dn1, - "Location 0x%lx is %lu byte%s inside %pS%pS", + "Location 0x%lx is %ld byte%s inside %pS%pS", data_addr, residual_offset, ro_plural, var->name, (HChar*)(VG_(indexXA)(described,0)) ); TAGR( dn1 ); TAGL( dn2 ); p2XA( dn2, - "in frame #%d of thread %d", frameNo, (Int)tid ); + "in frame #%d of thread %u", frameNo, tid ); TAGR( dn2 ); } else { p2XA( dn1, - "Location 0x%lx is %lu byte%s inside %s%s", + "Location 0x%lx is %ld byte%s inside %s%s", data_addr, residual_offset, ro_plural, var->name, (HChar*)(VG_(indexXA)(described,0)) ); p2XA( dn2, - "in frame #%d of thread %d", frameNo, (Int)tid ); + "in frame #%d of thread %u", frameNo, tid ); } } else @@ -3376,15 +3376,15 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, if (xml) { TAGL( dn1 ); p2XA( dn1, - "Location 0x%lx is %lu byte%s inside %pS%pS,", + "Location 0x%lx is %ld byte%s inside %pS%pS,", data_addr, residual_offset, ro_plural, var->name, (HChar*)(VG_(indexXA)(described,0)) ); TAGR( dn1 ); XAGL( dn2 ); TXTL( dn2 ); p2XA( dn2, - "declared at %pS:%d, in frame #%d of thread %d", - fileName, var->lineNo, frameNo, (Int)tid ); + "declared at %pS:%d, in frame #%d of thread %u", + fileName, var->lineNo, frameNo, tid ); TXTR( dn2 ); // FIXME: also do p2XA( dn2, @@ -3393,12 +3393,12 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, XAGR( dn2 ); } else { p2XA( dn1, - "Location 0x%lx is %lu byte%s inside %s%s,", + "Location 0x%lx is %ld byte%s inside %s%s,", data_addr, residual_offset, ro_plural, var->name, (HChar*)(VG_(indexXA)(described,0)) ); p2XA( dn2, - "declared at %s:%d, in frame #%d of thread %d", - fileName, var->lineNo, frameNo, (Int)tid ); + "declared at %s:%d, in frame #%d of thread %u", + fileName, var->lineNo, frameNo, tid ); } } else @@ -3410,12 +3410,12 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, if (xml) { TAGL( dn1 ); p2XA( dn1, - "Location 0x%lx is %lu byte%s inside global var \"%pS\"", + "Location 0x%lx is %ld byte%s inside global var \"%pS\"", data_addr, var_offset, vo_plural, var->name ); TAGR( dn1 ); } else { p2XA( dn1, - "Location 0x%lx is %lu byte%s inside global var \"%s\"", + "Location 0x%lx is %ld byte%s inside global var \"%s\"", data_addr, var_offset, vo_plural, var->name ); } } @@ -3428,7 +3428,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, if (xml) { TAGL( dn1 ); p2XA( dn1, - "Location 0x%lx is %lu byte%s inside global var \"%pS\"", + "Location 0x%lx is %ld byte%s inside global var \"%pS\"", data_addr, var_offset, vo_plural, var->name ); TAGR( dn1 ); XAGL( dn2 ); @@ -3444,7 +3444,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, XAGR( dn2 ); } else { p2XA( dn1, - "Location 0x%lx is %lu byte%s inside global var \"%s\"", + "Location 0x%lx is %ld byte%s inside global var \"%s\"", data_addr, var_offset, vo_plural, var->name ); p2XA( dn2, "declared at %s:%d", @@ -3460,7 +3460,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, if (xml) { TAGL( dn1 ); p2XA( dn1, - "Location 0x%lx is %lu byte%s inside %pS%pS,", + "Location 0x%lx is %ld byte%s inside %pS%pS,", data_addr, residual_offset, ro_plural, var->name, (HChar*)(VG_(indexXA)(described,0)) ); TAGR( dn1 ); @@ -3470,9 +3470,9 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, TAGR( dn2 ); } else { p2XA( dn1, - "Location 0x%lx is %lu byte%s inside %s%s,", + "Location 0x%lx is %ld byte%s inside %s%s,", data_addr, residual_offset, ro_plural, var->name, - (char*)(VG_(indexXA)(described,0)) ); + (HChar*)(VG_(indexXA)(described,0)) ); p2XA( dn2, "a global variable"); } @@ -3484,7 +3484,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, if (xml) { TAGL( dn1 ); p2XA( dn1, - "Location 0x%lx is %lu byte%s inside %pS%pS,", + "Location 0x%lx is %ld byte%s inside %pS%pS,", data_addr, residual_offset, ro_plural, var->name, (HChar*)(VG_(indexXA)(described,0)) ); TAGR( dn1 ); @@ -3501,7 +3501,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, XAGR( dn2 ); } else { p2XA( dn1, - "Location 0x%lx is %lu byte%s inside %s%s,", + "Location 0x%lx is %ld byte%s inside %s%s,", data_addr, residual_offset, ro_plural, var->name, (HChar*)(VG_(indexXA)(described,0)) ); p2XA( dn2, @@ -3935,8 +3935,8 @@ void analyse_deps ( /*MOD*/XArray* /* of FrameBlock */ blocks, res = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di ); vg_assert(res.kind == GXR_Addr); if (debug) - VG_(printf)(" %5ld .. %5ld (sp) %s\n", - res.word, res.word + ((UWord)mul.ul) - 1, var->name); + VG_(printf)(" %5lu .. %5llu (sp) %s\n", + res.word, res.word + mul.ul - 1, var->name); block.base = res.word; block.szB = (SizeT)mul.ul; block.spRel = True; @@ -3954,8 +3954,8 @@ void analyse_deps ( /*MOD*/XArray* /* of FrameBlock */ blocks, res = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di ); vg_assert(res.kind == GXR_Addr); if (debug) - VG_(printf)(" %5ld .. %5ld (FP) %s\n", - res.word, res.word + ((UWord)mul.ul) - 1, var->name); + VG_(printf)(" %5lu .. %5llu (FP) %s\n", + res.word, res.word + mul.ul - 1, var->name); block.base = res.word; block.szB = (SizeT)mul.ul; block.spRel = False; @@ -4357,8 +4357,8 @@ VgSectKind VG_(DebugInfo_sect_kind)( /*OUT*/const HChar** name, Addr a) if (0) VG_(printf)( - "addr=%#lx di=%p %s got=%#lx,%ld plt=%#lx,%ld " - "data=%#lx,%ld bss=%#lx,%ld\n", + "addr=%#lx di=%p %s got=%#lx,%lu plt=%#lx,%lu " + "data=%#lx,%lu bss=%#lx,%lu\n", a, di, di->fsm.filename, di->got_avma, di->got_size, di->plt_avma, di->plt_size, diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c index 00b61009fe..d974c16a19 100644 --- a/coregrind/m_debuginfo/image.c +++ b/coregrind/m_debuginfo/image.c @@ -474,7 +474,7 @@ static void set_CEnt ( const DiImage* img, UInt entNo, DiOffT off ) UInt delay = now - t_last; t_last = now; nread += len; - VG_(printf)("XXXXXXXX (tot %'lld) read %'ld offset %'lld delay %'u\n", + VG_(printf)("XXXXXXXX (tot %'llu) read %'lu offset %'llu delay %'u\n", nread, len, off, delay); } @@ -804,10 +804,10 @@ static void ensure_valid_failed (const DiImage* img, DiOffT offset, SizeT size, { VG_(umsg)("Valgrind: debuginfo reader: ensure_valid failed:\n"); VG_(umsg)("Valgrind: during call to %s\n", caller); - VG_(umsg)("Valgrind: request for range [%llu, +%llu) exceeds\n", - (ULong)offset, (ULong)size); - VG_(umsg)("Valgrind: valid image size of %llu for image:\n", - (ULong)img->size); + VG_(umsg)("Valgrind: request for range [%llu, +%lu) exceeds\n", + offset, size); + VG_(umsg)("Valgrind: valid image size of %lu for image:\n", + img->size); VG_(umsg)("Valgrind: \"%s\"\n", img->source.name); give_up__image_overrun(); } diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c index 0111d6a231..dc43c8c3f1 100644 --- a/coregrind/m_debuginfo/readdwarf.c +++ b/coregrind/m_debuginfo/readdwarf.c @@ -269,7 +269,8 @@ void process_extended_line_op( struct _DebugInfo* di, switch (op_code) { case DW_LNE_end_sequence: if (0) VG_(printf)("1001: si->o %#lx, smr.a %#lx\n", - di->text_debug_bias, state_machine_regs.address ); + (UWord)di->text_debug_bias, + state_machine_regs.address ); /* JRS: added for compliance with spec; is pointless due to reset_state_machine below */ state_machine_regs.end_sequence = 1; @@ -618,10 +619,11 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, Int advAddr = adv; state_machine_regs.address += adv; - if (0) VG_(printf)("smr.a += %#lx\n", adv ); + if (0) VG_(printf)("smr.a += %#lx\n", (UWord)adv ); adv = (op_code % info.li_line_range) + info.li_line_base; if (0) VG_(printf)("1002: di->o %#lx, smr.a %#lx\n", - di->text_debug_bias, state_machine_regs.address ); + (UWord)di->text_debug_bias, + state_machine_regs.address ); state_machine_regs.line += adv; if (di->ddump_line) @@ -660,7 +662,8 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, case DW_LNS_copy: if (0) VG_(printf)("1002: di->o %#lx, smr.a %#lx\n", - di->text_debug_bias, state_machine_regs.address ); + (UWord)di->text_debug_bias, + state_machine_regs.address ); if (state_machine_regs.is_stmt) { /* only add a statement if there was a previous boundary */ if (state_machine_regs.last_address) { @@ -684,11 +687,11 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, break; case DW_LNS_advance_pc: { - Word adv = info.li_min_insn_length * step_leb128U(&data); + UWord adv = info.li_min_insn_length * step_leb128U(&data); state_machine_regs.address += adv; if (0) VG_(printf)("smr.a += %#lx\n", adv ); if (di->ddump_line) - VG_(printf)(" Advance PC by %ld to 0x%lx\n", + VG_(printf)(" Advance PC by %lu to 0x%lx\n", adv, state_machine_regs.address); break; } @@ -733,7 +736,7 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, Word adv = (((255 - info.li_opcode_base) / info.li_line_range) * info.li_min_insn_length); state_machine_regs.address += adv; - if (0) VG_(printf)("smr.a += %#lx\n", adv ); + if (0) VG_(printf)("smr.a += %#lx\n", (UWord)adv ); if (di->ddump_line) VG_(printf)(" Advance PC by constant %ld to 0x%lx\n", adv, (Addr)state_machine_regs.address); @@ -741,7 +744,7 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, } case DW_LNS_fixed_advance_pc: { /* XXX: Need something to get 2 bytes */ - Word adv = ML_(cur_step_UShort)(&data); + UWord adv = ML_(cur_step_UShort)(&data); state_machine_regs.address += adv; if (0) VG_(printf)("smr.a += %#lx\n", adv ); if (di->ddump_line) @@ -1131,7 +1134,7 @@ void ML_(read_debuginfo_dwarf3) if (0) { HChar* str_name = ML_(cur_read_strdup)(ui.name, "di.rdd3.3"); - VG_(printf)("debug_line_sz %lld, ui.stmt_list %lld %s\n", + VG_(printf)("debug_line_sz %llu, ui.stmt_list %llu %s\n", escn_debug_line.szB, ui.stmt_list, str_name ); ML_(dinfo_free)(str_name); } @@ -3446,30 +3449,30 @@ static Int show_CF_instruction ( DiCursor instrIN, case DW_CFA_advance_loc1: delta = (UInt)ML_(cur_step_UChar)(&instr); - VG_(printf)(" sci:DW_CFA_advance_loc1(%d)\n", delta); + VG_(printf)(" sci:DW_CFA_advance_loc1(%u)\n", delta); break; case DW_CFA_advance_loc2: delta = (UInt)ML_(cur_step_UShort)(&instr); - VG_(printf)(" sci:DW_CFA_advance_loc2(%d)\n", delta); + VG_(printf)(" sci:DW_CFA_advance_loc2(%u)\n", delta); break; case DW_CFA_advance_loc4: delta = (UInt)ML_(cur_step_UInt)(&instr); - VG_(printf)(" DW_CFA_advance_loc4(%d)\n", delta); + VG_(printf)(" DW_CFA_advance_loc4(%u)\n", delta); break; case DW_CFA_def_cfa: reg = step_leb128( &instr, 0 ); off = step_leb128( &instr, 0 ); - VG_(printf)(" DW_CFA_def_cfa: r%d ofs %d\n", (Int)reg, (Int)off); + VG_(printf)(" DW_CFA_def_cfa: r%d ofs %d\n", reg, off); break; case DW_CFA_def_cfa_sf: reg = step_leb128( &instr, 0 ); off = step_leb128( &instr, 1 ); VG_(printf)(" DW_CFA_def_cfa_sf: r%d ofs %d\n", - (Int)reg, (Int)(off * data_a_f)); + reg, off * data_a_f); break; case DW_CFA_register: @@ -3740,7 +3743,7 @@ void ML_(read_callframe_info_dwarf3) if (di->trace_cfi) { VG_(printf)("\n-----------------------------------------------\n"); - VG_(printf)("CFI info: szB %lld, _avma %#lx\n", + VG_(printf)("CFI info: szB %llu, _avma %#lx\n", escn_frame.szB, frame_avma ); VG_(printf)("CFI info: name %s\n", di->fsm.filename ); } @@ -3788,11 +3791,11 @@ void ML_(read_callframe_info_dwarf3) ciefde_start = data; if (di->trace_cfi) VG_(printf)("\ncie/fde.start = (frame_image + 0x%llx)\n", - ML_(cur_minus)(ciefde_start, frame_image)); + (ULong)ML_(cur_minus)(ciefde_start, frame_image)); ciefde_len = (ULong)ML_(cur_step_UInt)(&data); if (di->trace_cfi) - VG_(printf)("cie/fde.length = %lld\n", ciefde_len); + VG_(printf)("cie/fde.length = %llu\n", ciefde_len); /* Apparently, if the .length field is zero, we are at the end of the sequence. This is stated in the Generic Elf @@ -3801,7 +3804,7 @@ void ML_(read_callframe_info_dwarf3) if (ciefde_len == 0) { if (di->ddump_frames) VG_(printf)("%08llx ZERO terminator\n\n", - ML_(cur_minus)(ciefde_start, frame_image)); + (ULong)ML_(cur_minus)(ciefde_start, frame_image)); return; } @@ -3825,7 +3828,7 @@ void ML_(read_callframe_info_dwarf3) } if (di->trace_cfi) - VG_(printf)("cie.pointer = %lld\n", cie_pointer); + VG_(printf)("cie.pointer = %llu\n", cie_pointer); /* If cie_pointer is zero for .eh_frame or all ones for .debug_frame, we've got a CIE; else it's an FDE. */ @@ -4056,7 +4059,7 @@ void ML_(read_callframe_info_dwarf3) look_for = cie_pointer; for (cie = 0; cie < n_CIEs; cie++) { - if (0) VG_(printf)("look for %lld %lld\n", + if (0) VG_(printf)("look for %llu %llu\n", look_for, the_CIEs[cie].offset ); if (the_CIEs[cie].offset == look_for) break; diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 553ef7ccee..2fe45baeb1 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -671,7 +671,7 @@ static GExpr* make_general_GX ( const CUConst* cc, set_position_of_Cursor( &loc, debug_loc_offset ); TRACE_D3("make_general_GX (.debug_loc_offset = %llu, ioff = %llu) {\n", - debug_loc_offset, (ULong)get_DiCursor_from_Cursor(&loc).ioff ); + debug_loc_offset, get_DiCursor_from_Cursor(&loc).ioff ); /* Who frees this xa? It is freed before this fn exits. */ xa = VG_(newXA)( ML_(dinfo_zalloc), "di.readdwarf3.mgGX.1", @@ -965,8 +965,8 @@ static void init_ht_abbvs (CUConst* cc, VG_(memcpy) (ht_ta, ta, SZ_G_ABBV(ta_nf_n)); VG_(HT_add_node) ( cc->ht_abbvs, ht_ta ); if (TD3) { - TRACE_D3(" Adding abbv_code %llu TAG %s [%s] nf %d ", - (ULong) ht_ta->abbv_code, ML_(pp_DW_TAG)(ht_ta->atag), + TRACE_D3(" Adding abbv_code %lu TAG %s [%s] nf %u ", + ht_ta->abbv_code, ML_(pp_DW_TAG)(ht_ta->atag), ML_(pp_DW_children)(ht_ta->has_children), ta_nf_n); TRACE_D3(" "); @@ -1019,7 +1019,7 @@ void parse_CU_Header ( /*OUT*/CUConst* cc, = get_Initial_Length( &cc->is_dw64, c, "parse_CU_Header: invalid initial-length field" ); - TRACE_D3(" Length: %lld\n", cc->unit_length ); + TRACE_D3(" Length: %llu\n", cc->unit_length ); /* version */ cc->version = get_UShort( c ); @@ -1031,7 +1031,7 @@ void parse_CU_Header ( /*OUT*/CUConst* cc, debug_abbrev_offset = get_Dwarfish_UWord( c, cc->is_dw64 ); if (debug_abbrev_offset >= escn_debug_abbv.szB) cc->barf( "parse_CU_Header: invalid debug_abbrev_offset" ); - TRACE_D3(" Abbrev Offset: %lld\n", debug_abbrev_offset ); + TRACE_D3(" Abbrev Offset: %llu\n", debug_abbrev_offset ); /* address size. If this isn't equal to the host word size, just give up. This makes it safe to assume elsewhere that @@ -1167,12 +1167,12 @@ void get_Form_contents ( /*OUT*/FormContents* cts, case DW_FORM_sdata: cts->u.val = (ULong)(Long)get_SLEB128(c); cts->szB = 8; - TRACE_D3("%lld", (Long)cts->u.val); + TRACE_D3("%llu", cts->u.val); break; case DW_FORM_udata: cts->u.val = (ULong)(Long)get_ULEB128(c); cts->szB = 8; - TRACE_D3("%llu", (Long)cts->u.val); + TRACE_D3("%llu", cts->u.val); break; case DW_FORM_addr: /* note, this is a hack. DW_FORM_addr is defined as getting @@ -1444,7 +1444,7 @@ void get_Form_contents ( /*OUT*/FormContents* cts, default: VG_(printf)( - "get_Form_contents: unhandled %d (%s) at <%llx>\n", + "get_Form_contents: unhandled %u (%s) at <%llx>\n", form, ML_(pp_DW_FORM)(form), get_position_of_Cursor(c)); c->barf("get_Form_contents: unhandled DW_FORM"); } @@ -1526,7 +1526,7 @@ UInt get_Form_szB (const CUConst* cc, DW_FORM form ) return sizeof_Dwarfish_UWord(cc->is_dw64); default: VG_(printf)( - "get_Form_szB: unhandled %d (%s)\n", + "get_Form_szB: unhandled %u (%s)\n", form, ML_(pp_DW_FORM)(form)); cc->barf("get_Form_contents: unhandled DW_FORM"); } @@ -1923,7 +1923,7 @@ void read_filename_table( /*MOD*/XArray* /* of UInt* */ fndn_ix_Table, else dirname = NULL; fndn_ix = ML_(addFnDn)( cc->di, str, dirname); - TRACE_D3(" read_filename_table: %ld fndn_ix %d %s %s\n", + TRACE_D3(" read_filename_table: %ld fndn_ix %u %s %s\n", VG_(sizeXA)(fndn_ix_Table), fndn_ix, dirname, str); VG_(addToXA)( fndn_ix_Table, &fndn_ix ); @@ -2318,7 +2318,7 @@ static void parse_var_DIE ( && ftabIx < VG_(sizeXA)( parser->fndn_ix_Table )) { fndn_ix = *(UInt*)VG_(indexXA)( parser->fndn_ix_Table, ftabIx ); } - if (0) VG_(printf)("XXX filename fndn_ix = %d %s\n", fndn_ix, + if (0) VG_(printf)("XXX filename fndn_ix = %u %s\n", fndn_ix, ML_(fndn_ix2filename) (cc->di, fndn_ix)); } } @@ -2758,7 +2758,7 @@ static Bool parse_inl_DIE ( caller_fndn_ix = *(UInt*) VG_(indexXA)( parser->fndn_ix_Table, ftabIx ); } - if (0) VG_(printf)("XXX caller_fndn_ix = %d %s\n", caller_fndn_ix, + if (0) VG_(printf)("XXX caller_fndn_ix = %u %s\n", caller_fndn_ix, ML_(fndn_ix2filename) (cc->di, caller_fndn_ix)); } if (attr == DW_AT_call_line && cts.szB > 0) { @@ -4769,7 +4769,7 @@ void new_dwarf3_reader_wrk ( /* .. vs how big we have found it to be */ cu_amount_used = cu_offset_now - cc.cu_start_offset; - if (1) TRACE_D3("offset now %lld, d-i-size %lld\n", + if (1) TRACE_D3("offset now %llu, d-i-size %llu\n", cu_offset_now, section_size); if (cu_offset_now > section_size) barf("toplevel DIEs beyond end of CU"); @@ -4962,7 +4962,7 @@ void new_dwarf3_reader_wrk ( } else { VG_(printf)(" FrB=none\n"); } - VG_(printf)(" declared at: %d %s:%d\n", + VG_(printf)(" declared at: %u %s:%d\n", varp->fndn_ix, ML_(fndn_ix2filename) (di, varp->fndn_ix), varp->fLine ); diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index c9498e8bc9..574aad7375 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -757,7 +757,7 @@ void read_elf_symtab__normal( return; } - TRACE_SYMTAB("\n--- Reading (ELF, standard) %s (%lld entries) ---\n", + TRACE_SYMTAB("\n--- Reading (ELF, standard) %s (%llu entries) ---\n", tab_name, escn_symtab->szB/sizeof(ElfXX_Sym) ); /* Perhaps should start at i = 1; ELF docs suggest that entry @@ -887,7 +887,7 @@ void read_elf_symtab__ppc64be_linux( return; } - TRACE_SYMTAB("\n--- Reading (ELF, ppc64be-linux) %s (%lld entries) ---\n", + TRACE_SYMTAB("\n--- Reading (ELF, ppc64be-linux) %s (%llu entries) ---\n", tab_name, escn_symtab->szB/sizeof(ElfXX_Sym) ); oset = VG_(OSetGen_Create)( offsetof(TempSym,key), @@ -968,21 +968,21 @@ void read_elf_symtab__ppc64be_linux( if (modify_size && di->trace_symtab) { VG_(printf)(" modify (old sz %4d) " - " val %#010lx, toc %#010lx, sz %4d %lld\n", + " val %#010lx, toc %#010lx, sz %4d %llu\n", old_size, prev->key.addr, prev->tocptr, - (Int) prev->size, - (ULong)prev->key.name + prev->size, + prev->key.name ); } if (modify_tocptr && di->trace_symtab) { VG_(printf)(" modify (upd tocptr) " - " val %#010lx, toc %#010lx, sz %4d %lld\n", + " val %#010lx, toc %#010lx, sz %4d %llu\n", prev->key.addr, prev->tocptr, - (Int) prev->size, - (ULong)prev->key.name + prev->size, + prev->key.name ); } @@ -1597,20 +1597,20 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("------ Basic facts about the object ------\n"); TRACE_SYMTAB("object: n_oimage %llu\n", (ULong)ML_(img_size)(mimg)); - TRACE_SYMTAB("phdr: ioff %llu nent %ld ent_szB %ld\n", + TRACE_SYMTAB("phdr: ioff %llu nent %lu ent_szB %lu\n", phdr_mioff, phdr_mnent, phdr_ment_szB); - TRACE_SYMTAB("shdr: ioff %llu nent %ld ent_szB %ld\n", + TRACE_SYMTAB("shdr: ioff %llu nent %lu ent_szB %lu\n", shdr_mioff, shdr_mnent, shdr_ment_szB); for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) { const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i); if (map->rx) - TRACE_SYMTAB("rx_map: avma %#lx size %lu foff %lu\n", + TRACE_SYMTAB("rx_map: avma %#lx size %lu foff %ld\n", map->avma, map->size, map->foff); } for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) { const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i); if (map->rw) - TRACE_SYMTAB("rw_map: avma %#lx size %lu foff %lu\n", + TRACE_SYMTAB("rw_map: avma %#lx size %lu foff %ld\n", map->avma, map->size, map->foff); } @@ -1711,7 +1711,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) VG_(addToXA)(svma_ranges, &item); TRACE_SYMTAB( "PT_LOAD[%ld]: acquired as rw, bias 0x%lx\n", - i, item.bias); + i, (UWord)item.bias); loaded = True; } if (map->rx @@ -1721,7 +1721,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) VG_(addToXA)(svma_ranges, &item); TRACE_SYMTAB( "PT_LOAD[%ld]: acquired as rx, bias 0x%lx\n", - i, item.bias); + i, (UWord)item.bias); loaded = True; } } @@ -1811,7 +1811,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) { const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i); if (map->rx) - TRACE_SYMTAB("rx: at %#lx are mapped foffsets %ld .. %ld\n", + TRACE_SYMTAB("rx: at %#lx are mapped foffsets %ld .. %lu\n", map->avma, map->foff, map->foff + map->size - 1 ); } TRACE_SYMTAB("rx: contains these svma regions:\n"); @@ -1819,12 +1819,12 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) const RangeAndBias* reg = VG_(indexXA)(svma_ranges, i); if (reg->exec) TRACE_SYMTAB(" svmas %#lx .. %#lx with bias %#lx\n", - reg->svma_base, reg->svma_limit - 1, reg->bias ); + reg->svma_base, reg->svma_limit - 1, (UWord)reg->bias ); } for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) { const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i); if (map->rw) - TRACE_SYMTAB("rw: at %#lx are mapped foffsets %ld .. %ld\n", + TRACE_SYMTAB("rw: at %#lx are mapped foffsets %ld .. %lu\n", map->avma, map->foff, map->foff + map->size - 1 ); } TRACE_SYMTAB("rw: contains these svma regions:\n"); @@ -1832,7 +1832,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) const RangeAndBias* reg = VG_(indexXA)(svma_ranges, i); if (!reg->exec) TRACE_SYMTAB(" svmas %#lx .. %#lx with bias %#lx\n", - reg->svma_base, reg->svma_limit - 1, reg->bias ); + reg->svma_base, reg->svma_limit - 1, (UWord)reg->bias ); } /* TOPLEVEL */ @@ -1867,7 +1867,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) } } - TRACE_SYMTAB(" [sec %2ld] %s %s al%2u foff %6ld .. %6ld " + TRACE_SYMTAB(" [sec %2ld] %s %s al%2u foff %6ld .. %6lu " " svma %p name \"%s\"\n", i, inrx ? "rx" : " ", inrw ? "rw" : " ", alyn, foff, foff+size-1, (void*)svma, name); @@ -1924,7 +1924,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .text avma = %#lx .. %#lx\n", di->text_avma, di->text_avma + di->text_size - 1); - TRACE_SYMTAB("acquiring .text bias = %#lx\n", di->text_bias); + TRACE_SYMTAB("acquiring .text bias = %#lx\n", (UWord)di->text_bias); } else { BAD(".text"); } @@ -1946,7 +1946,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .data avma = %#lx .. %#lx\n", di->data_avma, di->data_avma + di->data_size - 1); - TRACE_SYMTAB("acquiring .data bias = %#lx\n", di->data_bias); + TRACE_SYMTAB("acquiring .data bias = %#lx\n", (UWord)di->data_bias); } else { BAD(".data"); } @@ -1968,7 +1968,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .sdata avma = %#lx .. %#lx\n", di->sdata_avma, di->sdata_avma + di->sdata_size - 1); - TRACE_SYMTAB("acquiring .sdata bias = %#lx\n", di->sdata_bias); + TRACE_SYMTAB("acquiring .sdata bias = %#lx\n", + (UWord)di->sdata_bias); } else { BAD(".sdata"); } @@ -1991,7 +1992,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .rodata avma = %#lx .. %#lx\n", di->rodata_avma, di->rodata_avma + di->rodata_size - 1); - TRACE_SYMTAB("acquiring .rodata bias = %#lx\n", di->rodata_bias); + TRACE_SYMTAB("acquiring .rodata bias = %#lx\n", + (UWord)di->rodata_bias); } else { BAD(".rodata"); } @@ -2013,7 +2015,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .dynbss avma = %#lx .. %#lx\n", di->bss_avma, di->bss_avma + di->bss_size - 1); - TRACE_SYMTAB("acquiring .dynbss bias = %#lx\n", di->bss_bias); + TRACE_SYMTAB("acquiring .dynbss bias = %#lx\n", + (UWord)di->bss_bias); } } @@ -2028,7 +2031,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) svma, svma + size - 1); TRACE_SYMTAB("acquiring .bss avma = %#lx .. %#lx\n", svma + inrw->bias, svma + inrw->bias + size - 1); - TRACE_SYMTAB("acquiring .bss bias = %#lx\n", di->bss_bias); + TRACE_SYMTAB("acquiring .bss bias = %#lx\n", + (UWord)di->bss_bias); } else if (inrw && !di->bss_present) { @@ -2045,7 +2049,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .bss avma = %#lx .. %#lx\n", di->bss_avma, di->bss_avma + di->bss_size - 1); - TRACE_SYMTAB("acquiring .bss bias = %#lx\n", di->bss_bias); + TRACE_SYMTAB("acquiring .bss bias = %#lx\n", + (UWord)di->bss_bias); } else /* Now one from the wtf?! department ... */ @@ -2098,7 +2103,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .sdynbss avma = %#lx .. %#lx\n", di->sbss_avma, di->sbss_avma + di->sbss_size - 1); - TRACE_SYMTAB("acquiring .sdynbss bias = %#lx\n", di->sbss_bias); + TRACE_SYMTAB("acquiring .sdynbss bias = %#lx\n", + (UWord)di->sbss_bias); } } @@ -2113,7 +2119,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) svma, svma + size - 1); TRACE_SYMTAB("acquiring .sbss avma = %#lx .. %#lx\n", svma + inrw->bias, svma + inrw->bias + size - 1); - TRACE_SYMTAB("acquiring .sbss bias = %#lx\n", di->sbss_bias); + TRACE_SYMTAB("acquiring .sbss bias = %#lx\n", (UWord)di->sbss_bias); } else if (inrw && !di->sbss_present) { @@ -2130,7 +2136,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .sbss avma = %#lx .. %#lx\n", di->sbss_avma, di->sbss_avma + di->sbss_size - 1); - TRACE_SYMTAB("acquiring .sbss bias = %#lx\n", di->sbss_bias); + TRACE_SYMTAB("acquiring .sbss bias = %#lx\n", (UWord)di->sbss_bias); } else { BAD(".sbss"); } @@ -2264,7 +2270,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .exidx avma = %#lx .. %#lx\n", di->exidx_avma, di->exidx_avma + di->exidx_size - 1); - TRACE_SYMTAB("acquiring .exidx bias = %#lx\n", di->exidx_bias); + TRACE_SYMTAB("acquiring .exidx bias = %#lx\n", + (UWord)di->exidx_bias); } else { BAD(".ARM.exidx"); } @@ -2286,7 +2293,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) TRACE_SYMTAB("acquiring .extab avma = %#lx .. %#lx\n", di->extab_avma, di->extab_avma + di->extab_size - 1); - TRACE_SYMTAB("acquiring .extab bias = %#lx\n", di->extab_bias); + TRACE_SYMTAB("acquiring .extab bias = %#lx\n", + (UWord)di->extab_bias); } else { BAD(".ARM.extab"); } @@ -2299,8 +2307,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) } /* iterate over the section headers */ /* TOPLEVEL */ - if (0) VG_(printf)("YYYY text_: avma %#lx size %ld bias %#lx\n", - di->text_avma, di->text_size, di->text_bias); + if (0) VG_(printf)("YYYY text_: avma %#lx size %lu bias %#lx\n", + di->text_avma, di->text_size, (UWord)di->text_bias); if (VG_(clo_verbosity) > 2 || VG_(clo_trace_redir)) VG_(message)(Vg_DebugMsg, " svma %#010lx, avma %#010lx\n", @@ -2646,7 +2654,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) di->_sec##_debug_svma, \ di->_sec##_debug_svma + di->_sec##_size - 1); \ TRACE_SYMTAB("acquiring ." #_sec " debug bias = %#lx\n", \ - di->_sec##_debug_bias); \ + (UWord)di->_sec##_debug_bias); \ } \ } while (0); @@ -3008,7 +3016,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) } } } - VG_(umsg)("VARINFO: %7lu vars %7ld text_size %s\n", + VG_(umsg)("VARINFO: %7lu vars %7lu text_size %s\n", nVars, di->text_size, di->fsm.filename); } /* TOPLEVEL */ diff --git a/coregrind/m_debuginfo/readexidx.c b/coregrind/m_debuginfo/readexidx.c index 35d07c5687..7d7ea08462 100644 --- a/coregrind/m_debuginfo/readexidx.c +++ b/coregrind/m_debuginfo/readexidx.c @@ -554,7 +554,7 @@ Int ExtabEntryDecode(/*OUT*/SummState* state, const UChar* buf, SizeT buf_size) if (0) VG_(printf)(" edata: cmd %08x data %08x\n", - (UInt)edata.cmd, (UInt)edata.data); + (UInt)edata.cmd, edata.data); Int ret = TranslateCmd ( state, &edata ); if (ret < 0) return ret; @@ -673,7 +673,7 @@ Bool setCFAfromCFIR( /*MOD*/DiCfSI_m* cfi, XArray*/*CfiExpr*/ cfsi_exprs, default: break; } - VG_(printf)("setCFAfromCFIR: FAIL: how %d off %d\n", (Int)how, (Int)off); + VG_(printf)("setCFAfromCFIR: FAIL: how %d off %d\n", how, off); vg_assert(0); return False; } @@ -970,8 +970,8 @@ void ML_(read_exidx) ( /*MOD*/DebugInfo* di, // associated with. Addr avma = (Addr)Prel31ToAddr(&entry_img->addr); if (di->trace_cfi) - VG_(printf)("XXX1 entry: entry->addr 0x%lx, avma 0x%lx\n", - (UWord)entry_img->addr, avma); + VG_(printf)("XXX1 entry: entry->addr 0x%x, avma 0x%lx\n", + entry_img->addr, avma); Addr next_avma; if (entry_img < end_img - 1) { @@ -1006,8 +1006,8 @@ void ML_(read_exidx) ( /*MOD*/DebugInfo* di, if (!plausible && avma != text_last_avma + 1) { HChar buf[100]; VG_(snprintf)(buf, sizeof(buf), - "Implausible EXIDX last entry size %u" - "; using 1 instead.", (UInt)(text_last_avma - avma)); + "Implausible EXIDX last entry size %lu" + "; using 1 instead.", text_last_avma - avma); buf[sizeof(buf)-1] = 0; complain(buf); } diff --git a/coregrind/m_debuginfo/readpdb.c b/coregrind/m_debuginfo/readpdb.c index cc8183192f..47f1200de1 100644 --- a/coregrind/m_debuginfo/readpdb.c +++ b/coregrind/m_debuginfo/readpdb.c @@ -1113,7 +1113,7 @@ static void pdb_jg_init( struct pdb_reader* reader, static void pdb_check_root_version_and_timestamp( const HChar* pdbname, ULong pdbmtime, - unsigned version, + UInt version, UInt TimeDateStamp ) { switch ( version ) { @@ -1126,7 +1126,7 @@ void pdb_check_root_version_and_timestamp( const HChar* pdbname, default: if (VG_(clo_verbosity) > 1) VG_(umsg)("LOAD_PDB_DEBUGINFO: " - "Unknown .pdb root block version %d\n", version ); + "Unknown .pdb root block version %u\n", version ); } if ( TimeDateStamp != pdbmtime ) { if (VG_(clo_verbosity) > 1) @@ -1238,9 +1238,9 @@ static ULong DEBUG_SnarfCodeView( default: if (0) { - const int *isym = (const int *)sym; + const UInt *isym = (const UInt *)sym; VG_(printf)("unknown id 0x%x len=0x%x at %p\n", - sym->generic.id, sym->generic.len, sym); + (UInt)sym->generic.id, (UInt)sym->generic.len, sym); VG_(printf)(" %8x %8x %8x %8x\n", isym[1], isym[2], isym[3], isym[4]); VG_(printf)(" %8x %8x %8x %8x\n", @@ -1366,7 +1366,7 @@ static ULong DEBUG_SnarfCodeView( vsym.isText = True; vsym.isIFunc = False; if (debug) - VG_(umsg)(" Adding function %s addr=%#lx length=%d\n", + VG_(umsg)(" Adding function %s addr=%#lx length=%u\n", symname, vsym.avmas.main, vsym.size ); ML_(addSym)( di, &vsym ); n_syms_read++; @@ -1387,7 +1387,7 @@ static ULong DEBUG_SnarfCodeView( vsym.isText = True; vsym.isIFunc = False; if (debug) - VG_(umsg)(" Adding function %s addr=%#lx length=%d\n", + VG_(umsg)(" Adding function %s addr=%#lx length=%u\n", symname, vsym.avmas.main, vsym.size ); ML_(addSym)( di, &vsym ); n_syms_read++; @@ -1756,7 +1756,7 @@ static ULong codeview_dump_linetab2( for (i = 0; i < lbh->nlines; i++) { if (debug) - VG_(printf)("%s offset=%08x line=%d\n", + VG_(printf)("%s offset=%08x line=%u\n", pfx, lbh->l[i].offset, lbh->l[i].lineno ^ 0x80000000); } @@ -1767,7 +1767,7 @@ static ULong codeview_dump_linetab2( svma_e = sectp[lbh->seg - 1].VirtualAddress + lbh->start + lbh->l[i+1].offset-1; if (debug) - VG_(printf)("%s line %d: %08lx to %08lx\n", + VG_(printf)("%s line %u: %08lx to %08lx\n", pfx, lbh->l[i].lineno ^ 0x80000000, svma_s, svma_e); ML_(addLineInfo)( di, filedirname_ix, @@ -1781,7 +1781,7 @@ static ULong codeview_dump_linetab2( svma_e = sectp[lbh->seg - 1].VirtualAddress + lbh->start + lbh->size - 1; if (debug) - VG_(printf)("%s line %d: %08lx to %08lx\n", + VG_(printf)("%s line %u: %08lx to %08lx\n", pfx, lbh->l[ lbh->nlines-1 ].lineno ^ 0x80000000, svma_s, svma_e); ML_(addLineInfo)( di, @@ -2099,7 +2099,7 @@ static void pdb_dump( const struct pdb_reader* pdb, default: if (VG_(clo_verbosity) > 1) VG_(umsg)("LOAD_PDB_DEBUGINFO: " - "Unknown .pdb type info version %ld\n", types.version ); + "Unknown .pdb type info version %lu\n", types.version ); } header_size = 0; @@ -2113,7 +2113,7 @@ static void pdb_dump( const struct pdb_reader* pdb, default: if (VG_(clo_verbosity) > 1) VG_(umsg)("LOAD_PDB_DEBUGINFO: " - "Unknown .pdb symbol info version %ld\n", + "Unknown .pdb symbol info version %lu\n", symbols.version ); } @@ -2384,21 +2384,21 @@ Bool ML_(read_pdb_debug_info)( const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i); if (map->rx) VG_(dmsg)("LOAD_PDB_DEBUGINFO: " - "rx_map: avma %#lx size %7lu foff %llu\n", - map->avma, map->size, (Off64T)map->foff); + "rx_map: avma %#lx size %7lu foff %ld\n", + map->avma, map->size, map->foff); } for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) { const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i); if (map->rw) VG_(dmsg)("LOAD_PDB_DEBUGINFO: " - "rw_map: avma %#lx size %7lu foff %llu\n", - map->avma, map->size, (Off64T)map->foff); + "rw_map: avma %#lx size %7lu foff %ld\n", + map->avma, map->size, map->foff); } VG_(dmsg)("LOAD_PDB_DEBUGINFO: " " text: avma %#lx svma %#lx size %7lu bias %#lx\n", di->text_avma, di->text_svma, - di->text_size, di->text_bias); + di->text_size, (UWord)di->text_bias); } /* diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index c455ca3a61..75dec20831 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -98,7 +98,7 @@ void ML_(ppSym) ( Int idx, const DiSym* sym ) vg_assert(sym->pri_name); if (sec_names) vg_assert(sec_names); - VG_(printf)( "%5d: %c%c %#8lx .. %#8lx (%d) %s%s", + VG_(printf)( "%5d: %c%c %#8lx .. %#8lx (%u) %s%s", idx, sym->isText ? 'T' : '-', sym->isIFunc ? 'I' : '-', @@ -143,8 +143,7 @@ void ML_(ppDiCfSI) ( const XArray* /* of CfiExpr */ exprs, } while (0) if (base != 0 || len != 0) - VG_(printf)("[%#lx .. %#lx]: ", base, - base + (UWord)len - 1); + VG_(printf)("[%#lx .. %#lx]: ", base, base + len - 1); else VG_(printf)("[]: "); @@ -658,7 +657,7 @@ void ML_(addInlInfo) ( struct _DebugInfo* di, if (0) VG_(message) (Vg_DebugMsg, "addInlInfo: fn %s inlined as addr_lo %#lx,addr_hi %#lx," - "caller fndn_ix %d %s:%d\n", + "caller fndn_ix %u %s:%d\n", inlinedfn, addr_lo, addr_hi, fndn_ix, ML_(fndn_ix2filename) (di, fndn_ix), lineno); @@ -1004,7 +1003,7 @@ void show_scope ( OSet* /* of DiAddrRange */ scope, const HChar* who ) while (True) { range = VG_(OSetGen_Next)( scope ); if (!range) break; - VG_(printf)(" %#lx .. %#lx: %lu vars\n", range->aMin, range->aMax, + VG_(printf)(" %#lx .. %#lx: %ld vars\n", range->aMin, range->aMax, range->vars ? VG_(sizeXA)(range->vars) : 0); } VG_(printf)("}\n"); @@ -2019,7 +2018,7 @@ static void canonicaliseLoctab ( struct _DebugInfo* di ) /* Ensure relevant postconditions hold. */ for (i = 0; i < ((Word)di->loctab_used)-1; i++) { if (0) - VG_(printf)("%lu 0x%p lno:%d sz:%d fndn_ix:%d i+1 0x%p\n", + VG_(printf)("%ld 0x%p lno:%d sz:%d fndn_ix:%u i+1 0x%p\n", i, (void*)di->loctab[i].addr, di->loctab[i].lineno, @@ -2151,9 +2150,9 @@ void ML_(canonicaliseCFI) ( struct _DebugInfo* di ) } if (di->trace_cfi) - VG_(printf)("canonicaliseCfiSI: %ld entries, %#lx .. %#lx\n", + VG_(printf)("canonicaliseCfiSI: %lu entries, %#lx .. %#lx\n", di->cfsi_used, - di->cfsi_minavma, di->cfsi_maxavma); + di->cfsi_minavma, di->cfsi_maxavma); /* Sort the cfsi_rd array by base address. */ VG_(ssort)(di->cfsi_rd, di->cfsi_used, sizeof(*di->cfsi_rd), compare_DiCfSI); diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c index 1ee62f960d..c6186d5dd5 100644 --- a/coregrind/m_debuginfo/tytypes.c +++ b/coregrind/m_debuginfo/tytypes.c @@ -104,7 +104,7 @@ void ML_(pp_TyEnt)( const TyEnt* te ) te->Te.Field.typeR, te->Te.Field.pos.offset, te->Te.Field.name ? te->Te.Field.name : ""); else - VG_(printf)("Te_Field(ty=0x%05lx,nLoc=%lu,pos.loc=%p,\"%s\")", + VG_(printf)("Te_Field(ty=0x%05lx,nLoc=%ld,pos.loc=%p,\"%s\")", te->Te.Field.typeR, te->Te.Field.nLoc, te->Te.Field.pos.loc, te->Te.Field.name ? te->Te.Field.name : ""); @@ -152,7 +152,7 @@ void ML_(pp_TyEnt)( const TyEnt* te ) break; case Te_TyStOrUn: if (te->Te.TyStOrUn.complete) { - VG_(printf)("Te_TyStOrUn(%ld,%c,%p,\"%s\")", + VG_(printf)("Te_TyStOrUn(%lu,%c,%p,\"%s\")", te->Te.TyStOrUn.szB, te->Te.TyStOrUn.isStruct ? 'S' : 'U', te->Te.TyStOrUn.fieldRs, diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 7d0ad0ce43..e41079171c 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -158,7 +158,7 @@ void VG_(print_scheduler_stats)(void) "scheduler: %'llu/%'llu major/minor sched events.\n", n_scheduling_events_MAJOR, n_scheduling_events_MINOR); VG_(message)(Vg_DebugMsg, - " sanity: %d cheap, %d expensive checks.\n", + " sanity: %u cheap, %u expensive checks.\n", sanity_fast_count, sanity_slow_count ); } @@ -175,7 +175,7 @@ static struct sched_lock *the_BigLock; static void print_sched_event ( ThreadId tid, const HChar* what ) { - VG_(message)(Vg_DebugMsg, " SCHED[%d]: %s\n", tid, what ); + VG_(message)(Vg_DebugMsg, " SCHED[%u]: %s\n", tid, what ); } /* For showing SB profiles, if the user asks to see them. */ @@ -286,7 +286,7 @@ void VG_(acquire_BigLock)(ThreadId tid, const HChar* who) tst->status = VgTs_Runnable; if (VG_(running_tid) != VG_INVALID_THREADID) - VG_(printf)("tid %d found %d running\n", tid, VG_(running_tid)); + VG_(printf)("tid %u found %u running\n", tid, VG_(running_tid)); vg_assert(VG_(running_tid) == VG_INVALID_THREADID); VG_(running_tid) = tid; @@ -401,7 +401,7 @@ void VG_(get_thread_out_of_syscall)(ThreadId tid) if (VG_(threads)[tid].status == VgTs_WaitSys) { if (VG_(clo_trace_signals)) { VG_(message)(Vg_DebugMsg, - "get_thread_out_of_syscall zaps tid %d lwp %d\n", + "get_thread_out_of_syscall zaps tid %u lwp %d\n", tid, VG_(threads)[tid].os_state.lwpid); } # if defined(VGO_darwin) @@ -664,8 +664,8 @@ void VG_(scheduler_init_phase2) ( ThreadId tid_main, Addr clstack_end, SizeT clstack_size ) { - VG_(debugLog)(1,"sched","sched_init_phase2: tid_main=%d, " - "cls_end=0x%lx, cls_sz=%ld\n", + VG_(debugLog)(1,"sched","sched_init_phase2: tid_main=%u, " + "cls_end=0x%lx, cls_sz=%lu\n", tid_main, clstack_end, clstack_size); vg_assert(VG_IS_PAGE_ALIGNED(clstack_end+1)); @@ -697,7 +697,7 @@ void VG_(scheduler_init_phase2) ( ThreadId tid_main, _qq_tst->sched_jmpbuf_valid = True; \ stmt; \ } else if (VG_(clo_trace_sched)) \ - VG_(printf)("SCHEDSETJMP(line %d) tid %d, jumped=%ld\n", \ + VG_(printf)("SCHEDSETJMP(line %d) tid %u, jumped=%lu\n", \ __LINE__, tid, jumped); \ vg_assert(_qq_tst->sched_jmpbuf_valid); \ _qq_tst->sched_jmpbuf_valid = False; \ @@ -723,8 +723,8 @@ static void do_pre_run_checks ( volatile ThreadState* tst ) UInt sz_spill = (UInt) sizeof tst->arch.vex_spill; if (0) - VG_(printf)("gst %p %d, sh1 %p %d, " - "sh2 %p %d, spill %p %d\n", + VG_(printf)("gst %p %u, sh1 %p %u, " + "sh2 %p %u, spill %p %u\n", (void*)a_vex, sz_vex, (void*)a_vexsh1, sz_vexsh1, (void*)a_vexsh2, sz_vexsh2, @@ -929,7 +929,7 @@ void run_thread_for_a_while ( /*OUT*/HWord* two_words, vki_sigset_t m; Int i, err = VG_(sigprocmask)(VKI_SIG_SETMASK, NULL, &m); vg_assert(err == 0); - VG_(printf)("tid %d: entering code with unblocked signals: ", tid); + VG_(printf)("tid %u: entering code with unblocked signals: ", tid); for (i = 1; i <= _VKI_NSIG; i++) if (!VG_(sigismember)(&m, i)) VG_(printf)("%d ", i); @@ -1110,7 +1110,7 @@ static void handle_syscall(ThreadId tid, UInt trc) if (VG_(clo_sanity_level) >= 3) { HChar buf[50]; // large enough - VG_(sprintf)(buf, "(BEFORE SYSCALL, tid %d)", tid); + VG_(sprintf)(buf, "(BEFORE SYSCALL, tid %u)", tid); Bool ok = VG_(am_do_sync_check)(buf, __FILE__, __LINE__); vg_assert(ok); } @@ -1119,13 +1119,13 @@ static void handle_syscall(ThreadId tid, UInt trc) if (VG_(clo_sanity_level) >= 3) { HChar buf[50]; // large enough - VG_(sprintf)(buf, "(AFTER SYSCALL, tid %d)", tid); + VG_(sprintf)(buf, "(AFTER SYSCALL, tid %u)", tid); Bool ok = VG_(am_do_sync_check)(buf, __FILE__, __LINE__); vg_assert(ok); } if (!VG_(is_running_thread)(tid)) - VG_(printf)("tid %d not running; VG_(running_tid)=%d, tid %d status %d\n", + VG_(printf)("tid %u not running; VG_(running_tid)=%u, tid %u status %u\n", tid, VG_(running_tid), tid, tst->status); vg_assert(VG_(is_running_thread)(tid)); @@ -1329,7 +1329,7 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid ) n_scheduling_events_MINOR++; if (0) - VG_(message)(Vg_DebugMsg, "thread %d: running for %d bbs\n", + VG_(message)(Vg_DebugMsg, "thread %u: running for %d bbs\n", tid, dispatch_ctr - 1 ); HWord trc[2]; /* "two_words" */ @@ -1670,7 +1670,7 @@ void VG_(nuke_all_threads_except) ( ThreadId me, VgSchedReturnCode src ) continue; if (0) VG_(printf)( - "VG_(nuke_all_threads_except): nuking tid %d\n", tid); + "VG_(nuke_all_threads_except): nuking tid %u\n", tid); VG_(threads)[tid].exitreason = src; if (src == VgSrc_FatalSig) @@ -1813,7 +1813,7 @@ Int print_client_message( ThreadId tid, const HChar *format, *q = '\0'; VG_(printf_xml)( "\n" ); - VG_(printf_xml)( " %d\n", tid ); + VG_(printf_xml)( " %u\n", tid ); const ThreadState *tst = VG_(get_ThreadState)(tid); if (tst->thread_name) VG_(printf_xml)(" %s\n", tst->thread_name); @@ -1846,7 +1846,7 @@ void do_client_request ( ThreadId tid ) UWord req_no = arg[0]; if (0) - VG_(printf)("req no = 0x%llx, arg = %p\n", (ULong)req_no, arg); + VG_(printf)("req no = 0x%lx, arg = %p\n", req_no, arg); switch (req_no) { case VG_USERREQ__CLIENT_CALL0: { @@ -2161,22 +2161,22 @@ void scheduler_sanity ( ThreadId tid ) if (!VG_(is_running_thread)(tid)) { VG_(message)(Vg_DebugMsg, - "Thread %d is supposed to be running, " - "but doesn't own the_BigLock (owned by %d)\n", + "Thread %u is supposed to be running, " + "but doesn't own the_BigLock (owned by %u)\n", tid, VG_(running_tid)); bad = True; } if (lwpid != VG_(threads)[tid].os_state.lwpid) { VG_(message)(Vg_DebugMsg, - "Thread %d supposed to be in LWP %d, but we're actually %d\n", + "Thread %u supposed to be in LWP %d, but we're actually %d\n", tid, VG_(threads)[tid].os_state.lwpid, VG_(gettid)()); bad = True; } if (lwpid != ML_(get_sched_lock_owner)(the_BigLock)) { VG_(message)(Vg_DebugMsg, - "Thread (LWPID) %d doesn't own the_BigLock\n", + "Thread (LWPID) %u doesn't own the_BigLock\n", tid); bad = True; } @@ -2234,7 +2234,7 @@ void VG_(sanity_check_general) ( Bool force_expensive ) || (VG_(clo_sanity_level) == 1 && sanity_fast_count == next_slow_check_at)) { - if (0) VG_(printf)("SLOW at %d\n", sanity_fast_count-1); + if (0) VG_(printf)("SLOW at %u\n", sanity_fast_count-1); next_slow_check_at = sanity_fast_count - 1 + slow_check_interval; slow_check_interval++; @@ -2262,7 +2262,7 @@ void VG_(sanity_check_general) ( Bool force_expensive ) = VG_(am_get_VgStack_unused_szB)(stack, limit); if (remains < limit) VG_(message)(Vg_DebugMsg, - "WARNING: Thread %d is within %ld bytes " + "WARNING: Thread %u is within %lu bytes " "of running out of valgrind stack!\n" "Valgrind stack size can be increased " "using --valgrind-stacksize=....\n", diff --git a/coregrind/m_scheduler/ticket-lock-linux.c b/coregrind/m_scheduler/ticket-lock-linux.c index 583360bf35..92a41a7803 100644 --- a/coregrind/m_scheduler/ticket-lock-linux.c +++ b/coregrind/m_scheduler/ticket-lock-linux.c @@ -120,7 +120,7 @@ static void acquire_sched_lock(struct sched_lock *p) ticket = __sync_fetch_and_add(&p->tail, 1); futex = &p->futex[ticket & TL_FUTEX_MASK]; if (s_debug) - VG_(printf)("[%d/%d] acquire: ticket %d\n", VG_(getpid)(), + VG_(printf)("[%d/%d] acquire: ticket %u\n", VG_(getpid)(), VG_(gettid)(), ticket); for (;;) { futex_value = *futex; @@ -128,15 +128,15 @@ static void acquire_sched_lock(struct sched_lock *p) if (ticket == p->head) break; if (s_debug) - VG_(printf)("[%d/%d] acquire: ticket %d - waiting until" - " futex[%ld] != %d\n", VG_(getpid)(), + VG_(printf)("[%d/%d] acquire: ticket %u - waiting until" + " futex[%ld] != %u\n", VG_(getpid)(), VG_(gettid)(), ticket, (long)(futex - p->futex), futex_value); sres = VG_(do_syscall3)(__NR_futex, (UWord)futex, VKI_FUTEX_WAIT | VKI_FUTEX_PRIVATE_FLAG, futex_value); if (sr_isError(sres) && sr_Err(sres) != VKI_EAGAIN) { - VG_(printf)("futex_wait() returned error code %ld\n", sr_Err(sres)); + VG_(printf)("futex_wait() returned error code %lu\n", sr_Err(sres)); vg_assert(False); } } @@ -169,7 +169,7 @@ static void release_sched_lock(struct sched_lock *p) futex = &p->futex[wakeup_ticket & TL_FUTEX_MASK]; futex_value = __sync_fetch_and_add(futex, 1); if (s_debug) - VG_(printf)("[%d/%d] release: waking up ticket %d (futex[%ld] = %d)" + VG_(printf)("[%d/%d] release: waking up ticket %u (futex[%ld] = %u)" "\n", VG_(getpid)(), VG_(gettid)(), wakeup_ticket, (long)(futex - p->futex), futex_value); sres = VG_(do_syscall3)(__NR_futex, (UWord)futex, @@ -178,7 +178,7 @@ static void release_sched_lock(struct sched_lock *p) vg_assert(!sr_isError(sres)); } else { if (s_debug) - VG_(printf)("[%d/%d] release: no thread is waiting for ticket %d\n", + VG_(printf)("[%d/%d] release: no thread is waiting for ticket %u\n", VG_(getpid)(), VG_(gettid)(), wakeup_ticket); } }