From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77154 invoked by alias); 1 Apr 2019 06:57:18 -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 76833 invoked by uid 89); 1 Apr 2019 06:57:17 -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=-25.5 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=bout, argc, alloca, *argv X-Spam-Status: No, score=-25.5 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 Subject: [committed] Add --devel-trace From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com References: <20190308113332.GA10050@delia> Message-ID: <87b4fa44-4a7c-8e8e-3a58-0ca859201eb9@suse.de> Date: Tue, 01 Jan 2019 00:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190308113332.GA10050@delia> Content-Type: multipart/mixed; boundary="------------4D4B8FB73785B3E7B897F738" Content-Language: en-US X-SW-Source: 2019-q2/txt/msg00000.txt.bz2 This is a multi-part message in MIME format. --------------4D4B8FB73785B3E7B897F738 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 217 [ was: Re: [PATCH] Add --trace/-t ] On 08-03-19 12:33, Tom de Vries wrote: > Hi, > > Add a tracing option, to show more information about how dwz is progressing. > Added as developer-only option. Thanks, - Tom --------------4D4B8FB73785B3E7B897F738 Content-Type: text/x-patch; name="0001-Add-devel-trace.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-Add-devel-trace.patch" Content-length: 4724 Add --devel-trace Add a developer-only tracing option, to show more information about how dwz is progressing. The option is developer-only, meaning: - not listed in usage - only available with long option name, starting with '--' - long option name starts with '--devel-', to prevent abbreviation clashes with user options. Regular mode: ... $ dwz --devel-trace a.out Compressing a.out ... Low-mem mode: ... $ dwz --devel-trace -l0 a.out Compressing a.out Hit low-mem die-limit Compressing a.out in low-mem mode ... Hardlink handling: ... $ dwz --devel-trace -h a.out b.out Compressing a.out Updating hardlink b.out to changed file ... Multifile mode: ... $ dwz --devel-trace -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 ... 2019-04-01 Tom de Vries * dwz.c (read_debug_info, write_multifile, dwz, optimize_multifile) (read_multifile): Add tracing. (main): Add parsing of --devel-trace. * testsuite/dwz.tests/devel-trace.sh: New test. --- dwz.c | 35 +++++++++++++++++++++++++++++++++++ testsuite/dwz.tests/devel-trace.sh | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/dwz.c b/dwz.c index 8ad613d..f1416fa 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 int 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; } @@ -10824,6 +10828,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)) @@ -11029,6 +11035,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; @@ -11039,6 +11048,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")); @@ -11062,6 +11074,20 @@ dwz (const char *file, const char *outfile, struct file_result *res, } } + 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; @@ -11358,6 +11384,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; @@ -11647,6 +11675,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) @@ -11792,6 +11822,7 @@ static struct option dwz_options[] = { "multifile-name", required_argument, 0, 'M' }, { "relative", no_argument, 0, 'r' }, { "version", no_argument, 0, 'v' }, + { "devel-trace", no_argument, &tracing, 1 }, { NULL, no_argument, 0, 0 } }; @@ -11846,6 +11877,10 @@ main (int argc, char *argv[]) usage (); break; + case 0: + /* Option handled by getopt_long. */ + break; + case 'o': outfile = optarg; break; diff --git a/testsuite/dwz.tests/devel-trace.sh b/testsuite/dwz.tests/devel-trace.sh new file mode 100644 index 0000000..089cb52 --- /dev/null +++ b/testsuite/dwz.tests/devel-trace.sh @@ -0,0 +1,5 @@ +cp ../hello 1 + +dwz --devel-trace 1 2>/dev/null + +rm -f 1 --------------4D4B8FB73785B3E7B897F738--