Compressed exec and core files

Michael Eager eager@eagerm.com
Tue Feb 3 16:22:00 GMT 2015


On 01/23/15 12:02, Michael Eager wrote:
> I'm working on a patch to BFD to support opening compressed
> exec and core files transparently.  When bfd_fopen is called
> to open a compressed file, the file would be decompressed into
> a temporary file, and the bfd for the temp returned.  Compression
> with gzip and bzip2 would be supported (others can be added later).
>
> This seems pretty straight-forward.  Any thoughts or comments?

It turns out that there is a complication.  Part of the problem
is that GDB closes the exec file which it opened with bfd_fopen()
and then opens it with its own open routine (gdb_open_cloexec,
which adds the O_CLOEXEC flag to open) and then passes the fd to
bfd_fopen.  BFD doesn't know what flags might have been used to
open the file.  Which means that I can't uncompress the file into
a temporary and open the temporary with the same flags.

Unless someone has a suggestion, I'm going to give up on putting
this into BFD and add the compressed exec/core support to GDB.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Binutils mailing list