From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [PATCH] Add --trace/-t
Date: Tue, 01 Jan 2019 00:00:00 -0000 [thread overview]
Message-ID: <20190308113332.GA10050@delia> (raw)
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 <tdevries@suse.de>
* 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;
}
}
next reply other threads:[~2019-03-08 11:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-01 0:00 Tom de Vries [this message]
2019-01-01 0:00 ` [committed] Add --devel-trace Tom de Vries
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=20190308113332.GA10050@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).