public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Add --devel-unoptimized-multifile
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

There is functionality enabled by -DDEBUG_OP_MULTIFILE.  This skips the
optimization step in optimize_multifile, and instead copies the aggregate file
(the virtual file described by the per-section temporary files) to the
multifile.

The aggregate file ends with a compilation unit without any DIE, so we run
into this error:
...
$ cp hello 1
$ cp 1 2
$ dwz -m 3 1 2
./dwz: 3: .debug_info section chunk doesn't contain a single compile_unit or \
  partial_unit
...
which has the effect that the finalize_multifile step is skipped as well.

The DWARF in the resulting multifile is the same as (using dwz without
-DDEBUG_OP_MULTIFILE) in dwz.debug_all:
...
$ cp hello 1
$ cp 1 2
$ dwz -m 3 1 2 --devel-save-temps
$ ../src/contrib/gen-dwz-debug-all.sh
...

The only difference is that:
- dwz.debug_all is created directly by objcopy from the per-section temporary
  files, and
- the multifile is created by dwz after reading in the per-section temporary
  files.

Given the almost duplicate functionality, I'm not sure if we still need this.
But for now, keep this functionality, and make it available using
--devel-unoptimized-multifile.

Committed to trunk.

Thanks,
- Tom

Add --devel-unoptimized-multifile

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

	* dwz.c (unoptimized_multifile): New var.
	(optimize_multifile): Handle unoptimized_multifile.
	(dwz_options): Add --devel-unoptimized-multifile entry.

---
 dwz.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/dwz.c b/dwz.c
index 7593f68..6e1c997 100644
--- a/dwz.c
+++ b/dwz.c
@@ -157,6 +157,7 @@ static int dump_dies_p;
 #define ignore_locus 0
 #define dump_dies_p 0
 #endif
+static int unoptimized_multifile;
 static int save_temps = 0;
 
 typedef struct
@@ -12100,8 +12101,7 @@ optimize_multifile (void)
   multifile_mode = MULTIFILE_MODE_OP;
 
   obstack_alloc_failed_handler = dwz_oom;
-#ifdef DEBUG_OP_MULTIFILE
-  if (1)
+  if (unoptimized_multifile)
     {
       for (i = 0; i < SAVED_SECTIONS; i++)
 	{
@@ -12109,9 +12109,7 @@ optimize_multifile (void)
 	  debug_sections[i].new_size = debug_sections[i].size;
 	}
     }
-  else
-#endif
-  if (setjmp (oom_buf))
+  else if (setjmp (oom_buf))
     {
       error (0, ENOMEM, "%s: Could not allocate memory", dso->filename);
       goto fail;
@@ -12366,9 +12364,8 @@ optimize_multifile (void)
     {
       debug_sections[i].data = NULL;
       debug_sections[i].size = 0;
-#ifndef DEBUG_OP_MULTIFILE
-      free (debug_sections[i].new_data);
-#endif
+      if (!unoptimized_multifile)
+	free (debug_sections[i].new_data);
       debug_sections[i].new_data = NULL;
       debug_sections[i].new_size = 0;
       debug_sections[i].sec = 0;
@@ -12597,6 +12594,8 @@ static struct option dwz_options[] =
   { "devel-ignore-locus",no_argument,	    &ignore_locus, 1 },
   { "devel-save-temps",  no_argument,	    &save_temps, 1 },
   { "devel-dump-dies",  no_argument,	    &dump_dies_p, 1 },
+  { "devel-unoptimized-multifile",
+			 no_argument,	    &unoptimized_multifile, 1 },
 #endif
   { NULL,		 no_argument,	    0, 0 }
 };

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-06 12:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [committed] Add --devel-unoptimized-multifile Tom de Vries

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).