aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/attribute.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2021-02-02 10:40:51 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2021-02-02 10:40:51 -0500
commitb1829e1bf2ee1c973694c802afaa3b7da2ffb4de (patch)
treeebb2966e4197f2b62c172bcf9d8094d58086a2d1 /gdb/dwarf2/attribute.h
parent0c800c6ebc6bfc795575f3f37b27eba7ab1e7c11 (diff)
downloadgdb-b1829e1bf2ee1c973694c802afaa3b7da2ffb4de.zip
gdb-b1829e1bf2ee1c973694c802afaa3b7da2ffb4de.tar.gz
gdb-b1829e1bf2ee1c973694c802afaa3b7da2ffb4de.tar.bz2
gdb/dwarf: few fixes for handling DW_FORM_{rng,loc}listx
We hit an assertion when loading the binary from PR 26813. When fixing it, execution goes a up bit further but then hits another assert, and another, and another. With these fours fixes, I am able to load the binary and get to the prompt. An error is shown (index pointing outside of the section), because the DW_FORM_rnglistx attribute is not read correctly, but that one is taken care of by the next patch. The four fixes are: - attribute::form_requires_reprocessing needs to handle forms DW_FORM_rnglistx and DW_FORM_loclistx, because set_unsigned_reprocess is called for them in read_attribute_value. - read_attribute_reprocess must call set_unsigned for them, not set_address. The parameter of set_address is a CORE_ADDR, meaning it's for program addresses. Post-reprocess, DW_FORM_rnglistx and DW_FORM_loclistx are offsets into their respective sections (.debug_rnglists and .debug_loclists). set_unsigned is the current attribute value setter that fits the best. But perhaps we should have a setter that takes a sect_offset? - read_attribute_process must call as_unsigned_reprocess instead of as_unsigned to get the pre-reprocess value, otherwise we hit the assert inside as_unsigned that makes sure the attribute doesn't need reprocessing. - attribute::set_unsigned needs to clear the requires_reprocessing flag, otherwise it stays set when reprocessing DW_FORM_rnglistx and DW_FORM_loclistx attributes. There's another assert that we hit once the next patch is applied, but since it's in the same vein as the changes in this patch, I included it in this patch: - attribute::form_is_unsigned must handle form DW_FORM_loclistx, otherwise we hit the assert when trying to call set_unsigned for an attribute of this form. DW_FORM_rnglistx is already handled. gdb/ChangeLog: PR gdb/26813 * dwarf2/attribute.h (struct attribute) <set_unsigned>: Clear requires_reprocessing flag. * dwarf2/attribute.c (attribute::form_is_unsigned): Handle DW_FORM_loclistx. (attribute::form_requires_reprocessing): Handle DW_FORM_rnglistx and DW_FORM_loclistx. * dwarf2/read.c (read_attribute_reprocess): Use set_unsigned instead of set_address for DW_FORM_loclistx and DW_FORM_rnglistx. Change-Id: I06c156fa3913ca98e4e39085f4ef171645b4bc1e
Diffstat (limited to 'gdb/dwarf2/attribute.h')
-rw-r--r--gdb/dwarf2/attribute.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h
index a3ff9b0..56776d6 100644
--- a/gdb/dwarf2/attribute.h
+++ b/gdb/dwarf2/attribute.h
@@ -223,6 +223,7 @@ struct attribute
{
gdb_assert (form_is_unsigned ());
u.unsnd = unsnd;
+ requires_reprocessing = 0;
}
/* Temporarily set this attribute to an unsigned integer. This is