From: Tom de Vries Date: Sat, 23 May 2026 08:16:57 +0000 (+0200) Subject: [gdb/testsuite] Complete 64-bit port of gdb.dwarf2/dw2-skip-prologue.exp X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=2cc83bc17da8a74cde02e7cab4ff36b45c0b95b5;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Complete 64-bit port of gdb.dwarf2/dw2-skip-prologue.exp Test-source gdb.dwarf2/dw2-skip-prologue.S was generated using 32-bit, and subsequently ported to 64-bit using macro PTRBYTE. When using 64-bit, there are some readelf -w warnings because the port to 64-bit is not complete. Fix these warnings. Likewise in gdb.dwarf/dw2-const.exp. Approved-By: Tom Tromey Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34157 --- diff --git a/gdb/testsuite/gdb.dwarf2/dw2-const.S b/gdb/testsuite/gdb.dwarf2/dw2-const.S index 94cf1acbed6..1161633f181 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-const.S +++ b/gdb/testsuite/gdb.dwarf2/dw2-const.S @@ -15,6 +15,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#if PTRBITS == 64 +# define PTRBYTE .8byte +# define PTRBYTES 8 +#elif PTRBITS == 32 +# define PTRBYTE .4byte +# define PTRBYTES 4 +#else +# error "Unsupported pointer size" +#endif + /* Dummy function to provide debug information for. */ .text @@ -228,9 +238,9 @@ func_cu1: .Lline1_lines: .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 - .4byte .Lbegin_func_cu1 + PTRBYTE .Lbegin_func_cu1 .byte 3 /* DW_LNS_advance_line */ .sleb128 3 /* ... to 4 */ @@ -240,9 +250,9 @@ func_cu1: .byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 - .4byte .Lend_func_cu1 + PTRBYTE .Lend_func_cu1 .byte 0 /* DW_LNE_end_of_sequence */ .uleb128 1 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-const.exp b/gdb/testsuite/gdb.dwarf2/dw2-const.exp index 93ddfaa0f2f..f855659f8bd 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-const.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-const.exp @@ -19,8 +19,18 @@ require dwarf2_support standard_testfile .S +if {[is_ilp32_target]} { + set ptrbits 32 +} else { + set ptrbits 64 +} + +set srcfile_opts {} +lappend srcfile_opts nodebug +lappend srcfile_opts additional_flags=-DPTRBITS=$ptrbits + if {[prepare_for_testing_full "failed to prepare" \ - [list $testfile debug main.c debug $srcfile nodebug]]} { + [list $testfile debug main.c debug $srcfile $srcfile_opts]]} { return } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S index 19165a513a4..11d794bc412 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S +++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S @@ -17,8 +17,10 @@ #if PTRBITS == 64 # define PTRBYTE .8byte +# define PTRBYTES 8 #elif PTRBITS == 32 # define PTRBYTE .4byte +# define PTRBYTES 4 #else # error "Unsupported pointer size" #endif @@ -130,7 +132,7 @@ loclist: 1: .byte 0x50 /* DW_OP_reg0 */ 2: /* Location list end. */ - .4byte 0, 0 + PTRBYTE 0, 0 /* Abbrev table */ .section .debug_abbrev @@ -283,7 +285,7 @@ loclist: .Lline1_lines: .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE func_start .byte 3 /* DW_LNS_advance_line */ @@ -291,7 +293,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE func0 .byte 4 /* DW_LNS_set_file */ @@ -301,7 +303,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE func1 .byte 4 /* DW_LNS_set_file */ @@ -311,7 +313,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE func2 .byte 4 /* DW_LNS_set_file */ @@ -321,7 +323,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE func3 .byte 4 /* DW_LNS_set_file */ @@ -331,14 +333,14 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE func_end /* Equivalent copy but renamed s/func/fund/. */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE fund_start .byte 3 /* DW_LNS_advance_line */ @@ -346,7 +348,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE fund0 .byte 4 /* DW_LNS_set_file */ @@ -356,7 +358,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE fund1 .byte 4 /* DW_LNS_set_file */ @@ -366,7 +368,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE fund2 .byte 4 /* DW_LNS_set_file */ @@ -376,7 +378,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE fund3 .byte 4 /* DW_LNS_set_file */ @@ -386,7 +388,7 @@ loclist: .byte 1 /* DW_LNS_copy */ .byte 0 /* DW_LNE_set_address */ - .uleb128 5 + .uleb128 1 + PTRBYTES .byte 2 PTRBYTE fund_end