public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [google gcc-4_9] Fix bad LIPO profile produced by gcov-tool
@ 2015-12-02  0:34 Rong Xu
       [not found] ` <CAAkRFZJTz5AWcNgwqKO6vdT_iKdpT7_hmYw6q14N+sD+3R+adg@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Rong Xu @ 2015-12-02  0:34 UTC (permalink / raw)
  To: GCC Patches; +Cc: David Li

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

Hi,

This patch fixes the issue when using gcov-tool to merge LIPO profiles
after we compressing the module infomration . We should not decompress
the string as the compressed string should be written directly to the
profile later. Tested with some LIPO profiles.

Thanks,

-Rong

[-- Attachment #2: gcc_patch.txt --]
[-- Type: text/plain, Size: 2363 bytes --]

2015-12-01  Rong Xu  <xur@google.com>

	* gcov-dump.c (tag_module_info): Dump string information.
	* gcov-io.c (gcov_read_module_info): record combined_len
          and don't uncompress in gcov-tool.

Index: gcov-dump.c
===================================================================
--- gcov-dump.c	(revision 231134)
+++ gcov-dump.c	(working copy)
@@ -588,6 +588,11 @@ tag_module_info (const char *filename ATTRIBUTE_UN
     {
       if (!mod_info->is_primary)
 	printf ("%s\n", mod_info->source_filename);
+      unsigned short compressed_size = mod_info->combined_strlen;
+      unsigned short uncompressed_size = mod_info->combined_strlen>>16;
+      printf ("compressed_ strlen=%d uncompressed_strlen=%d String:\n",
+              compressed_size,uncompressed_size);
+      printf ("%s\n", mod_info->saved_cc1_strings);
     }
   else
     {
Index: gcov-io.c
===================================================================
--- gcov-io.c	(revision 231134)
+++ gcov-io.c	(working copy)
@@ -835,16 +835,18 @@ gcov_read_module_info (struct gcov_module_info *mo
   len -= (src_filename_len + 1);
 
   saved_compressed_len = (unsigned long) gcov_read_unsigned ();
-  saved_uncompressed_len  = saved_compressed_len >> 16;
-  saved_compressed_len &= 0xFFFF;
+  mod_info->combined_strlen = saved_compressed_len;
   tag_len = gcov_read_unsigned ();
   len -= (tag_len + 2);
   gcc_assert (!len);
   compressed_array = (char *) xmalloc (tag_len * sizeof (gcov_unsigned_t));
-  uncompressed_array = (char *) xmalloc (saved_uncompressed_len);
   for (i = 0; i < tag_len; i++)
     ((gcov_unsigned_t *) compressed_array)[i] = gcov_read_unsigned ();
 
+#if !defined (IN_GCOV_TOOL)
+  saved_uncompressed_len  = saved_compressed_len >> 16;
+  saved_compressed_len &= 0xFFFF;
+  uncompressed_array = (char *) xmalloc (saved_uncompressed_len);
   result_len = saved_uncompressed_len;
   uncompress ((Bytef *)uncompressed_array, &result_len,
               (const Bytef *)compressed_array, saved_compressed_len);
@@ -851,6 +853,9 @@ gcov_read_module_info (struct gcov_module_info *mo
   gcc_assert (result_len == saved_uncompressed_len);
   mod_info->saved_cc1_strings = uncompressed_array;
   free (compressed_array);
+#else /* IN_GCOV_TOOL: we don't need to uncompress. It's a pass through.  */
+  mod_info->saved_cc1_strings = compressed_array;
+#endif
 }
 #endif
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-02  1:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-02  0:34 [google gcc-4_9] Fix bad LIPO profile produced by gcov-tool Rong Xu
     [not found] ` <CAAkRFZJTz5AWcNgwqKO6vdT_iKdpT7_hmYw6q14N+sD+3R+adg@mail.gmail.com>
2015-12-02  0:53   ` Rong Xu
2015-12-02  1:12     ` Xinliang David Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).