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

Jan Kratochvil
2015-03-12T17:11:54Z

On Thu, 12 Mar 2015 17:58:02 +0100, Michael Eager wrote:
> I misspoke/misremembered. It isn't exec_close() which closes the
> file, it is bfd_cache_close_all(). The bfd is not closed, only
> the file.

This is problematic, I have already posted a pending patch for it:
[patch] Do not close BFDs, breaking deleted inferior shlibs
https://sourceware.org/ml/gdb-patches/2015-02/msg00367.html

> Allowing an opened fd to be passed into BFD makes
> doing the decompression in BFD problematic, since BFD doesn't
> know where the opened file was found, and the decompress libraries
> (at least gzopen()) expects a path, not an opened fd.

One can readlink(/proc/self/fd/%d) although I haven't checked now how exactly
to use it.

Jan