Re: [PATCH v2 3/4] Add DWARF index cache

Simon Marchi
2018-07-30T15:33:30Z

On 2018-07-27 17:24, Eli Zaretskii wrote:
> If we think this details is likely to change, or have other good
> reasons not divulge this, I'm okay with keeping silent about it. But
> if chances are this will stay forever (or thereabouts), I think the
> details is important enough to tell the users.

If you see a realistic use case where this information would be useful
to users, I am fine with including it. But I can't really think of any,
and mentioning it would more or less paint us into a corner should we
need to change it. Cache files are meant to be written and read by GDB,
not to be interoperable with other programs.

>> >> + /* If we get EEXIST and the existing path is a directory, then
>> >> we're
>> >> + happy. If it exists, but it's a regular file and this is
>> >> not the last
>> >> + component, we'll fail at the next component. If this is the
>> >> last
>> >> + component, the caller will fail with ENOTDIR when trying to
>> >> + open/create a file under that path. */
>> >> + if (mkdir (start, 0700) != 0)
>> >
>> > This will not work on Windows.
>>
>> Which part of it?
>
> mkdir accepts only one argument, not 2.

It builds fine with x86_64-w64-mingw32-g++ on Linux here. It looks like
gnulib offers a compatibility fix, so I guess it's ok:

https://www.gnu.org/software/gnulib/manual/html_node/mkdir.html

Did you see an actual failure?

>> > Does this mean this feature will only work on systems with mmap?
>>
>> Indeed. There is an equivalent API for Windows though I think:
>>
>> https://docs.microsoft.com/en-us/windows/desktop/Memory/file-mapping
>>
>> I can't really do the Windows bits, because I just don't have the
>> competence to write software for Windows. Every time I tried to build
>> GDB for Windows, I failed miserably (do we have a guide for that?).
>> So
>> my thought (including for the mkdir_recursive function) was that
>> somebody who used Windows could later implement the missing parts.
>
> Fair enough.
>
>> Also, I guess that somebody debugging native executables on Windows
>> wouldn't have a use for the cache, because indices only work for DWARF
>> debug info.
>
> MinGW uses DWARF debug info for quite a few years now, so caching will
> definitely be useful.

Ah, I didn't know that, thanks. So it produces DWARF embedded in the PE
executable? Then yes, it would be useful.

Thanks,

Simon