From: Pedro Alves <palves@redhat.com>
To: Michael Eager <eager@eagerm.com>,
Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
binutils <binutils@sourceware.org>
Subject: Re: [PATCH] Support gzip compressed exec and core files in gdb
Date: Thu, 12 Mar 2015 11:31:00 -0000 [thread overview]
Message-ID: <55016D6F.4010104@redhat.com> (raw)
In-Reply-To: <5500E074.6070002@eagerm.com>
On 03/12/2015 12:40 AM, Michael Eager wrote:
> On 03/11/15 15:13, Jan Kratochvil wrote:
>> On Wed, 11 Mar 2015 00:01:42 +0100, Michael Eager wrote:
>>> Add support to automatically unzip compressed executable and core files.
>>> Files will be uncompressed into temporary directory (/tmp or $TMPDIR)
>>> and are deleted when GDB exits.
>>
>> Such feature has been requested to support xz-compressed core files as
>> currently being stored by systemd. But to make it more convenient one should
>> decompress on-demand only the blocks of file that are really accessed by GDB
>> - expecting by bfd_iovec. Obviously GDB usually needs to access only small
>> part of the whole core file.
>>
>> I did not check how it is supported by gzip but for xz one needs to use
>> --block-size, otherwise the file blocks cannot be decompressed independently
>> in random access way.
>
> gzip is not compressed block-by-block. As far as I can tell, you need to
> decompress starting from the beginning of the file.
>
>> ISTM libz-gzip and liblzma-xz compatibility is mutually exclusive.
>
> I don't know why they would be incompatible, but support for an on-demand
> block-compression scheme would be significantly different. Decompressing
> an xz file by making a copy (as is done for gzip) would be a simple extension
> to the current patch.
I won't strongly object if others want to approve it, but IMO, having GDB
decompress the whole file to temp doesn't add that much convenience over
decompressing it outside GDB. Let me explore and expand (below).
We need to weigh the convenience of having gdb do this, over maintaining
this inside BFD+GDB going forward.
If you loading the core just once to extract a backtrace, in an
automated fashion, you can simply decompress before loading the core
with a trivial script. So the convenience added for this use case
is not significant.
If OTOH you're doing interactive debugging of the core dump, then it's
convenient to be able to skip manual/laborious steps.
However, if people are compressing cores, it's because they are big.
As a quick experiment, I ran 'gcore `pidof firefox`' and generated
a core dump of the firefox process that I have running. That resulted
in a 4.5GB core dump. I gzipped it, which shrinked it to 4.5MB.
A ~1000/1 factor. Then I timed gunzipping it. It took almost
2 (two) minutes.
If you're doing interactive debugging (either CLI, or GUI) you'll
likely end up starting gdb multiple times, and thus load the core multiple
times into gdb, and each of those invocations will result in a
slow decompression of the whole file.
Waiting for GDB to decompress that once is already painful. Waiting for it
multiple times likely results in cursing and swearing at gdb's slow start
up. Smart users will realize that and end up decompressing the file manually
outside gdb, just once, anyway, thus saving time.
We could "fix" the "multiple times" issue by adding even more smarts,
based on an already-decompressed-files cache or some such. Though of
course, more smarts, more code to maintain.
I agree with Jan -- The real convenience would be being able to skip the
long whole-file decompression step altogether, with an on-demand
block-decompress scheme, because gdb in reality doesn't need to touch
most of the vast majority of the core dump's contents. That would
be a solution that I'd be happy to see implemented.
If we're just decompressing to /tmp, then we also need to
compare the benefits of a built-in solution against having users
do the same with a user-provided gdb command implemented in one
of gdb's extensions languages (python, scheme), e.g., a command
that adds a "decompress-core" command that does the same:
decompresses whatever compression format, and loads the result
with "core /tmp/FILE".
IMO, whatever the solution, if built in, this is best implemented
in BFD, so that objdump can dump the same files gdb can.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-03-12 11:31 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-10 23:01 Michael Eager
2015-03-11 2:37 ` Mike Frysinger
2015-03-11 15:00 ` Michael Eager
2015-03-11 8:15 ` Alan Modra
2015-03-11 14:57 ` Michael Eager
2015-03-12 0:08 ` Alan Modra
2015-03-12 0:45 ` Michael Eager
2015-03-12 2:51 ` Alan Modra
2015-03-12 16:14 ` Michael Eager
2015-03-13 0:13 ` Alan Modra
2015-03-11 10:07 ` Gary Benson
2015-03-11 14:58 ` Michael Eager
2015-03-11 17:42 ` Gary Benson
2015-03-11 18:10 ` Doug Evans
2015-03-11 18:32 ` Gary Benson
2015-03-11 18:56 ` Doug Evans
2015-03-11 16:15 ` Eli Zaretskii
2015-03-11 19:55 ` Michael Eager
2015-03-11 20:18 ` Mike Frysinger
2015-03-11 20:24 ` Eli Zaretskii
2015-03-12 21:17 ` Sergio Durigan Junior
2015-03-13 6:04 ` Eli Zaretskii
2015-03-11 18:24 ` Cary Coutant
2015-03-11 20:12 ` Michael Eager
2015-03-11 20:19 ` Doug Evans
2015-03-11 22:13 ` Jan Kratochvil
2015-03-11 23:14 ` Doug Evans
2015-03-12 11:32 ` Jan Kratochvil
2015-03-12 15:24 ` Michael Eager
2015-03-12 0:40 ` Michael Eager
2015-03-12 11:31 ` Pedro Alves [this message]
2015-03-12 15:34 ` Michael Eager
2015-03-12 16:13 ` Pedro Alves
2015-03-12 16:58 ` Michael Eager
2015-03-12 17:11 ` Jan Kratochvil
2015-03-12 17:37 ` Michael Eager
2015-03-12 17:48 ` Jan Kratochvil
2015-03-13 6:25 ` Ed Maste
2015-03-19 0:58 ` Michael Eager
2015-03-19 3:45 ` Eli Zaretskii
2015-03-20 22:16 ` Mike Frysinger
2015-03-27 15:26 ` Michael Eager
2015-03-28 4:49 ` Mike Frysinger
2015-03-28 16:56 ` Michael Eager
2015-04-01 12:41 ` Pedro Alves
2015-04-01 18:52 ` Michael Eager
2015-04-01 19:10 ` Pedro Alves
2015-05-01 14:40 ` Michael Eager
2015-05-01 17:53 ` Eli Zaretskii
2015-05-01 22:03 ` Michael Eager
2015-05-04 7:50 ` Mike Frysinger
2015-06-15 15:14 ` Michael Eager
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=55016D6F.4010104@redhat.com \
--to=palves@redhat.com \
--cc=binutils@sourceware.org \
--cc=eager@eagerm.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@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