diff options
author | Tom Tromey <tom@tromey.com> | 2021-06-25 12:34:41 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-06-25 12:34:41 -0600 |
commit | 3da4c6449b1ce57accfb1b9fa8415ad1cf42039b (patch) | |
tree | eb17dd638c517d85674b7e7cd14e3e36aff95b8f /gdb/testsuite/gdb.rust | |
parent | 3e9f1ca148ca2ecf6cd008ed2678a4cbe253620b (diff) | |
download | gdb-3da4c6449b1ce57accfb1b9fa8415ad1cf42039b.zip gdb-3da4c6449b1ce57accfb1b9fa8415ad1cf42039b.tar.gz gdb-3da4c6449b1ce57accfb1b9fa8415ad1cf42039b.tar.bz2 |
Change how .debug_aranges padding is skipped
When GCC emits .debug_aranges, it adds padding to align the contents
to two times the address size. GCC has done this for many years --
but there is nothing in the DWARF standard that says this should be
done, and LLVM does not seem to add this padding.
It's simple to detect if the padding exists, though: if the contents
of one .debug_aranges CU (excluding the header) are not a multiple of
the alignment that GCC uses, then anything extra must be padding.
This patch changes gdb to correctly read both styles. It removes the
requirement that the padding bytes be zero, as this seemed
unnecessarily pedantic to me.
gdb/ChangeLog
2021-06-25 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (create_addrmap_from_aranges): Change padding
logic.
gdb/testsuite/ChangeLog
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.
Diffstat (limited to 'gdb/testsuite/gdb.rust')
-rw-r--r-- | gdb/testsuite/gdb.rust/dwindex.exp | 43 | ||||
-rw-r--r-- | gdb/testsuite/gdb.rust/dwindex.rs | 22 |
2 files changed, 65 insertions, 0 deletions
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 () { +} |