[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[committed] Use actual die count in multifile mode for unchanged files



Hi,

Using a debug patch, we get:
...
$ cp hello 1; dwz 1 --devel-trace
Compressing 1
Using die count estimate 133
$ cp 1 2; dwz -m 3 1 2 --devel-trace
Compressing 1
Using die count estimate 111
dwz: 1: DWARF compression not beneficial - old size 3360 new size 3360
Write-multifile 1
Compressing 2
Using die count estimate 111
dwz: 2: DWARF compression not beneficial - old size 3360 new size 3360
Write-multifile 2
Optimize-multifile
Read-multifile
Using die count 24
Compressing 1 in finalize-multifile mode
Using die count estimate 111
Compressing 2 in finalize-multifile mode
Using die count estimate 111
...

We're using die count estimates in finalize-multifile mode, because the die
count is only set during write_info, and in this case that's not triggered.

Also set die count in read_debug_info, giving us:
...
 $ cp hello 1; dwz 1 --devel-trace
 Compressing 1
 Using die count estimate 133
 $ cp 1 2; dwz -m 3 1 2 --devel-trace
 Compressing 1
 Using die count estimate 111
 dwz: 1: DWARF compression not beneficial - old size 3360 new size 3360
 Write-multifile 1
 Compressing 2
 Using die count estimate 111
 dwz: 2: DWARF compression not beneficial - old size 3360 new size 3360
 Write-multifile 2
 Optimize-multifile
 Read-multifile
 Using die count 24
 Compressing 1 in finalize-multifile mode
-Using die count estimate 111
+Using die count 123
 Compressing 2 in finalize-multifile mode
-Using die count estimate 111
+Using die count 123
...

Committed to trunk.

Thanks,
- Tom

Use actual die count in multifile mode for unchanged files

2019-11-25  Tom de Vries  <tdevries@suse.de>

	* dwz.c (read_debug_info): Initialize dies_count.
	(write_info): Initialize dies_count.

---
 dwz.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dwz.c b/dwz.c
index a4073c3..fc41b0e 100644
--- a/dwz.c
+++ b/dwz.c
@@ -5671,6 +5671,8 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count)
       return 0;
     }
 
+  if (die_count)
+    *die_count = ndies;
   htab_delete (dup_htab);
   dup_htab = NULL;
   return 0;
@@ -9862,6 +9864,8 @@ write_info (unsigned int *die_count)
 
   if (info == NULL)
     dwz_oom ();
+  if (die_count)
+    *die_count = 0;
   debug_sections[DEBUG_INFO].new_data = info;
   cu = first_cu;
   if (unlikely (fi_multifile))