aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/section.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-02-08 13:40:54 -0700
committerTom Tromey <tom@tromey.com>2020-02-08 13:43:24 -0700
commit2c7d5afccfea519b7cb53d76673d5aca1a00bacc (patch)
treeeceda2f1e3d22ca4ba21c72475baf1d05f4ec1cc /gdb/dwarf2/section.h
parent4075cb26687ec6bbd5bab31b6b33f692a3ed3108 (diff)
downloadbinutils-2c7d5afccfea519b7cb53d76673d5aca1a00bacc.zip
binutils-2c7d5afccfea519b7cb53d76673d5aca1a00bacc.tar.gz
binutils-2c7d5afccfea519b7cb53d76673d5aca1a00bacc.tar.bz2
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 <tom@tromey.com> * dwarf2/read.c (dwarf2_section_size): Remove. (error_check_comp_unit_head, dwarf2_symbol_mark_computed): Update. * dwarf2/section.h (struct dwarf2_section_info) <get_size>: New method. Change-Id: I12928fee5c84350ce98883e329357b86888d639b
Diffstat (limited to 'gdb/dwarf2/section.h')
-rw-r--r--gdb/dwarf2/section.h13
1 files changed, 13 insertions, 0 deletions
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. */