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

Michael Eager
2015-03-12T17:37:48Z

On 03/12/15 10:11, Jan Kratochvil wrote:
> 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

Thanks. I'll see if this eliminates the need for the BFD patch.

>> 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.

This won't tell what flags were used to open the file,
so that the same flags can be used on the decompressed file.

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