Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/4] [gdb/testsuite] Complete 64-bit port of gdb.dwarf2/dw2-skip-prologue.exp
Date: Fri, 22 May 2026 16:37:35 +0200	[thread overview]
Message-ID: <20260522143737.3373000-3-tdevries@suse.de> (raw)
In-Reply-To: <20260522143737.3373000-1-tdevries@suse.de>

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.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34157
---
 gdb/testsuite/gdb.dwarf2/dw2-const.S         | 18 ++++++++++---
 gdb/testsuite/gdb.dwarf2/dw2-const.exp       | 12 ++++++++-
 gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S | 28 +++++++++++---------
 3 files changed, 40 insertions(+), 18 deletions(-)

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 <http://www.gnu.org/licenses/>.  */
 
+#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
 
-- 
2.51.0


  parent reply	other threads:[~2026-05-22 14:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 14:37 [PATCH 0/4] [gdb/testsuite] Fix some more dwarf assembly test-cases Tom de Vries
2026-05-22 14:37 ` [PATCH 1/4] [gdb/testsuite] Remove invalid .debug_line section in gdb.dwarf2/dw2-icycle.exp Tom de Vries
2026-05-22 14:55   ` Tom Tromey
2026-05-22 14:37 ` Tom de Vries [this message]
2026-05-22 15:07   ` [PATCH 2/4] [gdb/testsuite] Complete 64-bit port of gdb.dwarf2/dw2-skip-prologue.exp Tom Tromey
2026-05-22 14:37 ` [PATCH 3/4] [gdb/testsuite] Add missing type_offset in gdb.dwarf/debug-names-tu.exp Tom de Vries
2026-05-22 15:03   ` Tom Tromey
2026-05-23  8:15     ` Tom de Vries
2026-05-22 14:37 ` [PATCH 4/4] [gdb/testsuite] Improve dwarf assembly for implicit const in .debug_names Tom de Vries
2026-05-22 14:54   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260522143737.3373000-3-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox