aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dwarf2/read.c18
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.rust/dwindex.exp43
-rw-r--r--gdb/testsuite/gdb.rust/dwindex.rs22
-rw-r--r--gdb/testsuite/lib/gdb.exp14
6 files changed, 93 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dc3b5f6..53b3c31 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2021-06-25 Tom Tromey <tom@tromey.com>
+ * dwarf2/read.c (create_addrmap_from_aranges): Change padding
+ logic.
+
+2021-06-25 Tom Tromey <tom@tromey.com>
+
* dwarf2/read.c (process_psymtab_comp_unit): Don't set 'lang'.
(scan_partial_symbols, partial_die_parent_scope)
(add_partial_symbol, add_partial_subprogram)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index cb3f9e0..671c607 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2637,18 +2637,12 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
/* Must pad to an alignment boundary that is twice the address
size. It is undocumented by the DWARF standard but GCC does
- use it. */
- for (size_t padding = ((-(addr - section->buffer))
- & (2 * address_size - 1));
- padding > 0; padding--)
- if (*addr++ != 0)
- {
- warning (_("Section .debug_aranges in %s entry at offset %s "
- "padding is not zero, ignoring .debug_aranges."),
- objfile_name (objfile),
- plongest (entry_addr - section->buffer));
- return;
- }
+ use it. However, not every compiler does this. We can see
+ whether it has happened by looking at the total length of the
+ contents of the aranges for this CU -- it if isn't a multiple
+ of twice the address size, then we skip any leftover
+ bytes. */
+ addr += (entry_end - addr) % (2 * address_size);
for (;;)
{
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 567c134..fa54765 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2021-06-25 Tom Tromey <tom@tromey.com>
+
+ * lib/gdb.exp (add_gdb_index, ensure_gdb_index): Add "style"
+ parameter.
+ * gdb.rust/dwindex.exp: New file.
+ * gdb.rust/dwindex.rs: New file.
+
2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.python/py-breakpoint.c (do_throw): New function.
diff --git a/gdb/testsuite/gdb.rust/dwindex.exp b/gdb/testsuite/gdb.rust/dwindex.exp
new file mode 100644
index 0000000..1bc6199
--- /dev/null
+++ b/gdb/testsuite/gdb.rust/dwindex.exp
@@ -0,0 +1,43 @@
+# Copyright (C) 2021 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that a rustc-produced .debug_aranges can be read.
+
+load_lib rust-support.exp
+if {[skip_rust_tests]} {
+ continue
+}
+
+standard_testfile .rs
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
+ return -1
+}
+
+if {[ensure_gdb_index $binfile "-dwarf-5"] == -1} {
+ return -1
+}
+
+gdb_exit
+gdb_start
+set testname "file with aranges"
+gdb_test_multiple "file $binfile" "" {
+ -re "warning: Section \\.debug_aranges" {
+ fail $testname
+ }
+ -re -wrap ".*" {
+ pass $testname
+ }
+}
diff --git a/gdb/testsuite/gdb.rust/dwindex.rs b/gdb/testsuite/gdb.rust/dwindex.rs
new file mode 100644
index 0000000..439876d
--- /dev/null
+++ b/gdb/testsuite/gdb.rust/dwindex.rs
@@ -0,0 +1,22 @@
+// Copyright (C) 2021 Free Software Foundation, Inc.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+#![allow(unused_assignments)]
+
+
+fn main () {
+}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1013120..38f40fd 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -7688,12 +7688,15 @@ proc verify_psymtab_expanded { filename readin } {
# Add a .gdb_index section to PROGRAM.
# PROGRAM is assumed to be the output of standard_output_file.
# Returns the 0 if there is a failure, otherwise 1.
+#
+# STYLE controls which style of index to add, if needed. The empty
+# string (the default) means .gdb_index; "-dwarf-5" means .debug_names.
-proc add_gdb_index { program } {
+proc add_gdb_index { program {style ""} } {
global srcdir GDB env BUILD_DATA_DIRECTORY
set contrib_dir "$srcdir/../contrib"
set env(GDB) "$GDB --data-directory=$BUILD_DATA_DIRECTORY"
- set result [catch "exec $contrib_dir/gdb-add-index.sh $program" output]
+ set result [catch "exec $contrib_dir/gdb-add-index.sh $style $program" output]
if { $result != 0 } {
verbose -log "result is $result"
verbose -log "output is $output"
@@ -7707,8 +7710,11 @@ proc add_gdb_index { program } {
# (.gdb_index/.debug_names). Gdb doesn't support building an index from a
# program already using one. Return 1 if a .gdb_index was added, return 0
# if it already contained an index, and -1 if an error occurred.
+#
+# STYLE controls which style of index to add, if needed. The empty
+# string (the default) means .gdb_index; "-dwarf-5" means .debug_names.
-proc ensure_gdb_index { binfile } {
+proc ensure_gdb_index { binfile {style ""} } {
set testfile [file tail $binfile]
set test "check if index present"
gdb_test_multiple "mt print objfiles ${testfile}" $test {
@@ -7719,7 +7725,7 @@ proc ensure_gdb_index { binfile } {
return 0
}
-re -wrap "Psymtabs.*" {
- if { [add_gdb_index $binfile] != "1" } {
+ if { [add_gdb_index $binfile $style] != "1" } {
return -1
}
return 1