gdb: change subfile::line_vector to an std::vector
Change this field to an std::vector to facilitate memory management.
Since the linetable_entry array is copied into the symtab resulting from
the subfile, it is possible to change it without changing how symtab
stores the linetable entries (which would be a much larger change).
There is a small change in buildsym_compunit::record_line to avoid
accessing a now invalid linetable_entry. Before this patch, we keep a
pointer to the last linetable entry, pop it from the vector, and then
read last->line. It works with the manually-maintained array, but since
we now use std::vector::pop_back, I am afraid that it could be flagged
as an invalid access by the various static / dynamic analysis tools to
access the linetable_entry object after popping it from the vector.
Instead, record just the line number in an optional and use it.
There are substantial changes in xcoffread.c that simplify the code, but
I can't test them. I was hesitant to do this change because of that,
but I decided to send it anyway. I don't think that an almost dead
platform should hold back improving the code in the common parts of GDB.
The changes in xcoffread.c are:
- Make arrange_linetable "arrange" the linetable passed as a parameter,
instead of returning possibly a new one, possibly the same one.
- In the "Process main file's line numbers.", I'm not too sure what
happens. We get the lintable from "main_subfile", "arrange" it, but
then assign the result to the current subfile, obtained with
get_current_subfile. I assume that the current subfile is also the
main one, so now I just call arrange_linetable on the main subfile's
line table.
- Remove that weird "Useless if!!!" FIXME comment. It's been there
forever, but the "if" is still there, so I guess the "if" can stay
there.
Change-Id: I11799006fd85189e8cf5bd3a168f8f38c2c27a80