public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Add --devel-unoptimized-multifile
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20191106125147.GA1097@delia> (raw)

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 }
 };

                 reply	other threads:[~2019-11-06 12:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191106125147.GA1097@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).