]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness.
authorFlorian Krohm <florian@eich-krohm.de>
Thu, 6 Aug 2015 12:11:33 +0000 (12:11 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Thu, 6 Aug 2015 12:11:33 +0000 (12:11 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15503

coregrind/m_gdbserver/m_gdbserver.c
coregrind/m_gdbserver/remote-utils.c
coregrind/m_gdbserver/server.c
coregrind/m_gdbserver/signals.c
coregrind/m_gdbserver/target.c
coregrind/m_gdbserver/utils.c

index 87b5b45156d5c10542857bdcdeb2f25cc9d487a5..15de26b653d8cd669779f859fa6d5c53217221f7 100644 (file)
@@ -425,7 +425,7 @@ Bool VG_(is_watched)(PointKind kind, Addr addr, Int szB)
    vg_assert (kind == access_watchpoint 
               || kind == read_watchpoint 
               || kind == write_watchpoint);
-   dlog(1, "tid %d VG_(is_watched) %s addr %p szB %d\n",
+   dlog(1, "tid %u VG_(is_watched) %s addr %p szB %d\n",
         tid, VG_(ppPointKind) (kind), C2v(addr), szB);
 
    for (i = 0; i < n_elems; i++) {
@@ -622,7 +622,7 @@ void VG_(gdbserver_prerun_action) (ThreadId tid)
    data from its parent */
 static void gdbserver_cleanup_in_child_after_fork(ThreadId me)
 {
-   dlog(1, "thread %d gdbserver_cleanup_in_child_after_fork pid %d\n",
+   dlog(1, "thread %u gdbserver_cleanup_in_child_after_fork pid %d\n",
         me, VG_(getpid) ());
 
    /* finish connection inheritated from parent */
@@ -663,7 +663,7 @@ static void call_gdbserver ( ThreadId tid , CallReason reason)
    Addr saved_pc;
 
    dlog(1, 
-        "entering call_gdbserver %s ... pid %d tid %d status %s "
+        "entering call_gdbserver %s ... pid %d tid %u status %s "
         "sched_jmpbuf_valid %d\n",
         ppCallReason (reason),
         VG_(getpid) (), tid, VG_(name_of_ThreadStatus)(tst->status),
@@ -754,7 +754,7 @@ static void call_gdbserver ( ThreadId tid , CallReason reason)
       Otherwise we just return to continue executing the
       current block. */
    if (VG_(get_IP) (tid) != saved_pc) {
-      dlog(1, "tid %d %s PC changed from %s to %s\n",
+      dlog(1, "tid %u %s PC changed from %s to %s\n",
            tid, VG_(name_of_ThreadStatus) (tst->status),
            sym(saved_pc, /* is_code */ True),
            sym(VG_(get_IP) (tid), /* is_code */ True));
@@ -841,7 +841,7 @@ static void give_control_back_to_vgdb(void)
       ptrace handling. */
    vg_assert2(0, 
               "vgdb did not took control. Did you kill vgdb ?\n"
-              "busy %d vgdb_interrupted_tid %d\n",
+              "busy %d vgdb_interrupted_tid %u\n",
               busy, vgdb_interrupted_tid);
 #else /* defined(VGO_solaris) */
    /* On Solaris, this code is run within the context of an agent thread
@@ -912,12 +912,12 @@ void VG_(invoke_gdbserver) ( int check )
       From here onwards, function calls are ok: it is
       safe to call valgrind core functions: all threads are blocked in
       a system call or are yielding or ... */
-   dlog(1, "invoke_gdbserver running_tid %d vgdb_interrupted_tid %d\n",
+   dlog(1, "invoke_gdbserver running_tid %u vgdb_interrupted_tid %u\n",
         VG_(running_tid), vgdb_interrupted_tid);
    call_gdbserver (vgdb_interrupted_tid, vgdb_reason);
    vgdb_interrupted_tid = 0;
    dlog(1,
-        "exit invoke_gdbserver running_tid %d\n", VG_(running_tid));
+        "exit invoke_gdbserver running_tid %u\n", VG_(running_tid));
    give_control_back_to_vgdb();
 
    vg_assert2(0, "end of invoke_gdbserver reached");
@@ -948,7 +948,7 @@ static void dlog_signal (const HChar *who, const vki_siginfo_t *info,
                          ThreadId tid)
 {
    dlog(1, "VG core calling %s "
-        "vki_nr %d %s gdb_nr %d %s tid %d\n", 
+        "vki_nr %d %s gdb_nr %u %s tid %u\n", 
         who,
         info->si_signo, VG_(signame)(info->si_signo),
         target_signal_from_host (info->si_signo),
@@ -1014,7 +1014,7 @@ Bool VG_(gdbserver_report_signal) (vki_siginfo_t *info, ThreadId tid)
 
 void VG_(gdbserver_exit) (ThreadId tid, VgSchedReturnCode tids_schedretcode)
 {
-   dlog(1, "VG core calling VG_(gdbserver_exit) tid %d will exit\n", tid);
+   dlog(1, "VG core calling VG_(gdbserver_exit) tid %u will exit\n", tid);
    if (remote_connected()) {
       /* Make sure vgdb knows we are about to die and why. */
       switch(tids_schedretcode) {
@@ -1505,7 +1505,7 @@ void VG_(gdbserver_status_output)(void)
    VG_(umsg)
       ("nr of calls to gdbserver: %d\n"
        "single stepping %d\n"
-       "interrupts intr_tid %d gs_non_busy %d gs_busy %d tid_non_intr %d\n"
+       "interrupts intr_tid %u gs_non_busy %d gs_busy %d tid_non_intr %d\n"
        "gdbserved addresses %d (-1 = not initialized)\n"
        "watchpoints %d (-1 = not initialized)\n"
        "vgdb-error %d\n"
index 978e07c8b38caa22281ca0ef65c250cabca19fa2..df56b63272bea45bfc217da1c8df321a62e4ddba 100644 (file)
@@ -53,7 +53,7 @@ void sr_extended_perror (SysRes sr, const HChar *msg)
       VG_(dmsg)("current sigmask value { ");
       for (i = 1; i <= _VKI_NSIG; i++) {
          if (VG_(sigismember)(&cursigset, i))
-            VG_(dmsg)("%u ", i);
+            VG_(dmsg)("%d ", i);
       }
       VG_(dmsg)("}\n");
    }
@@ -598,7 +598,7 @@ int fromhex (int a)
    else if (a >= 'a' && a <= 'f')
       return a - 'a' + 10;
    else
-      error ("Reply contains invalid hex digit 0x%x\n", a);
+     error ("Reply contains invalid hex digit 0x%x\n", (unsigned)a);
    return 0;
 }
 
@@ -878,7 +878,7 @@ int putpkt_binary (char *buf, int cnt)
 
       cc = readchar (1);
       if (cc > 0)
-         dlog(3, "[received '%c' (0x%x)]\n", cc, cc);
+         dlog(3, "[received '%c' (0x%x)]\n", cc, (unsigned)cc);
 
       if (cc <= 0) {
          if (cc == 0)
@@ -1038,7 +1038,7 @@ int getpkt (char *buf)
          break;
 
       dlog (0, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
-            (c1 << 4) + c2, csum, buf);
+            (unsigned)(c1 << 4) + c2, (unsigned)csum, buf);
       if (!ensure_write_remote_desc()) {
          dlog(1, "getpkt(write nack) no write_remote_desc");
       }
@@ -1164,7 +1164,7 @@ void prepare_resume_reply (char *buf, char status, unsigned char sig)
             ((struct inferior_list_entry *)current_inferior)->id;
          gdb_id_from_wait = thread_to_gdb_id (current_inferior);
          
-         dlog(1, "Writing resume reply for %ld\n", thread_from_wait);
+         dlog(1, "Writing resume reply for %lu\n", thread_from_wait);
          /* This if (1) ought to be unnecessary.  But remote_wait in GDB
             will claim this event belongs to inferior_ptid if we do not
             specify a thread, and there's no way for gdbserver to know
index 29290e31ae918ceddd5b757758e96bc198cfc6a9..23a43e0a9b33a6fc89e5c264b20599092dc068ef 100644 (file)
@@ -375,7 +375,7 @@ int handle_gdb_valgrind_command (char *mon, OutputSink *sink_wanted_at_return)
          VG_(show_all_errors)(/* verbosity */ 2, /* xml */ False);
          break;
       case  1: // n_errs_found
-         VG_(printf) ("n_errs_found %d n_errs_shown %d (vgdb-error %d) %s\n",
+         VG_(printf) ("n_errs_found %u n_errs_shown %u (vgdb-error %d) %s\n",
                       VG_(get_n_errs_found) (),
                       VG_(get_n_errs_shown) (),
                       VG_(dyn_vgdb_error),
@@ -763,12 +763,12 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p)
             len = (PBUFSIZ + POVERHSIZ) / 2;
          char status[len];
          if (tst->thread_name) {
-            VG_(snprintf) (status, sizeof(status), "tid %d %s %s",
+            VG_(snprintf) (status, sizeof(status), "tid %u %s %s",
                            tst->tid, 
                            VG_(name_of_ThreadStatus)(tst->status),
                            tst->thread_name);
          } else {
-            VG_(snprintf) (status, sizeof(status), "tid %d %s",
+            VG_(snprintf) (status, sizeof(status), "tid %u %s",
                            tst->tid, 
                            VG_(name_of_ThreadStatus)(tst->status));
          }
@@ -900,7 +900,7 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p)
          UWord *client_auxv = VG_(client_auxv);
          unsigned int client_auxv_len = 0;
          while (*client_auxv != 0) {
-            dlog(4, "auxv %lld %llx\n",
+            dlog(4, "auxv %llu %llx\n",
                  (ULong)*client_auxv,
                  (ULong)*(client_auxv+1));
             client_auxv++;
@@ -908,7 +908,7 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p)
             client_auxv_len += 2 * sizeof(UWord);
          }
          client_auxv_len += 2 * sizeof(UWord);
-         dlog(4, "auxv len %d\n", client_auxv_len);
+         dlog(4, "auxv len %u\n", client_auxv_len);
 
          if (ofs >= client_auxv_len)
             n = -1;
@@ -1030,7 +1030,7 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p)
    /* Protocol features query.  */
    if (strncmp ("qSupported", arg_own_buf, 10) == 0
        && (arg_own_buf[10] == ':' || arg_own_buf[10] == '\0')) {
-      VG_(sprintf) (arg_own_buf, "PacketSize=%x", PBUFSIZ - 1);
+      VG_(sprintf) (arg_own_buf, "PacketSize=%x", (UInt)PBUFSIZ - 1);
       /* Note: max packet size including frame and checksum, but without
          trailing null byte, which is not sent/received. */
 
@@ -1414,7 +1414,7 @@ void server_main (void)
          VG_(umsg) ("\nChild exited with status %d\n", zignal);
       if (status == 'X')
          VG_(umsg) ("\nChild terminated with signal = 0x%x (%s)\n",
-                    target_signal_to_host (zignal),
+                    (UInt)target_signal_to_host (zignal),
                     target_signal_to_name (zignal));
       if (status == 'W' || status == 'X') {
          VG_(umsg) ("Process exiting\n");
index 69aa9b183a080de127e6a107839249bace77f2fb..a9128a6ea547b8ad555a134028f86668a16130ce 100644 (file)
@@ -741,7 +741,7 @@ int do_target_signal_to_host (enum target_signal oursig,
       }
 #endif
       error ("Valgrind GDBSERVER bug: (do_target_signal_to_host):"
-             " unrecognized target signal %d\n", oursig);
+             " unrecognized target signal %u\n", oursig);
       *oursig_ok = 0;
       return 0;
    }
index 64ce5a31e848c28fc26c1486f54421e9642494c1..3d54b7503b2e4c25ad12d0eb50653956d46a50a0 100644 (file)
@@ -44,7 +44,7 @@ static
 char *image_ptid(unsigned long ptid)
 {
   static char result[50];    // large enough
-  VG_(sprintf) (result, "id %ld", ptid);
+  VG_(sprintf) (result, "id %lu", ptid);
   return result;
 }
 #define get_thread(inf) ((struct thread_info *)(inf))
@@ -74,7 +74,7 @@ void valgrind_update_threads (int pid)
   /* call add_thread for all valgrind threads not known in gdb all_threads */
   for (tid = 1; tid < VG_N_THREADS; tid++) {
 
-#define LOCAL_THREAD_TRACE " ti* %p vgtid %d status %s as gdb ptid %s lwpid %d\n", \
+#define LOCAL_THREAD_TRACE " ti* %p vgtid %u status %s as gdb ptid %s lwpid %d\n", \
         ti, tid, VG_(name_of_ThreadStatus) (ts->status), \
         image_ptid (ptid), ts->os_state.lwpid
 
@@ -293,7 +293,7 @@ unsigned char valgrind_wait (char *ourstatus)
       if (*ourstatus == 'X') {
          sig = target_signal_from_host(exit_code_to_report);
          exit_code_to_report = 0;
-         dlog(1, "exit valgrind_wait status X signal %d\n", sig);
+         dlog(1, "exit valgrind_wait status X signal %u\n", sig);
          return sig;
       }
    }
@@ -320,7 +320,7 @@ unsigned char valgrind_wait (char *ourstatus)
    stop_pc = (*the_low_target.get_pc) ();
    
    dlog(1,
-        "exit valgrind_wait status T ptid %s stop_pc %s signal %d\n", 
+        "exit valgrind_wait status T ptid %s stop_pc %s signal %u\n", 
         image_ptid (wptid), sym (stop_pc), sig);
    return sig;
 }
@@ -351,7 +351,7 @@ void fetch_register (int regno)
       if (mod && VG_(debugLog_getLevel)() > 1) {
          char bufimage [2*size + 1];
          heximage (bufimage, buf, size);
-         dlog(3, "fetched register %d size %d name %s value %s tid %d status %s\n", 
+         dlog(3, "fetched register %d size %d name %s value %s tid %u status %s\n", 
               regno, size, the_low_target.reg_defs[regno].name, bufimage, 
               tid, VG_(name_of_ThreadStatus) (tst->status));
       }
@@ -419,7 +419,7 @@ void usr_store_inferior_registers (int regno)
             heximage (bufimage, buf, size);
             dlog(2, 
                  "stored register %d size %d name %s value %s "
-                 "tid %d status %s\n", 
+                 "tid %u status %s\n", 
                  regno, size, the_low_target.reg_defs[regno].name, bufimage, 
                  tid, VG_(name_of_ThreadStatus) (tst->status));
          }
@@ -681,7 +681,7 @@ Bool valgrind_get_tls_addr (ThreadState *tst,
 
    // Check we can read at least 2 address at the beginning of dtv.
    CHECK_DEREF(dtv, 2*sizeof(CORE_ADDR), "dtv 2 first entries");
-   dlog (2, "tid %d dtv %p\n", tst->tid, (void*)dtv);
+   dlog (2, "tid %u dtv %p\n", tst->tid, (void*)dtv);
 
    // Check we can read the modid
    CHECK_DEREF(lm+lm_modid_offset, sizeof(unsigned long int), "link_map modid");
@@ -766,7 +766,7 @@ void set_desired_inferior (int use_general)
   {
      ThreadState *tst = (ThreadState *) inferior_target_data (current_inferior);
      ThreadId tid = tst->tid;
-     dlog(1, "set_desired_inferior use_general %d found %p tid %d lwpid %d\n",
+     dlog(1, "set_desired_inferior use_general %d found %p tid %u lwpid %d\n",
           use_general, found, tid, tst->os_state.lwpid);
   }
 }
index 511b1e60570743c64fcce8680c473058c5b529c5..83295a195c9419e8dd3d79a64ea1952d57b1592f 100644 (file)
@@ -30,7 +30,7 @@ void sr_perror (SysRes sr, const char *string,...)
 {
    va_list args;
    if (sr_isError (sr))
-      VG_(umsg) ("error %ld %s\n", sr_Err(sr), VG_(strerror) (sr_Err(sr)));
+      VG_(umsg) ("error %lu %s\n", sr_Err(sr), VG_(strerror) (sr_Err(sr)));
    else
       VG_(umsg) ("sr_perror called with no error!!!\n");
    va_start (args, string);