[PATCH] Support gzip compressed exec and core files in gdb

Michael Eager eager@eagerm.com
Thu Mar 19 00:58:00 GMT 2015


On 03/10/15 16:01, 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.  This should be transparent to users,
> except for disk space requirements.  The name of the uncompressed file is
> mentioned, but all references to the file in GDB messages is to the file
> which the user specified.
>
> This operation cannot be done completely by BFD because BFD allows an opened
> file to be passed to it for processing.  GDB uses this functionality.
>
> BFD:
>    * bfd-in2.h: Regenerate.
>    * bfd.c (struct bfd): Add uncompressed_filename.
>    * bfdio.c (bfd_get_mtime): Set bfd->mtime_set to true.
>    * cache.c (bfd_open): Open previously created uncompressed file.
>
> GDB:
>    * common/filestuff.c (struct compressed_file_cache_search, eq_compressed_file,
>    is_gzip, decompress_gzip, do_compressed_cleanup, gdb_uncompress): New.
>    * common/filestuff.h (gdb_uncompress): Declare.
>    * corelow.c (core_open): Uncompress core file.
>    * exec.c (exec_file_attach): Uncompress exe file.
>    * symfile.c (symfile_bfd_open): Uncompress sym (exe) file.
>
> GDB/DOC:
>    * gdb.texinfo: Mention gzipped exec and core files.
>

Revised patch attached.  After Jan's patch to not close cached files,
I was able to eliminate the changes to BFD.  Moved uncompress code to
utils.c.  Added NEWS entry.

gdb/ChangeLog:
   * utils.c (struct compressed_file_cache_search, eq_compressed_file,
   is_gzip, decompress_gzip, do_compressed_cleanup, gdb_uncompress): New.
   * utils.h (gdb_uncompress): Declare.
   * corelow.c (core_open): Uncompress core file.
   * exec.c (exec_file_attach): Uncompress exec file.
   * symfile.c (symfile_bfd_open): Uncompress sym (exec) file.
   * NEWS: Mention new functionality.

gdb/doc:
   * gdb.texinfo (Files): Mention gzipped exec and core files.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-GDB-support-compressed-exec-and-core-files.patch
Type: text/x-patch
Size: 10910 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150319/65e9fd8f/attachment.bin>


More information about the Binutils mailing list