Re: [PATCH] Move DWARF index-related things to a separate file

Pedro Alves
2018-03-26T22:23:04Z

On 03/26/2018 10:08 PM, Simon Marchi wrote:
> I want to add a DWARF index-related feature (automatically produce index
> files when loading objfiles in GDB), but I don't want to add many
> hundred lines to the already too big dwarf2read.c. I thought it would
> be a logical split to move everything related to the DWARF index to its
> own file.
>
> I first tried to move everything that reads and writes DWARF indices to
> a separate file, but found that the "read" part is a little bit
> entangled with the rest of dwarf2read.c, so the line is hard to draw
> about where to split. The write part is quite isolated though, so I
> moved this part to a new file, dwarf-index-write.c. Some things are
> necessary to both reading and writing indices, so I placed them in
> dwarf-index-common.{c,h}. The idea would be to have a
> dwarf-index-read.c eventually that would use it too (for now that code
> is still in dwarf2read.c).
>
> This required moving some things to a new dwarf2read.h header, so they
> can be read by the code that writes the index.
>
> The patch is big in number of lines, but it's all existing code being
> moved around. The only changes are that some functions are not static
> anymore, a declaration is added in a .h file, and therefore the comment
> is moved there.
>
> I built-tested it with a little and big endian target.
>
> This patch is also available on the users/simark/split-dwarf2read
> branch.

+1 for splitting dwarf2read.c.

Thanks,
Pedro Alves