gdb/dwarf: remove dwarf2_section_info::get_size

The comment over dwarf2_section_info::get_size says:

    In other cases, you must call this function, because for compressed
    sections the size field is not set correctly until the section has
    been read

From what I can see (while debugging a test case compiled with -gz on
Linux), that's not true.  For compressed sections, bfd_section_size
returns the uncompressed size.  asection::size contains the uncompressed
size while asection::compressed_size contains the compressed size:

    (top-gdb) p sec
    $13 = (asection *) 0x521000119778
    (top-gdb) p sec.compressed_size
    $14 = 6191
    (top-gdb) p sec.size
    $15 = 12116

I therefore propose to remove dwarf2_section_info::get_size, as it
appears that reading in the section is orthogonal to knowing its size.

If the assumption above is false, it would be nice to document in which
case it's false.

I checked the callers, and I don't think that we need to add any
dwarf2_section_info::read calls to compensate for the fact that get_size
used to do it.

Change-Id: I428571e532301d49f1d8242d687e1fcb819b75c1
Approved-By: Tom Tromey <tom@tromey.com>
3 files changed