dwarf2read.c: Don't assume uint32_t is unsigned int on all hosts.
authorPedro Alves <palves@redhat.com>
Thu, 23 May 2013 18:31:29 +0000 (18:31 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 23 May 2013 18:31:29 +0000 (18:31 +0000)
Building gdb on GNU/Linux, for --host=i586-pc-msdosdjgpp, I get:

 ../../src/gdb/dwarf2read.c: In function 'create_dwp_hash_table':
 ../../src/gdb/dwarf2read.c:8626:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c:8632:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c: In function 'create_dwo_in_dwp':
 ../../src/gdb/dwarf2read.c:8754:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c: In function 'open_and_init_dwp_file':
 ../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Werror=format]
 ../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Werror=format]

And:

 $ grep uint32_t /usr/i586-pc-msdosdjgpp/sys-include/*
 /usr/i586-pc-msdosdjgpp/sys-include/stdint.h:typedef unsigned long uint32_t;

As decided on the discussion at
<http://sourceware.org/ml/gdb-patches/2013-05/msg00788.html>, use
pulongest rather than PRIu32.

Tested on F17.  Also confirmed GDB still builds OK with
--host=i686-w64-mingw32.

gdb/
2013-05-23  Pedro Alves  <palves@redhat.com>

* dwarf2read.c (create_dwp_hash_table, create_dwo_in_dwp)
(open_and_init_dwp_file): Use %s/pulongest instead of %u for
printing uint32_t variables.

gdb/ChangeLog
gdb/dwarf2read.c

index 5baaf272f76154c37ef1f1facdcda121d2aabd33..194fb851446aaf1faabeff50f1398ace14e55f44 100644 (file)
@@ -1,3 +1,9 @@
+2013-05-23  Pedro Alves  <palves@redhat.com>
+
+       * dwarf2read.c (create_dwp_hash_table, create_dwo_in_dwp)
+       (open_and_init_dwp_file): Use %s/pulongest instead of %u for
+       printing uint32_t variables.
+
 2013-05-23  Pedro Alves  <palves@redhat.com>
 
        * NEWS: Mention GDBserver range stepping support.
index b819d3c4e48e6b89b6c200dc2d0431e688ee4407..092a801fcd2c04595e73c862adcea60f044c9c69 100644 (file)
@@ -8960,15 +8960,15 @@ create_dwp_hash_table (struct dwp_file *dwp_file, int is_debug_types)
 
   if (version != 1)
     {
-      error (_("Dwarf Error: unsupported DWP file version (%u)"
+      error (_("Dwarf Error: unsupported DWP file version (%s)"
               " [in module %s]"),
-            version, dwp_file->name);
+            pulongest (version), dwp_file->name);
     }
   if (nr_slots != (nr_slots & -nr_slots))
     {
-      error (_("Dwarf Error: number of slots in DWP hash table (%u)"
+      error (_("Dwarf Error: number of slots in DWP hash table (%s)"
               " is not power of 2 [in module %s]"),
-            nr_slots, dwp_file->name);
+            pulongest (nr_slots), dwp_file->name);
     }
 
   htab = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwp_hash_table);
@@ -9087,9 +9087,9 @@ create_dwo_in_dwp (struct dwp_file *dwp_file,
 
   if (dwarf2_read_debug)
     {
-      fprintf_unfiltered (gdb_stdlog, "Reading %s %u/%s in DWP file: %s\n",
+      fprintf_unfiltered (gdb_stdlog, "Reading %s %s/%s in DWP file: %s\n",
                          kind,
-                         section_index, hex_string (signature),
+                         pulongest (section_index), hex_string (signature),
                          dwp_file->name);
     }
 
@@ -9582,9 +9582,9 @@ open_and_init_dwp_file (void)
     {
       fprintf_unfiltered (gdb_stdlog, "DWP file found: %s\n", dwp_file->name);
       fprintf_unfiltered (gdb_stdlog,
-                         "    %u CUs, %u TUs\n",
-                         dwp_file->cus ? dwp_file->cus->nr_units : 0,
-                         dwp_file->tus ? dwp_file->tus->nr_units : 0);
+                         "    %s CUs, %s TUs\n",
+                         pulongest (dwp_file->cus ? dwp_file->cus->nr_units : 0),
+                         pulongest (dwp_file->tus ? dwp_file->tus->nr_units : 0));
     }
 
   return dwp_file;
This page took 0.037734 seconds and 4 git commands to generate.