aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2020-10-26 20:28:47 +0100
committerTom de Vries <tdevries@suse.de>2020-10-26 20:28:47 +0100
commit1c47ec3ee86fc08d120dae7e63cec552fa456912 (patch)
tree5850ccab904dd7fbeece9879b7835334aca5590f /gdb/dwarf2
parent6390859caa7684ff195d57e9f5cc02eae89bdb95 (diff)
downloadgdb-1c47ec3ee86fc08d120dae7e63cec552fa456912.zip
gdb-1c47ec3ee86fc08d120dae7e63cec552fa456912.tar.gz
gdb-1c47ec3ee86fc08d120dae7e63cec552fa456912.tar.bz2
[gdb/symtab] Read CU base address for enqueued CU
Consider the test-case contained in this patch. It consists of two CUs: - cu1, containing a DW_TAG_variable DIE foo - cu2, containing a DW_TAG_base_type DIE int where the variable foo has type int, in other words, there's an inter-CU reference. When expanding the symtab for cu1, expansion of the symtab for cu2 is enqueued, and later processed by process_full_comp_unit. However, processing of .debug_ranges fails because the range is specified relative to a base address which is considered not to be present because !cu->base_address.has_value (), and we run into this case in dwarf2_ranges_process: ... if (!base.has_value ()) { /* We have no valid base address for the ranges data. */ complaint (_("Invalid .debug_ranges data (no base address)")); return 0; } ... Fix this in process_full_comp_unit by setting cu->base_address. Tested on x86_64-linux. gdb/ChangeLog: 2020-10-26 Tom de Vries <tdevries@suse.de> * dwarf2/read.c (process_full_comp_unit): Call dwarf2_find_base_address. gdb/testsuite/ChangeLog: 2020-10-26 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/enqueued-cu-base-addr.exp: New file.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/read.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 436a116..e1c528f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9929,6 +9929,8 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
cu->language = pretend_language;
cu->language_defn = language_def (cu->language);
+ dwarf2_find_base_address (cu->dies, cu);
+
/* Do line number decoding in read_file_scope () */
process_die (cu->dies, cu);