From 2c7d5afccfea519b7cb53d76673d5aca1a00bacc Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 8 Feb 2020 13:40:54 -0700 Subject: Convert dwarf2_section_size to a method This changes dwarf2_section_size to be a method on dwarf2_section_info. 2020-02-08 Tom Tromey * dwarf2/read.c (dwarf2_section_size): Remove. (error_check_comp_unit_head, dwarf2_symbol_mark_computed): Update. * dwarf2/section.h (struct dwarf2_section_info) : New method. Change-Id: I12928fee5c84350ce98883e329357b86888d639b --- gdb/dwarf2/section.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gdb/dwarf2/section.h') diff --git a/gdb/dwarf2/section.h b/gdb/dwarf2/section.h index f76f1ef..8ddedca 100644 --- a/gdb/dwarf2/section.h +++ b/gdb/dwarf2/section.h @@ -81,6 +81,19 @@ struct dwarf2_section_info If the section is compressed, uncompress it before returning. */ void read (struct objfile *objfile); + /* A helper function that returns the size of a section in a safe way. + If you are positive that the section has been read before using the + size, then it is safe to refer to the dwarf2_section_info object's + "size" field directly. 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. */ + bfd_size_type get_size (struct objfile *objfile) + { + if (!readin) + read (objfile); + return size; + } + union { /* If this is a real section, the bfd section. */ -- cgit v1.1