From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54784 invoked by alias); 6 Nov 2019 12:51:53 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 54774 invoked by uid 89); 6 Nov 2019 12:51:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Add --devel-unoptimized-multifile Message-ID: <20191106125147.GA1097@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-q4/txt/msg00039.txt.bz2 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 * 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 } };