From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123854 invoked by alias); 8 Mar 2019 11:32:58 -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 123756 invoked by uid 89); 8 Mar 2019 11:32:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 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=Hit, argv, restored, retry X-Spam-Status: No, score=-26.0 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: [PATCH] Add --trace/-t Message-ID: <20190308113332.GA10050@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-q1/txt/msg00104.txt.bz2 Hi, Add a tracing option, to show more information about how dwz is progressing. Regular mode: ... $ dwz -t a.out Compressing a.out ... Low-mem mode: ... $ dwz -t -l0 a.out Compressing a.out Hit low-mem die-limit Compressing a.out in low-mem mode ... Hardlink handling: ... $ dwz -t -h a.out b.out Compressing a.out Updating hardlink b.out to changed file ... Multifile mode: ... $ dwz -t -m common.out a.out b.out Compressing a.out Write-multifile a.out Compressing b.out Write-multifile b.out Optimize-multifile Read-multifile Compressing a.out in finalize-multifile mode Compressing b.out in finalize-multifile mode ... OK for trunk? Thanks, - Tom Add --trace/-t 2019-03-08 Tom de Vries * dwz.c (read_debug_info, write_multifile, dwz, optimize_multifile) (read_multifile): Add tracing. (main): Add parsing of --trace/-t. --- dwz.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/dwz.c b/dwz.c index 476807a..684fc71 100644 --- a/dwz.c +++ b/dwz.c @@ -136,6 +136,8 @@ static struct obstack ob2; and restored during final cleanup. */ static struct obstack alt_ob, alt_ob2; +static bool tracing; + typedef struct { Elf *elf; @@ -4733,6 +4735,8 @@ read_debug_info (DSO *dso, int kind) caller that it should retry with low_mem. */ if (likely (!low_mem) && ndies == low_mem_die_limit) { + if (tracing) + fprintf (stderr, "Hit low-mem die-limit\n"); ret = 2; goto fail; } @@ -10822,6 +10826,8 @@ write_multifile (DSO *dso) *cup = (*cup)->cu_next; *cup = NULL; multifile_mode = MULTIFILE_MODE_WR; + if (tracing) + fprintf (stderr, "Write-multifile %s\n", dso->filename); if (compute_abbrevs (NULL)) ret = 1; else if (debug_sections[DEBUG_MACRO].data && read_macro (dso)) @@ -11027,6 +11033,9 @@ dwz (const char *file, const char *outfile, struct file_result *res, state. */ if (resa[n].res == 1) { + if (tracing) + fprintf (stderr, "Skipping hardlink %s to unchanged file\n", + file); close (fd); res->res = -2; return 1; @@ -11037,6 +11046,9 @@ dwz (const char *file, const char *outfile, struct file_result *res, size_t len = strlen (file); char *filename = alloca (len + sizeof (".#dwz#.XXXXXX")); int fd2; + if (tracing) + fprintf (stderr, "Updating hardlink %s to changed file\n", + file); memcpy (filename, file, len); memcpy (filename + len, ".#dwz#.XXXXXX", sizeof (".#dwz#.XXXXXX")); @@ -11056,10 +11068,27 @@ dwz (const char *file, const char *outfile, struct file_result *res, unlink (filename); } } + if (tracing) + fprintf (stderr, + "Updating hardlink %s to changed file failed\n", file); } } } + if (tracing) + { + fprintf (stderr, "Compressing %s", file); + if (multifile_mode == 0) + ; + else if (low_mem) + fprintf (stderr, " in low-mem mode"); + else if (fi_multifile) + fprintf (stderr, " in finalize-multifile mode"); + else + abort (); + fprintf (stderr, "\n"); + } + dso = fdopen_dso (fd, file); if (dso == NULL) return 1; @@ -11356,6 +11385,8 @@ optimize_multifile (void) memset (&dsobuf, '\0', sizeof (dsobuf)); dso = &dsobuf; dso->filename = multifile; + if (tracing) + fprintf (stderr, "Optimize-multifile\n"); multifile_mode = MULTIFILE_MODE_OP; obstack_alloc_failed_handler = dwz_oom; @@ -11645,6 +11676,8 @@ read_multifile (int fd) DSO *dso, *volatile ret; unsigned int i; + if (tracing) + fprintf (stderr, "Read-multifile\n"); multifile_mode = MULTIFILE_MODE_RD; dso = fdopen_dso (fd, multifile); if (dso == NULL) @@ -11790,6 +11823,7 @@ static struct option dwz_options[] = { "multifile-name", required_argument, 0, 'M' }, { "relative", no_argument, 0, 'r' }, { "version", no_argument, 0, 'v' }, + { "trace", no_argument, 0, 't' }, { NULL, no_argument, 0, 0 } }; @@ -11834,7 +11868,8 @@ main (int argc, char *argv[]) while (1) { int option_index; - int c = getopt_long (argc, argv, "m:o:qhl:L:M:r?v", dwz_options, &option_index); + int c = getopt_long (argc, argv, "m:o:qhl:L:M:r?vt", dwz_options, + &option_index); if (c == -1) break; switch (c) @@ -11885,6 +11920,10 @@ main (int argc, char *argv[]) case 'v': version (); break; + + case 't': + tracing = true; + break; } }