public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Subject: [PATCH 3/5] gas: add Dwarf line number test for .macro expansions
Date: Tue, 29 Nov 2022 11:37:42 +0100	[thread overview]
Message-ID: <8b41d62d-8345-a2bd-ce90-27d79aefe2eb@suse.com> (raw)
In-Reply-To: <9afdf9c8-323b-78c1-d75b-8964e00cdec5@suse.com>

Before fiddling with the code let's put in place a test covering what
PR/gas 16908 aimed at.

--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf-5-macro.d
@@ -0,0 +1,27 @@
+#as: --gdwarf-5
+#name: line number entries for .macro expansions
+#readelf: -W -wl
+# The am33 cr16 crx ft32 mn10* msp430 nds32* and rl78 targets do not evaluate the subtraction of symbols at assembly time.
+# The d30v target emits sufficiently different debug info, apparently also covering padding it inserts.
+# The riscv targets do not support the subtraction of symbols.
+#xfail: am33*-* cr16-* crx-* d30v-* ft32-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
+
+Raw dump of debug contents .*
+#...
+ Line Number Statements:
+.*Extended opcode 2: .*
+.*Advance Line by 10017 to 10018
+.*(Copy|Special opcode .* Address by 0 .* and Line by 0 to 10018)
+.*Special opcode .* and Line by 1 to 10019
+.*Special opcode .* and Line by 1 to 10020
+.*Set File Name to entry 2 .*
+.*Advance Line by -10012 to 8
+.*Special opcode .* and Line by 0 to 8
+.*Set File Name to entry 1 .*
+.*Advance Line by 10018 to 10026
+.*(Advance PC by .*|Special opcode .* and Line by 0 to 10026)
+#...
+.*Special opcode .* and Line by 1 to 10027
+.*Special opcode .* and Line by 1 to 10028
+.*Advance PC by .*
+.*Extended opcode 1: End of Sequence
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf-5-macro.s
@@ -0,0 +1,28 @@
+	.macro m1 args:vararg
+	.nop
+	.endm
+
+	.macro m2 args:vararg
+	.file "Line.s"
+	.line 7
+	.nop
+	.endm
+
+	.macro m3 args:vararg
+# 10013 "line.S"
+	.nop
+	.endm
+
+	.text
+macro:
+	m1 1
+	m1 2
+	m1 3
+
+	m2 1
+	m2 2
+	m2 3
+
+	m3 1
+	m3 2
+	m3 3
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -308,6 +308,7 @@ if { [is_elf_format] } then {
     run_dump_test "dwarf-5-cu" $dump_opts
     run_dump_test "dwarf-5-nop-for-line-table" $dump_opts
     run_dump_test "dwarf-5-irp" $dump_opts
+    run_dump_test "dwarf-5-macro" $dump_opts
     run_dump_test "dwarf-3-func" $dump_opts
     run_dump_test "dwarf-5-func" $dump_opts
     run_dump_test "dwarf-5-func-global" $dump_opts


  parent reply	other threads:[~2022-11-29 10:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 10:34 [PATCH 0/5] gas: diagnostics for macros and some tidying Jan Beulich
2022-11-29 10:36 ` [PATCH 1/5] gas: avoid inserting extra newline in buffer_and_nest() Jan Beulich
2022-11-29 10:36 ` [PATCH 2/5] gas: squash (some) .linefile from listings Jan Beulich
2022-11-29 10:37 ` Jan Beulich [this message]
2022-11-29 10:38 ` [PATCH 4/5] Arm: avoid unhelpful use of .macro in testsuite Jan Beulich
2022-11-29 10:44 ` [PATCH 5/5] gas: re-work line number tracking for macros and their expansions Jan Beulich

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=8b41d62d-8345-a2bd-ce90-27d79aefe2eb@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).